Easy Peasy, Make A Simple Index For Your Ebook

One of my earliest efforts at making ebooks was Ehrengraf for the Defense, Lawrence Block’s collection of Martin H. Ehrengraf short stories. It’s also the ebook that set me on the path to learning html. I built the original ebook in Scrivener. While it turned out great and I was very proud of it, it encountered a rather nasty bug that affected older Kindles. It makes the font teeny-tiny and forces users to greatly increase the size of the font in order to read it. It’s not a fatal bug, but a bug nonetheless.**

As long as I was rebuilding the file in html, I decided to stick a little something extra in it. Martin Ehrengraf loves poetry and often quotes it. Each of the eleven stories is preceded by a snippet of poetry, too. In the older version I put the poem snippets and poets in the table of contents. In this version I decided it would be tidier to make an index.

Basically, it’s a table of contents. Click on an entry and it takes the user to the quoted poetry.

The only difference between this and a table of contents is that a ToC is listed in order and this index is alphabetized. I also included a few double-entries for the instances of multiple poems by the same poet.

One important thing for Kindle formats (and thank you Paul Salvette for the head’s up about this) is to make sure you use the “div id=” tag as opposed to “a name=” tag. I enclosed the entire quote with “div” and “/div”. This ensures that when the user clicks through to a poem it doesn’t blow out my formatting. What it looks like is this (with extra spaces to keep from triggering wordpress’s helpfulness):

This is very easy to do. The most difficult part is finding and keeping track of the entries. Because I used a special class for the poetry quotes, I did a search for the class name then used my analog word processor (a pencil and notebook) to list items as I found them. A quick task with so few entries. For something more complicated, such as a glossary of terms, I’d have the author tag the terms or passages to be indexed in the source file (by bolding the text, perhaps) then search for the bolding (or other tag) throughout the file, ID the entries, then copy/paste the items with their identifiers into a program that lets me automatically alphabetize the entries. That way I could double-check to make sure each identifier is unique and make sure the entire list is properly alphabetized.

Easy-peasy.

** Scrivener users. The Kindle bug that makes tiny fonts in older devices is triggered if you use fonts smaller than the default. Make sure your font default size is 12pt throughout the entire file. It doesn’t appear to make any difference if you increase the font size for headers or whatever. Also, when you compile your file for Amazon do NOT compile a Word file. Amazon will allow you to upload a Word file and will convert it with seemingly no problems, but it can cause the font to “lock” and not allow the user to control their font preferences. Compile your files into mobi files. This means you will have to download KindleGen into your computer, but it’s free and easy and it will ensure that your ebook renders properly on various Kindle devices.

My apologies. The “div” coding is for html not Scrivener. I did the rebuild for EFTD in html.
The “div=id” code creates the bookmark by giving the targeted text a unique identifier. The “a href=” creates the link in the index that points to the unique identifier.

The Scrivener comments refer to the Kindle bug, which is what led me to learning html in the first place.

It’s been a while since I’ve created internal links in Scrivener. I know it has to do with the “Scrivener Link” in the “Edit” menu, but cannot remember how to do it off the top of my head. Instructions will be listed in the tutorial. Every else is :D.

It does something funny on the Kindles. I have no idea why. But if you use the “a name” and users click on the link, sometimes it will wreck the formatting. Not overall, just what the user sees–clicking pages will restore the formatting, so it’s not fatal, just annoying. Using the “div” tag prevents that. I have no idea if the same thing happens on the Nook or other readers.

So if I buy “Ehrengraf” from Amazon now, it will work properly on my obsolete Kindle 4?
If so, I don’t need to go shopping on Friday, no matter what color the day is! In fact, I’ll play Jeff Lynne’s new CDs over and over (at least until my wife complains) and call it Mr. Blue Sky Friday. :) If Amazon had managed to get enough of the new Kindles out, it could have been a PaperWhite Friday…but the current estimated ship date is a month away, and I don’t expect to be able to try one in a store (I *have* to try it out before spending $120) until next year, at this rate.

The screenshots above are from my Paperwhite. It is a wonderful reader and I’m enjoying it very much. And yes, the battery life is as good as claimed. It actually charges more quickly than my older Kindle, too. Nice.

I know the a tag name=”x” convention works on the Nook Tablet, but I will have to try my hand on the div tag variant. (I’ve got a coulpe dozen comments for Paul Salvette when I finally have the time to track them down from stored notes in his book.)

Have a wonderful Thanksgiving, and be on the lookout soon for the file we discussed in off-line e-mails.

I keep discovering quirks and no-nos in formatting. (like for instance, the tag is a no-no when trying to validate an EPUB, but causes no problems at all with KindleGen) There is other stuff that the conversion programs will let pass, but that will then end up doing bizarre things on ereading devices. It’s just a matter of testing and figuring stuff out. Le sigh…

Hi Jaye: I had another question. (Yeah, I know — worse than an inquisitive four-year-old!) I noticed on the screenshots here that they (Amazon) show, not a page count (faux or not), but a time remaining in book value. Is this just a guesstimate on Amazon’s part, or is it based on the length of the text divided by how quickly one “turns” the “page”? Or is it just one of several possible progress displays one can choose to use?

Hi Jon,
The time estimate is a feature on the Paperwhite. Some nifty algorithm, I suppose. I don’t care for it, but I’m not motivated enough to figure out how to turn it off or modify it, so I ignore it.

Does your above-mentioned formatting technique apply for links one creates for a ToC? And just what do you mean by “blows out my formatting”? Any chance you could show us an example of what this means?