For this Inside the ePub (and Kindle) Format series, I discuss your content. By your content, I mean all that text you wrote for your eBook. Let’s get started!
Prepare your content
Before you output your content to eBook, there are a few things you need to do. The following sections get you up to speed on these up front items and then I share more detail about incorporating your content into the ePub file.
Add chapter headings
Remember from my first post that your eBook is nothing more than one or more web pages. Your eBook should follow web standards where possible, and one of the most relevant standards you need to follow is to use heading styles.
Minimally, you should choose your writing software’s default Heading 1 style to create chapter headings so you will have a table of contents. Most word processors and editors will let you select from Heading 1 to Heading 6 (html only allows for six headings by default).
Stay consistent, always using heading 1 for a new chapter, heading 2 for sub-chapters, heading 3 for a section under heading 2, and so on.
- In Microsoft Word, go to the Home tab and select the Heading 1 or Heading 2 style. You can choose up to heading 6, but you will need to poke around to find those extra styles.
- In Apple’s Pages, go to the Format pane and select from Heading, Heading 2, Heading 3, and Heading Red. I did not investigate whether creating more styles will automatically update the table of contents so you will want to investigate that on your own.
- In Sigil, locate the toolbar icons at the top of the application and choose H1, H2, H3, H4, H5, or H6.
Of course this is not a full list of all the word processing applications, but hopefully, you get the idea and can figure out the right method in your favorite word processing application.
Add a title
Most word processing applications use the default Title style for the title of your eBook, so find that style and use it for your eBook. Follow the basic instructions I provide in the previous section and I am sure you will easily find the Title tag.
In most word processing applications, the text displays as you see here in this blog. The text always aligns to the left. However, in the ePub format, the first line of every paragraph will indent, as you can see in the following example:
As you can see, even though the word processor does not indent the first line of every paragraph, the ePub does do the indent for you. If you want to view your eBook with the first line indent, you can use paragraph styles in your eBook.
Tip: If you are writing a piece of fiction, I suggest you let the eBook reader do the first line indent. If you are wriging a technical book with specific layout requirements, you can do this little trick in your word processor: Modify the style for the normal/default text and set a hanging first line indent of 0.01 inches.
If you want your book to look more like the eBook while you are writing, I recommend you modify the normal/default text and set a hanging first line indent of 0.25 inches.
Bullets, tables, fonts, and special formatting
I want to avoid this article turning into a best practices document for your content, but here are some tips:
- Avoid using any bullets other than the standard black-filled bullet (like the one at the front of this paragraph).
- Avoid using tables. Instead, create the table in PowerPoint, Excel, or some other tool. From there, you can almost always right-click and save the selection as a png file and then import that image into your eBook.
- You might have a favorite font that you love to use in your eBook. Unfortunately, you will likely have to pay royalty fees to use these fonts. I recommend you use a standard Times New Roman for works of fiction and Palatino for technical books. If the eBook reader does not have the font you use, just let it select the closest match. Remember, the person reading your eBook can always change the font to their preference.
- If you use special formatting, like multiple columns, laying graphics over text, or similar features, you may find it will not output as you desire on an eBook. Keep your book’s layout simple and try not to get too advanced with the features.
Your content files
Technically, the ePub format supports standard html, but that is for backward compatibility purposes, although eBook readers (like the Amazon Kindle, or iBooks on the iPad) do not have to support html. The format you need your content in is xhtml.
You will need to output your book to one or more xhtml files. Ideally, you will output each chapter of your book as an individual xhtml file, which should make the book load a little faster and help you in building your opf and ncx files. For works of fiction that are 20K-40K words, I doubt breaking your chapters out in this fashion is all that important. For larger books, like technical books containing a lot of images, you should consider outputting each chapter as its own xhtml file.
Blatant plug: The Optical Authoring eBook Toolkit runs inside Microsoft Word and can output one or multiple files to the ePub format and converts your content to industry-standard xhtml format.
Get a free copy here: https://www.opticalauthoring.com/shop
Watch the video here: https://vimeo.com/171127529
There are some important things you must remember about xhtml files:
- You cannot embed a css file into a xhtml file.
- If you do use tables (and I do not recommend it), you should make sure the styling is also in an external css file.
- If you use anything other than a standard bullet, it may not work.
Linking content to the table of contents
The navigation document is the one-stop shop for your reader to access all the content in your eBook. The problem with the table of contents is it just links to a file. If you have one xhtml file that contains all 20 chapters of your book, you need to link to all 20 chapters.
If you use sub-headings (like Heading 2, Heading 3, Heading 3, and so on), you will likely want to link to those as well.
The way I do this is to codify each heading with a unique identifier (note: The Optical Authoring eBook Toolkit does this for you automatically if you are using Microsoft Word as your word processor).
There are many ways to codify a heading so you can link to it. In my case, I use Microsoft Word. Microsoft Word generates unique identifiers for each heading, but I like to create my own so I can keep track of them separately from how Microsoft Word works. What I do instead is place a <div> tag right above the heading, like this:
<h2><a id="_Ref415582357">The Microsoft Project User Interface</a></h2>[/html]
The first line is my manual <div> line. I add a _toc_ prefix so it is clear this is something that will appear in my book’s table of contents. I then use a unique identifier that cannot possibly be used elsewhere in the book. Here is a website that lets you generate a GUID (globally unique identifier): https://www.guidgenerator.com/
When building my navigation document (the table of contents), I simply add it like this:
The Microsoft Project User Interface
Note: For older eBook readers that do not support ePub 3.0, you need to use an ncx file. Some eBook readers do not let you link to unique id’s within a single document, so if you really want to support as many eBook readers as possible, I suggest you break each chapter into its own individual file.
Write your content in any application where you feel most comfortable. After you are done, get the content into xhtml format. You can then add your content to the ePub file and link chapter heading(s) to the Navigation document.
As a best practice and to support older eBook readers, consider breaking each chapter of your book into an individual file. Some software does this for you, like Scrivener, and others expect you to do this yourself, like Microsoft Word and Apple’s Pages.