Electronic books (eBooks) have had a big impact on the publishing industry. Besides being generally cheaper and easier to obtain, they are also simpler to publish. Most authors prepare their manuscript in a word processor such as Microsoft Word, and then use a conversion program to put it in the desired electronic format. While this often works, it usually doesn't produce nicely formatted eBooks. I will show you how, with a little effort, you can control the format of your eBook.
eBooks have a number of characteristics that are quite different from printed books. In printed books the page length, margins, font-size, and spacing can be strictly controlled. This is not true for eBooks. The reader of an eBook can change the font-size and line-spacing. Thus, there is no fixed page length. In addition, eBooks can be read on a variety of devices such as kindles, cell phones, tablets, and desktop computers. Each of these devices will display the content differently. Thus, eBook formats have to allow for free-flowing content. For this reason, the major eBook formats are based on HTML, the language of the web.
The major eBook formats are the MOBI, KF8, and KFX formats (used by Amazon) and the EPUB format used by most other eBooks. Since these formats are based on HTML, it makes sense to prepare your document in HTML format instead of relying on some conversion program. The original MOBI format (azw file extension) only supported a limited subset of HTML. In 2011 Amazon introduced the KF8 format (azw3 file extension) that is supported in fourth generation and later kindle readers. In 2015 Amazon introduced the KFX format (kfx file extension) that is supported in seventh generation and later kindle readers.
EPUB, KF8, and KFX have broader support for HTML than the older MOBI format. For the most part we will restrict ourselves to the limited subset of HTML supported by the older Kindles. This is not a serious limitation since most documents only require a few common HTML tags. It is also good for the beginner since there is much less to learn. However, the percentage of users using the older Kindles is shrinking, so use of more advanced HTML will not greatly reduce your readership. For those familiar with HTML it will be necessary to learn which HTML tags are supported and how some of the defaults are different than those employed by the web. The MOBI format also supports a subset of CSS (Cascading Style Sheets). CSS styles give the user more control over the display of text and images. I will discuss the basics of HTML and CSS as used by the Kindle formats (and also EPUB).
We will use the following approach to constructing an eBook:
- Prepare your document(s) in Microsoft Word.
- Copy and paste the text into a text editor such as notepad++ (free), removing the Word formatting in the process.
- Add necessary HTML tags to the text document(s) using regular expressions, a powerful search and replace technique.
- Prepare a CSS style file to add desired visual effects.
- Prepare organizational and navigation files required by EPUB.
- Zip (compress) the EPUB files into an EPUB document.
- Validate EPUB document.
- Preview your epub document in the Kindle Previewer to see how it would look on a Kindle device.
- You can export your document from the Kindle Previewer to a mobi file that can be side-loaded into a Kindle device. This mobi file contains both the original MOBI format and the KF8 format. If your goal is to submit your document to Amazon for publishing, the epub file can be used as the source file submitted.
If you are familiar with HTML, then you can skip the first three steps and write your document(s) directly in a text editor — adding HTML tags as you go.
The Table of Contents for this paper (labeled Contents) can be accessed on the top bar. To view or download a copy of this paper in Adobe Acrobat format you need to click on the link eBook Formatting (PDF).