Monday, 7 March 2011

How To Create A Kindle Table Of Contents

When the time came for me to test out my book in the Kindle Previewer, everything was find any dandy – apart from one thing: the pesky table of contents.

There was nothing wrong with the Table Of Contents itself. I’d created one in Microsoft Word and it had been correctly built into my Kindle eBook. It listed all my chapters and when I clicked a chapter entry, it took the reader to that chapter.

The thing that wasn’t working was the Kindle’s built-in navigation to the Table Of Contents (from its ‘Go’ menu which is accessed in various ways according to whether you are using a hardware or software Kindle Reader). Every time I clicked this option I saw this error message...


I spent a couple of days trying to find and fix this problem. I searched numerous web sites and forums and found many explanations, most of which were either incomplete, incomprehensible, vague or just plain wrong. Anyway, I eventually found the solution and in this article I’ll explain all the steps you need to take in order to add a fully functional Table Of Contents.

Create The Table Of Contents

First, you need to generate hyperlinked Table Of Contents. I am going to assume you will do this using Microsoft Word. If you’ve never made a Table Of Contents in Word before, the easiest way to do so is to format all your chapter headings as an outline. You can see the Outline structure either by selecting View/Outline or (as I prefer) by displaying the Document Map, View/Document Map.



Make your Novel Title the root of the Outline (press SHIFT+ALT+Left Arrow) or select the Heading1 Style from the Home toolstrip. For each chapter, either select Heading 2 or indent one level (press SHIFT+ALT+Right Arrow). The end result should be that you have your novel Title shown as the ‘root’ at the top and the left-most level in the Document map and the chapters each indented one level below that.

When you want to generate your Table of Contents, go to a blank area, typically close to the front of the book and select References/Table Of Contents/Insert Table Of Contents.



Set Show Levels to 2 (or 3 if you have more levels in your outline) and turn off page numbers since Kindle books don’t have fixed page numbering. You can also click the Options button to tailor which styles are used to create TOC entries if necessary. When you’ve finished, click OK and Word will insert the Table Of Contents.



You may need to delete items that you don’t want there – for example, the root item (the name of your novel).

In order that Kindle can find your Table Of Contents you also need to insert a bookmark called “toc”. To do that, position your cursor immediately before your Table Of Contents and select Insert/Bookmark. Enter toc and click Add. You should also add a start bookmark at this stage. Position your cursor at the logical start of your book (that is, before the first paragraph of chapter 1), select Insert/Bookmark. Enter start and click Add.



Now save your text as filtered HTML, as explained in my last Blog post. You are now ready to generate your book using the Mobipocket Creator, the basics of which were also explained in my previous post.

Create Your Kindle Document


In summary this is what you need to do:

Step One – Import Your Document


1) You’ve already saved your Word document in Web Page, Filtered HTML format. Let’s assume this file is called MyNovel.html and it’s in the C:\KindleDocs directory.
2) Load Mobipocket Creator.
3) Click Import From Existing File/HTML document.
4) Click Browse to Choose A File. Pick your file – for example, C:\KindleDocs\MyNovel.html.
5) Select a folder into which you want to place your finished publication. Again you may browse to this. Let’s assume the Publication folder is: C:\KindleDocs\Publish
6) Click Import

Mobipocket Creator should now confirm that your file has been imported.

IMPORTANT: At this point you should have two important directories – your Source Directory (containing your original documents) and your Publication Directory (containing files created or copied by Mobipocket Creator).

In my example, my Source Directory is: C:\KindleDocs
My Publication Directory is C:\KindleDocs\Publish

Mobipocket Creator will make subdirectories beneath the Publication Directory and in one of these subdirectories there will be a copy of the original HTML file. For example in my case this is in: C:\KindleDocs\Publish\MyNovel.

Now, to make the TOC and Start links operational, I have to add some ‘Guides’ which refer to the bookmarks in my HTML file.

Step Two - Add 'Guides'


