Conquer the Dreaded Table of Contents

Edited 09/26/2015: There’s still some fairly useful information in here, but there’s a far easier way to make a better looking TOC in Word.  See my latest post on it here.

There’s a lot of debate in the eBook world about whether or not eBooks actually need a Table of Contents.  The trends is leaning toward short story and anthology collections should definitely have one and novels may not need one.  Personally, I like the idea of a TOC in novels but that’s just because I’ll usually go back and read parts of a book later.  A TOC makes that a lot easier to do.  I’ve also been toying with the idea of adding a last page enty into my table of contents to support people like me who like to read the last page of a novel just to see what happens.

Fortunately, making a decent Table of Contents is fairly easy in Word.  Formatting it is a bit trickier but by no means rocket surgery.  It’s just step intensive and prone to failure.  Before you begin remember a couple things: have a backup of your book and Ctrl-Z (undo) is your friend.  We’re going to start with a raw Word doc (it’s got story titles and the first paragraphs of some of the stories I’m working on) and proceed through making a table of contents and formatting it for an eBook.

If you want to make life easy for yourself, get the whole book done before you even begin tackling this.  I’m not kidding here, you want the whole thing done and ready to go.  The TOC is absolutely the last thing you want to do because any changes in the text will mean you have to rebuild the TOC.

As a side note, this is an image-heavy post but the images are actually useful (unlike most of what I put in blog posts), so check them out.

This whole post springs off an earlier post about eBook formatting that I felt lacked some of the necessary steps to make it really useful.  Before you begin, make sure you’ve got some software handy and a basic understanding of how to use it.

Calibre (a wonderful and free eBook converter)

Sigil (a piece of software that will let you crack open ePub files and modify the HTML inside of them directly)

Kindle Previewer (an Amazon tool that will let you convert ePub to mobi using Amazon’s KindleGen software and see what your final file will look like on a Kindle)

A word processor (I used Word 2010, Libre Office and OpenOffice have similar features and cost much less)

To get started I mocked up a collection of stories and added a couple paragraphs from each one.  This is just meant to represent a normal document.  Your manuscript is probably a bit longer than two pages.  Normally you’d have page breaks between the stories but that’s beside the point and I’m a bit lazy tonight. (Click each picture to embiggen them, or right click and open in a new tab).

The actual stories will be out later this summer
The actual stories will be out later this summer

Not much to see here.  This is just some story titles and some text using Word’s default styles.  That’s okay because this is about the dreaded Table of Contents not the rest of the book.  The rest of the book is actually much easier to deal with.

We’re going to start by telling Word what constitutes a chapter header and, therefore, what to add to the table of contents.  You’ll do this with your good buddy styles.  To be frank, all your formatting should be done with styles, and making your TOC starts with styles.  Mark each story title with a Heading 1 style (you can format it to your heart’s content).  Select the text you want to make a TOC and click the Heading 1 style.  Boom.  Done.

I don't know who decided Word's default styles but they're pretty bad.
I don’t know who decided Word’s default styles but they’re pretty bad.

As you mark things with Heading 1 the navigation panel on the left fills in with data.  You can, like, totally click on those lines and they’ll take you to the points in the document.  Navigariffic.  This is, incidentally, the only formatting I do while I’m writing and that’s just because it makes it so much easier to navigate around the document.

From here, add a new blank page and add a Table of Contents.  This part is pretty trivial because Word loves you so much.

What's wrong with this picture.
What’s wrong with this picture.

Only one problem: eBooks don’t have page numbers because they’re really nothing more than a website running off your reader.  So, we need to get rid of those page numbers.  Should be easy, right?  Wrong.  Why?  Because Word hates you.  If you try to just highlight the part you don’t want and delete it you’ll wind up deleting the whole line and that’s where your good buddy Ctrl-Z comes in so handy.  This is also why you have a backup.

You do have a backup right?

To rid yourself of the hated page numbers, place the cursor right after the the text of the chapter title and press delete once.  This will remove all of the elipses (Are they still elipses when there’s more than 3?  Inquiring minds want to know) and you’ll have something that looks like this: titlenumber.  Leave the cursor where it is and press shift and the right arrow key until the whole number is highlighted.  Then press delete.  Bam!  You’ve got a clean chapter line.

