4

I am trying to create an epub file (in epub 3), and will be using KindleGen to convert it into kindle's mobi format. At the moment I was working on the table of contents files, and there were a few things that I needed to ask, that I would be glad if someone were to answer.

Firstly, I wanted to include superscripts and have different font styles and sizes for each subheading in the table of contents, is this possible in the logical TOC without all the botchings in different eReading devices, or should I create an html TOC for this purpose ?

Secondly, after having created these two TOCs (if two are needed), should these both be included in the tag ? How will the reader know which one is logical and which one is html (and hence shown to the reader at the beginning after the cover page) ?

Thirdly, I am using 'list-style-type: none' in the epub css to remove numbers from the ordered list for epub's table of contents in the logical TOC. Is that acceptable for epub and kindle ? I looked up at some sample epub code, and they seem to have included it without any ill-effects. Tried to look up if Amazon allowed this property for kindle but didn't find any reference to it. So, is it an okay property to use ?

3

The epub 3 toc.xhtml was created specifically to do away with the need to have separate logical and visual ToCs. Unfortunately, it's not quite there. As long as you're only interested in adding some styles to the text, though, you should be fine. Where you start to run into problems is if you want to have lots of other stuff going on in your ToC, like a number of images. Here's a quote from the relevant section of the epub 3 spec:

The optional heading must be followed by a single ol ordered list; no other elements are permitted as direct children of the nav element. This ordered list represents the primary level of content navigation.

Each list item ( li ) of the ordered list represents a primary heading, structure or other point of interest within the EPUB Publication and must contain either a child a element or a child span element. The a element describes the target within the Content Document that the link points to. The span element serves as a heading for breaking down lists into distinct groups (for example, a large list of illustrations can be segmented into several lists, one for each chapter).

So as long as all you're doing is enclosing parts of the list items in <span>s you'll be fine and won't need to create a separate visual ToC. If for some reason you do need to create a separate visual ToC, I would advise only including the visual one in the <spine>. The reading system will use as the logical ToC whichever file has properties="nav" declared in the <manifest>.

As far as using list=style-type: none; goes: technically, you shouldn't need it, but it doesn't hurt at all to include it, and some reading systems will include numbers if you don't use it. So yes, by all means include that statement. It will cause no problems with KindleGen.

Finally, the frustrating note: be sure that you also include an epub 2.0-style toc.ncx file. It's perfectly valid to do so in epub 3.0, and it's the only way that epub 2.0 reading systems will be able to make use of your table of contents. Yes, this means that if you have a visual ToC separate from the logical toc.xhtml, you're now up to three tables of contents in your file.

  • Thanks so much for a very detailed answer Tom! Clears up a lot of things, including the .ncx part. So, I could just simply include css for the <li> tags in the list (the css for the <li> would work in kindle, right?). And a span element surrounding the <sup> tags (around text in the subheading) for it to work since no other tags except the ordered list tags are allowed. Also, I am fine with reading systems using numbers for the logical TOCs, but would they also include it for the TOC that appears to the user just after the cover page ? Thats the page I want to remove numbers from. – QPTR Apr 16 '14 at 4:07
  • 1
    Applying CSS to the <li> elements in the <nav> should work just fine, yes, and will remove the numbers from the ToC after the cover page. The only devices you might run into problems with are the older eInk Kindles (the keyboard ones and the DX), which are very limited in styling. I've never tried <sup> in a ToC, so can't guarantee anything there. – Tom Apr 16 '14 at 18:41
  • thanks Tom! I hope the problems that you say that may be encountered with the older eInk Kindles aren't the crashing sort. – QPTR Apr 18 '14 at 6:39
  • No, not the crashing sort at all; more just the looking bad and potentially showing numbers in the ToC regardless of what you do sort. – Tom Apr 18 '14 at 7:35

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.