1) Click View/Guide in Mobipocket Creator
2) Click New Guide Item
3) Select Type/toc
4) Add a Filename and a toc link following a hash (#) character.
To do this, click Browse and browse to the COPY of the html file under your Publication Directory – e.g. : C:\KindleDocs\Publish\MyNovel\MyNovel.html. DO NOT browse to the original html file (e.g. : C:\KindleDocs\ MyNovel.html)!
Now edit the file name by appending #toc
The full entry in the File Name should now be the file name itself plus #toc – for example, MyNovel.html#toc
5) Add a start link in the same way. i.e. Click New Guide Item. Select Type/start and browse and edit the file name by addng #start at the end. The text in the file name field should be something like: MyNovel.html#start
6) Click Update

Step Three- Add Cover Image


If you have a cover image add this now.
1) Click View/Cover Image
2) Click Add Cover Image
3) Browse to your Cover image (suggested format JPG, 800x600).
4) Click Open then Click Update.


Step Four - Create Your Publication

You are now ready to generate the finished publication.

Click the Build icon at the top of the screen. Then click the Build button.

If there are any errors or warnings, review these now. If, for example, you added Guides to your original HTML file (in the Source directory) rather than to the one that Mobipocket Creator copied into your Publication directory, you will see Link errors. Guides must be applied to the HTML file in the Publication directory only.

Your publication is now created as a file ending with ‘.prc’ in your Publication directory. Load this into a Kindle Reader or the Kindle Previewer as explained in my last Blog entry. You should now be able to click the Go menu and select Cover, Beginning or Table of Contents to go immediately to your cover image, the text marked with the ‘start’ bookmark and the Table Of Contents marked with the ‘toc’ bookmark.



The proof of the pudding is in the Publishing. I’ve just published my Kindle book on Amazon and if you’d like to verify that my Table Of Contents is full functional, I’d be delighted if you would buy a copy. Naturally, I’d be even more delighted if you then read the book! ;-)