TOCMods
Word looks like it’s highlighting the entire TOC, but it’s really not. This is just to confuse you.

Now, just to get fancy we’re going to put a little blurb under the title.  Don’t move the cursor, just press Enter and type up something.

TOCWBlurb
Great for anthologies!

It’s ugly now, but that can be changed.  We’ll make a couple new styles and do some formatting.  To make a new style, right click anywhere in your text that you want the new style applied to, go to styles and click Save selection as new quick style.  Give it a name (I called mine TOC blurb) and click the modify button.  Now you can tweak the layout and font choices.  Be careful with fonts; Kindles have a limited font set that they’ll display in.  If memory serves, they tend to convert to Georgia, although I’ve good luck with common fonts like Arial, Times, and Garamond.  Don’t go nuts with your fonts and definitely don’t use Papyrus or Comic Sans.

CSS O' Matic
CSS O’ Matic
NewStyle
Style names can be clever but no one but you will ever see them.
NewStyleMods
Modify!

I’ve selected 11pt Arial (the size is kind of immaterial), Italic, with a .5″ indent.  I also made some other styles for the chapter titles and the Contents line.  The style looks okay, not great, but works to show off what you can do.  Again, no Papyrus or Comic Sans.  Also, Old English script doesn’t make things look classy; it makes them look gangsta.

TOCModFinal

So, that works.  Convert it to epub however you wish (I used Calibre) and open the converted epub file in Sigil.  Remember how I said an ebook is really nothing more than a website?  This is what your epub looks like when you crack it open in Sigil.

SigilBookView
Book View

The damned chapter titles are blue and underlined!  WTF?

Don’t fret.  The chapter titles are hyperlinks (<a href …> tags) that link internally to the document.  Default styling for a hyperlink is underlined blue.  Switch it over the code view and you can see what’s going on better.

Code view. Note the highlighted line.
Code view. Note the highlighted line.

Right above the highlighted line is a bit of text that reads <a class=”text_”… This is a reference to your CSS stylesheet class that controls how the book renders.  On the left hand side of Sigil is a list of folders.  If you look in Styles for stylesheet.css and open that file you’ll get the following.  I’ve already scrolled this all the way down the .text_ {} line and done some modifications.  First, I set the color to black and removed the line that did say text-decoration: underline.

CSSMods

Note in the preview pane the chapter title is still underlined.  We can fix that guy’s little red wagon, but you’ll see in the final that it doesn’t do much due to the way Kindles have been coded to render files.  Since our chapter titles are just hyperlinks and hyperlinks are, by default, underlined, we can add a new bit of CSS code to override the default <a> tag behavior.

It's just a few lines.
It’s just a few lines.

Down at the very bottom (or really wherever you feel like putting it) add the following code:

a{text-decoration:none;}

It's just a few lines.
It’s just a few lines.

Now look at your preview.  No underline, yo.  Fo shizzle!

Save the file and open it in Kindle Previewer to convert to Mobi and see how it’ll look on a Kindle.  You should see something similar to this:

KindlePreviewer

The titles are back to being underlined.  Not much you can do with that, it’s just the way Kindles render those hated <a> tags.  In the final analysis, though, this isn’t really a bad thing.  Underlining provides a visual cue to your readers that they can click or tap something and move around the document.

Upload your new mobi file and you should be good to go.

Questions? Comments?  Drop a comment and I’ll get back to you.

Advertisements

8 thoughts on “Conquer the Dreaded Table of Contents

  1. This as really great. It is something I have struggled with. I put a TOC in the Paperback of Galaxies Apart, but left it out of the e-Book.

  2. This is packed full of info. I haven’t played with Styles much and need to figure it out. I didn’t know how to edit styles…will have to set up some useful ones. Like you mentioned, the preset styles are pretty bad. I think that’s why I didn’t bother. I’m looking forward to working through this on a document to see how it goes. Well done.

    Silas

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s