How to format an e-book


How to format an e-book

The following instructions will give you a beautiful e-book in the format of your choice, without the problems of section breaks, etc. that are often seen in self-published books. We are grateful to Guido Henkel for some of these tips; check out his site if you want a much longer, more detailed guide.

What you need:

A. Word processing software with your manuscript (typical program such as Word, Open Office, etc.)

B. A good text editor. We recommend TextMate or BBEdit.

C. Calibre, a free program for converting html to all popular e-book formats.


1. Clean up your word processor file. Replace all quotes with smart quotes as needed. Make sure em-dashes are truly em-dashes and not double hyphens, and ellipses are proper ellipses. Then do a search and replace for italic style text, replacing all text in italics with <i>^&</i>. You may do the same with boldface if you have bold in the text by using <strong>^&</strong>, but this isn't recommended for chapter headings.

2. Cut and paste the entire file into your text editor. It is now on one line with all formatting removed.

3. To add paragraph breaks, do a search for “^(.+)$ ” and replace with <p>$1</p>, making sure that “regular expressions” are enabled in your text editor.

4. Add an html header to your file; the following works. It gives paragraph indents of 1.5em; note that 1 em is 12 pt.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<style type="text/css">
html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin: 0; padding: 0em; }
text-indent: 1.5em;
margin-bottom: 0.2em;

At the end of your file, put


5. To replace all special characters (such as quotes, ellipses, etc) with named html entities, see if your text editor can do this automatically. For example, TextMate has a function called “Convert Selection to Entities excluding Tags.” BBEdit has this feature under the Markup menu (utilities–>translate). Simply run this, and all right single quotes will become  &rsquo; and so forth. A list of named entities can be found here.

6. Define some style files for chapter headings and so on, as needed. For example, the following gives 24-point chapter headings

text-indent: 0em;
font-weight: bold;
font-size: 2em;
page-break-before: always;
text-align: center;

7. Go to each chapter heading in the book and bracket it with the style, for example

<p class= “chapter”>Chapter One: The Mean Ducks</p>

8. You may wish to do similar things for certain other stand-outs in the text. For example, if you have correspondence in your novel that you would like to set off from the rest of the text, this will make the selected areas smaller and more deeply indented:

font-size: 0.8em;

9. Note that margin-right often doesn’t work in most e-readers. Also note that specifying fonts is NOT done–the e-readers do this for you!

10. At this point you may wish to convert your text to try it out (before adding title pages, dedications, etc). Save your file as .html and open Calibre.

11. Click “add books” and upload your file. You may wish to add metadata, including coverart, at this point, or you may just wish to test the file right away.

12. Click “convert books” to produce an output version of your choice: .mobi, .epub, etc. We do not recommend using Calibre to make .pdf files!

13. The table of contents will be made automatically, and by default is placed at the end of the book; you may instruct Calibre to put it in the front if you wish.

14. Read through the file on your e-reader or emulator, paying careful attention to italics, boldface, chapter headings, and special styles.

15. Once the main text is finished, you will probably want to add a title page, dedication, and copyright information. We use the “chapter” style for the cover page, and “front” style for the small text:

text-indent: 0em;
page-break-before: always;
font-size: 0.8em;

16. Images can be inserted using the following format:

<img src="duck.png" alt="duck" />

the “alt” is important for readers that cannot reproduce the image; it should give a brief description of what the image shows.

This can be used to make custom chapter headings or closings, maps, or any other additional touches you may think of.

Comments are closed.