57 comments:

  1. Hello, Huw !
    I've read your excellent post about the TOC and I'ev used it to make the same here! Since i'm finishing my book to publish it in Amazon, I'm having a problem with the toc.ncx file... Have you created one? Mine is showing a problem in the "start" hyperlink. If you've created one, please, could you share what did you do? Thanks! Alex

    ReplyDelete
  2. No, I haven't tackled a ncx file - for two reasons: 1) it seems to be inordinately complicated for very little obvious benefit and 2) I have yet to find any other Kindle book that has one - even the book samples provided by Amazon (Sherlock Holmes etc.) don't have them. I know Amazon says books should have them - but the fact is, most don't.

    The type of hyperlinked TOC that I've made is, however, worth the effort, I think.

    Curiously, if you publish your book to Smashwords, you'll find they don't like hyperlinked TOCs and they will ask you to remove one if you have it. However, Smashwords automatically generates a NCX file so if you really want one of these, Smashwords is the easiest way of publishing with one.

    Since Smashwords auto-generates an NCX, I suspect it won't be too long before Amazon does that too. For now, though, I don't think NCX on Amazon is worth the effort.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I have a problem!
    In Word 2003 I have generated a TOC - linked to Chapter headings / Author Notes & End Notes. This works fine.
    Then, in the text I have inserted End Notes (1 to 12) which are hyperlinked to each particular End Note.
    I want to put a link back from each numbered End Note to the text page where the number is located.
    Don't know how to do this! Could you give step-by-step instruction? I wold be so grateful!
    Thanks in advance.
    Mike O'Shea - EMAIL: mike@o2cbooks.info WEB: www.o2cbooks.info

    ReplyDelete
  5. Michael, if I understand correctly you are trying to link endnotes to numbered pages. In Kindle that's not possible as pages don't have numbers - that is, the Kindle reader treats your text as one sequential unit which is displayed in page-sized chunks. But the size of each 'page' varies according to font size, the Kindle device on which it's displayed etc. (so there are no fixed page numbers). If, however, you want to create hyperlinks to a word or paragraph that should be possible using a regular HTML-style hyperlink (an a href= tag). I've never tried using endnotes and this may take some trial end error but if you can get the links to work in your generated HTML, I think they should also work in your final Kindle format document.

    ReplyDelete
  6. You have saved my life! I was tearing my hair out trying to work out how to get my pesky table of contents to work, until I came across your article. Many thanks for sharing this. Anna Franklin x

    ReplyDelete
  7. I followed your intstructions for creating a TOC, however when in Mobipocket Creator, once I've set up everything in Guide and hit "update" nothing happens, or I get a java script error message. Any clue what gives?

    ReplyDelete
  8. @sksperry: Are you sure you used the version of the HTML file that was generated by mobipocket? When applying guides you should use this copied version and not your original. If that isn't the problem there may be something wrong with the HTML file. Can it be viewed in a web browser? Was it saved as 'filtered' HTML? I'm afraid it's not possible to guess all the things that might go wrong but I'd suggest you start by verifying the HTML file and checking that you are using the correct copy of it.

    ReplyDelete
  9. Yes, I used the correct version. And it can be viewed fine in a web browser. And yes, I saved it as filtered HTML. :-) I think it's probably something wrong with the software or the installation itself.

    ReplyDelete
  10. Huw, I would like to follow your instructions, except i can't. For there is no 'new guide item' or browse button on my mobipocket. i was instructed just to put in 'h1' on both lines and it would work. odd thing, in the kindle previewer, it did. but in the final version, the actual kindle, no toc. i am very poor at computers so reading everybody else's instructions is.... hope u can help me here. thanks.

    ReplyDelete
  11. This java error is caused by Internet Explorer 9. If you remove it, the software will work just fine. I have a question, by the way. I keep getting an error with the TOC "link not resolved," although I am almost 100% certain that I have done it correctly. I have the file name created as a subdirectory by mobipocket with the #toc right after it. Anyone have any idea why I keep getting this error?

    ReplyDelete
  12. @Rob Johnston - see if your #toc isn't #TOC. That nailed me on a project.

    ReplyDelete
  13. I too was having a similar problem to chris: "For there is no 'new guide item' or browse button on my mobipocket." It appears that MPC was revised to 4.2 and only the home edition is available which doesn't include the guide. I found a copy of 4.1 publishers edition and your instructions worked like a charm. Many thanks.

    ReplyDelete
  14. Kindle Wireless Reading Device e-book reader that uses a wireless connection, users can buy, browse and read e-books, newspapers, magazines, blogs, download, and other digital media.

    ReplyDelete
  15. Aumshantidatta, can you please describe how you made it work in 4.1? I have also found a copy of that version after having the same troubles you've had with 4.2 etc... How did you make the toc work without the "guide" option like in 4.2? Help!

    Many thanks!

    ReplyDelete
  16. Thank You! You have the answer to the problem I have!

    ReplyDelete
  17. I don't have Windows Internet Explorer 9 or any other version of it and I still get this error.

    ReplyDelete
  18. Thank you you've helped me with a problem I've been having for months now since i started trying to take my novels to a more professional level

    ReplyDelete
  19. Brilliant job ! You did great work. I have word 2010 in my workbook. I am sure I would do it easily without getting any error. Nice post !
    forum widget

    ReplyDelete
  20. Well... as soon as it occurred to me that I needed to dump the Home Edition and download the Publisher's edition of Mobi, my entire world changed. Soon I was pumping fists and arms in celebration of a working TOC. Much appreciated Huw!

    ReplyDelete
  21. Thanks for clear instructions. Seemed to work like a charm, using Mobipocket 4.2, Publisher's Edition. The Kindle Previewer file goes to table of contents, and the links work (on my system). BUT when I upload the prc file to the Kindle account, the links in the toc do not work. They are dead links. Any idea why this would happen?

    ReplyDelete
  22. Are you sure you aren't judging it by the Amazon preview (the downloadable extract)? The links don't work in that, only in the full book.

    ReplyDelete
  23. The Amazon preview I'm judging is the one on the Kindle Direct publishing page for the book title. There's a Preview button at the very button after the check mark telling me the upload and "conversion" were successful. Do links not work in that preview? It's not the full book yet? The preview that DOES work is the one I downloaded to my system (v. 1.61). Thanks for your response. Hope there's a simple solution.

    ReplyDelete
  24. The solution, per Kindle support, is:
    "Links will not be functional in the online KDP Previewer; our technical team is working towards enabling this option in the online Previewer."

    ReplyDelete
  25. I have a recurring problem. Upon hitting "update" when I add the guide items, I get this error:

    "Unexpected javascript error uccurred in application."

    Mobipocket Creator Publisher v 4.2 build 41

    Microsoft Internet Explorer
    4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0; .NET4.0C)0

    Line: 149
    Character: 3
    Code: 0
    Message: Object doesn't support this action
    Url: file:///C:/Program%20Files/Mobipocket.com/Mobipocket%20Creator/rsrc/html/guide.html

    Any ideas?

    ReplyDelete
  26. I've found the solution to my problem, so if anyone else gets the problem, all you need to do is uninstall Internet Explorer 9 in "Installed Updates" section of Control Panel's list of software. There's some kind of conflict there, and uninstalling 9 simply reverts your system to IE 8 which then works fine. Thanks for this thread, it has helped me a lot. Krak.

    ReplyDelete
    Replies
    1. I can see no way to uninstall explorer 9 using Vista. It doesn't offer this option in Uninstall software or anywhere else as far as I can tell. Ideas?

      Delete
  27. Ready to cry. I've done all of this but now have Os all through my document, wherever I had an inverted comma before. No reason whatsoever.

    The table of contents works at last though, although the Kindle Emulator still says as there's no NCX that the links won't work to each chapter. Do you know if that's right? You know, in case I manage to get rid of all the bizarre Os...

    Thanks so much for writing your guide!
    Bern.

    ReplyDelete
  28. Ah! Having made epubs from my formatted .doc files on Lulu.com - free to do - I've now used Calibre to convert my epub to a .mobi...with no problems at all, AND it generates a NCX! I'd suggest this to anyone, especially Mac users, who are having random problems with conversion to Kindle.

    Thanks again for helping!

    ReplyDelete
  29. You are my hero bro. I was about to slit my wrists before I read your post. Important things to NOTE. Make sure when you install Mobi you install the Publisher version and not Home or you wont have the Add Guide option. SECOND, uninstall the IE9 update or you will get the Java error. Thanks again!!

    ReplyDelete
  30. Thank you so much - this is so very useful and so very clear. It was a real sticking point for me but following your instructions it worked straight away and I now have a working TOC. Thank you again, you're a star.

    ReplyDelete
  31. Dark Neon, you are the freakin man! I too was about ready to throw myself out the window in frustration with making a TOC until I found this post.

    This method works like a charm!

    Muchas Gracias!

    Bret

    ReplyDelete
  32. Your post has saved me! Thank you so much for your excellent instructions and detailed explanations. My book is almost perfect, but although my cover is a jpg, 600 x 800, only part of it shows in the kindle previewer. Do you have any idea why this would happen?
    I'd appreciate any help that anyone can give me.

    ReplyDelete
  33. This comment has been removed by the author.

    ReplyDelete
  34. Bless you!!!! I've been going crazy with this. A tip for others, though. I followed your very clear instructions precisely and kept getting an "unexpected java script" message when I tried to add the guides. I quit in frustration. Then I remembered that I am using Google Chrome as my browser and have encountered other things that didn't quite work right. I exited and followed the instructions while using Explorer, and it worked great. THANK YOU!!!!!!!!!

    ReplyDelete
  35. Question:
    My "go to" for table of contents now works, and the table of contents looks fine. However, now I have a new problem. The pages and chapter titles look fine when I page through the book. However, when I click on a table of contents link and go to the page in that way (from the link), the chapter titles are not formatted correctly. They are not in the "heading" style. Is this normal? Is there a way around it?

    ReplyDelete
    Replies
    1. Hi Cheryl,
      I have the same problem, did you resolve? How?
      Thanks!!!

      Michele

      Delete
    2. This often happens in the Kindle Previewer. Are you sure it is a problem in real Kindle too? In my experience, this seems to be a bug in the Previewer software.

      Delete
  36. Thank you! This is awesome detail. My problem was answered by one of your repliers - the IE9 issue truly is a problem. I had no issues before it installed, and after I went back to IE8 - no more javascript errors.

    Thanks again!
    Les Denton

    ReplyDelete
  37. Thanks for your excellent post which gives the advice simply and clearly--I've finally managed to get the TOC to load properly.

    I had to uninstall my Mobipocket "Home Edition" and install the "Publisher's Edition"--then the guides appeared properly.

    Best wishes with both life and writing!

    Jess | jessINK.com

    ReplyDelete
  38. Excellent post! But... did you leave out a step or something? I followed your instructions step for step but the table of contents will not generate the way I need it to. I get "start" and "middle" when I want "about the author" etc. And the start and middle aren't even where I designate. So far really hating Mobipocket! LOL

    ReplyDelete
  39. I followed all your instructions. However, I got an error message when I try to set up guide, can you help?

    Error message:
    Mobipocket Creator Publisher v 4.2 build 41

    Microsoft Internet Explorer
    4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; BOIE9;ENUS)0

    Line: 149
    Character: 3
    Code: 0
    Message: Object doesn't support this action
    Url: file:///C:/Program%20Files%20(x86)/Mobipocket.com/Mobipocket%20Creator/rsrc/html/guide.html

    ReplyDelete
    Replies
    1. Looks like you are having the issue with Internet Explorer 9 being incompatible with mobipocket. Uninstall Internet Explorer 9 and so long as you can then run mobipocket the error should no longer occur.

      Delete
  40. Hi,
    I am running Windows 7 64bit and get the javascript errors with ie9. I can uninstall ie9 no problems but once I have uninstalled it I can no longer run mobipocket. I double-click the exe and nothing happens. If I reinstall ie9 I can then use the mobipocket application but obviously the javascript error returns.
    Can anyone help?
    Thanks

    ReplyDelete
  41. Hello. I followed these instructions and they worked great. The prc file did have a working ToC. However, my file contains a number of special characters that did not display in the prc file. They do display correctly when I open the opf file that mobipocket created using kindle previewer (which then converts it to mobi), but that file doesn't recognize the ToC.
    Any thoughts? Can I make the ToC recognizable in the opf or mobi file? I've been trying to get characters to appear in the prc but no luck so far.

    ReplyDelete
  42. Thanks. This was helpful. Why doesn't amazon put these little details on their Help page?

    ReplyDelete
  43. Hello Huw, This post is really helpful. I followed your step-by-step instructions and it wonderfully works. Thanks a lot.
    Bernard

    ReplyDelete
  44. Thanks for the help. I used you instruction for publishing my ebook. Also I've linked to the page from my blog http://www.vminstall.com/how-to-publish-kindle-ebook/

    Great Post!
    Joe

    ReplyDelete
  45. I'm glad you found it useful. many thanks for the link back to the article. :-)

    ReplyDelete
  46. Your post seems to have the answer for my problem, however as I have built my book in Notepad inserting the html myself, and am attempting to do the same for the opf file, many of the steps you outline are not applicable. Any chance you could post the full html of the opf file that resulted from the steps you took?
    Many thanks!
    Sean

    ReplyDelete
  47. Hi Huw
    Many thanks for your steps. Do you perhaps know why MobiPocket displays a JS error when I click the Update button?
    Cheers
    Colin

    ReplyDelete
  48. Wow, this was so easy. Thank you for the help. I've been trying to wrap my head around TOC files. Since I'm not adverse to some programming, I learned the loops but was terribly frustrated when MPCreator always put the TOC at the beginning of the file. This version is so much easier and very elegant. Plus, it works. Thanks.

    ReplyDelete
  49. I simply want to say I am new to blogging and site-building and seriously liked you’re blog site. Probably I’m likely to bookmark your blog . You absolutely come with terrific well written articles. Bless you for revealing your web page.
    website design

    ReplyDelete
  50. Ray Edwards

    This is more than helpful, however, I have one problem in completing step 2.

    I cannot click on View/Guide etc. because it is not there in the Mobipocket creator?

    All I have is;

    List, Thumbnails, Publication files, Cover image, Table of contents and properties.

    Can you comment

    ReplyDelete
  51. Hello
    When I build the TOC and insert 'TOC' as a bookmarket at the beginning of the title "Table of Contents", and then I compile the document in the Kindle Previewer, the Table of Contents comes up left justified, with no indents. I have 3 levels of Headings (1, 2 and 3) that show indents in the Word document. But no mater what 'style' I pick in the TOC menu, it all comes up left hand justified. How can I get indents into the TOC that comes up when after compiling in Kindle Previewer?

    Thanks so much

    ReplyDelete