I’ve been fighting with ePub formatting for a while now. It turns out I was trying to do too much. The eReaders (hardware & software) do a great job of displaying even unformatted text. I even experimented with using a blank stylesheet to see what would happen. The result was actually better than some styles available for download.
So I started from that blank page and built up the elements that I wanted, and let the defaults handle the rest.
Here’s the list of what I changed:
body: widow and orphan control, along with disabling hyphenation.
.chapter-title: centered, colored, and some space added above and below.
section-title: page break before, and space below.
blockquote: italic text, reduced line spacing, and the last paragraph becomes a right-aligned attribution line.
code: colored text and a border around inline text.
Also figures (images) are maximized for the page size. Their captions have colored text.
One of the neat things I was able to do was to convert the first H1 (
#) into a title page. By using the CSS ID attributes the first H1 gets enlarged while the rest are normal sized chapter headings. Also the first paragraph after is centered to serve and an author byline.
Start a sheet to serve as your title page. Just put a H1 (
#) and type your title. Press return twice and type “by” then press
shift-return for a new line and type your name. Don’t write anything else on this sheet. On export it’ll become a nicely formatted title page.
For a copyright/dedication/preface page, use H2 (
##) followed by a divider/horizontal line (
----). This will make the line invisible and provide some space before the text starts. Also an H2 will start a new page, so if you use it to create all the front matter pages they’ll show up in the table of contents as children of the book title. Then your second H1 will be the start of the text.
The blockquote formatting is one of my favorites. I figured out how to make the last line into an attribution line that’s aligned to the right of the page. All without having to do anything different with the markdown.
Here’s how it looks in Ulysses:
And the result in iBooks:
I just have to remember the last paragraph of a blockquote is going to get this formatting and make sure to include the attribution. This can be turned off by commenting out the code on lines 75-78.
If you look at the code, you might notice that I didn’t assign a style to the actual
h1...h6 elements. After experimenting, I found it wasn’t necessary. By using the class elements
.section-title I was able get the headings that I wanted. These correspond to
h2, respectively, and Ulysses adds them when exporting. It seems to work about the same, I think the result is more compatible.
You also might notice I didn’t style the list elements. Bottom line, it’s just a list. I think it’s better to let the eReader handle formatting for things like that.
Tips on making Kindle books
I’ve found the Kindle Previewer 3 beta works great for creating the
.mobi file. Just save the ePub output from Ulysses to the desktop and then open it with Kindle Previewer and check your pages. This new version installs on the Mac without need to download extra software. The Kindle (and Kindle apps) was designed for reading, and the defaults are great. By only using the minimum of formatting, KBasic styled books look professional and uncluttered.
If you make eBooks with Ulysses, I hope you give this style a try. You just might be surprised at how good such a minimal style can look.
Remember, if you’d rather not bother with all this I can turn your text into a eBook for a reasonable fee with quick turnaround. Contact me for more info.