I learned to format epubs working from samples that I opened up in the Oxygen XML editor ... as well as from the Elizabeth Castro and Paul Salvette books.

Both Castro and Salvette say that the toc.ncx should start with the cover, title page, copyright page, etc. and then go on to the actual chapters. It is noted that if you are going to convert to mobi/Kindle formats that you need to remove the coverpage from the toc.ncx and renumber the play-list and all the toc-anchors.

The samples I have, from another developer, start with the table of contents and go on to the chapters. I have been formatting that way, but all of a sudden I am wondering if this is correct.

I do know that, as a reader, I do not want to have to page through the cover, etc. once I have started reading the book. I want to go back to the contents page. So there is something to be said for formatting the toc.ncx that way. (The frontmatter shows up fine if I make sure that it is listed properly in the content.opf.) It is also nice not to have to re-do the toc.ncx and toc-anchors when converting to mobi.

But on the gripping hand, sometimes the contents html page shows up in Calibre's and ADE's left-hand-side content displays, and sometimes I get a no-such-page error message. I see a heading, Table of Contents, then a contents page to which the link is broken. I have not been able to figure out what triggers the broken link problem. Fixed that; I cannot include a toc-anchor on the contents.html h1 heading. Removed it and everything is fine.



A few things here: for starters, I agree that not all the stuff that is front matter in print should be in the front for an ebook. We generally move the copyright page to the back, for example, as well as praise for the book and anything else that seems ancillary.

Bear in mind that ultimately it's the <spine> of the content.opf file that does the organizing of what goes where, not the table of contents. The <spine> is what reading systems will look to to see what comes next. The playOrder attribute in the ncx is not needed, and in fact in epub 3.0 they've done away with the ncx file entirely and replaced it with a toc.xhtml.

Finally, you can include the [guide][1] in your ncx file to indicate things like the cover, the start of the main content, and so on. Most reading systems will ignore most of that, but a number of them will default to opening on whatever you specify to be the start of the content—Kindle and iBooks will both do this, for example. Here's an example <guide> from the IDPF:

        <reference type="toc" title="Table of Contents"
                 href="toc.html" />
        <reference type="loi" title="List Of Illustrations"
                 href="toc.html#figures" />
        <reference type="other.intro" title="Introduction"
                 href="intro.html" />

Check the guidelines for the particular retailers you'll be using for more details about the <guide>; as I recall, Amazon only wants you to mark the start of the content and the cover.

EDIT: The above link doesn't seem to be showing up; here's the URL: http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6

Further Edit: You can get the <guide> functionality in epub 3.0 with <nav epub:type="landmarks">: http://www.idpf.org/accessibility/guidelines/content/nav/landmarks.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.