03-13-2011, 11:07 AM | #16 | |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
03-13-2011, 01:57 PM | #17 |
Overenthusiastic Noob
Posts: 69
Karma: 896
Join Date: Feb 2011
Location: France
Device: Kindle 3
|
I seem to have understood that there are 2 types of TOCs - I'm not sure which one(s) you guys are talking about since I can't remember which is called what yet.
I suppose that what I was trying to do is "convert" the in-document TOC (made with anchors & links) into a NCX/OPF one - i.e. one that can be accessed through the "GoTo" Kindle menu item. I've tried every settings combinations in Calibre and I either get 2 TOCs (my original in-document TOC + the detected, "GoTo" TOC - apparently detected automatically from existing links) or just the in-document one (unaccessible through "GoTo"). Various forum searches indicate that I could tweak the OPF file manually but yeah, I'll just stick to the TOC detection in Calibre since it's already pretty powerful. Although I suppose that could be a nice function to have in a future version of Calibre: the possibility to have the TOC items generated from either the text between the selected tags or an "alternate" text defined in "title=" (like Sigil does). |
03-13-2011, 03:16 PM | #18 | |
Fanatic
Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
|
Quote:
The NCX type does not work with the Kindle or with mobi in general AFAIK. If you're trying to create some sort of "menu based" TOC system that doesn't leave an actual TOC page in the ebook, you can give up on that now. AFAIK it can't be done with mobi. Mobi is a very old and simple standard, relatively speaking. - Byron - Byron |
|
03-13-2011, 03:48 PM | #19 |
Enquiring Mind
Posts: 562
Karma: 42350
Join Date: Aug 2010
Location: London, UK
Device: Kindle 3 (WiFi)
|
Table of Contents in MOBI/Kindle ebooks
There are two ways of coding "Table of Contents" data.
One way is to code it in HTML as part of the front matter in an ebook - exactly as it would be in a printed book - with each entry in this TOC coded as a link to an HTML anchor embedded at the appropriate point in the book content. This is often referred to as an "inline TOC", and is the primary method of providing a TOC in MOBI/Kindle ebooks. The other way is to code it in XML in an NCX file (Navigation Control XML) which is then compiled into the resulting ebook. This is sometimes referred to as a "logical TOC" or "NCX TOC", and is the primary method of providing a TOC in EPUB ebooks. Unfortunately, those who mostly work with MOBI files (or who are not yet used to working with ebooks, and are thinking in terms of MS Word, Open Office, and other print-related formats) tend to refer to the inline TOC as "the TOC", while those who mostly work with EPUB files tend to refer to the NCX TOC as "the TOC", leading to much confusion. In an EPUB reader (device or application), when the user chooses to view the table of contents, the EPUB reader accesses the information in the NCX file, and generates a table of contents from that information, and presents it to the user. In a MOBI/Kindle reader (device or application), when the user chooses to view the table of contents, the MOBI/Kindle reader looks for a "guide" data item pointing to the location of the inline TOC in the ebook HTML content, and jumps to that location, displaying the table of contents to the user. That "guide" item is originally coded into an OPF file - an XML file containing metadata about the ebook - which is then compiled into the MOBI file. The data in the NCX file, on the other hand, is used by the Kindle device and applications to enable "skip to previous/next navigation point" functionality (e.g. the ability to use the 5-way control button on the Kindle to jump to the previous or next heading or chapter). The navigation points coded into the NCX file are also displayed as small dots or tick marks on the progress bar displayed at the bottom of the reading screen. The reason you find that the TOC created by Calibre when converting your HTML files to MOBI format can be "seen" by the Kindle, is because Calibre adds the required "guide" item to the MOBI file, pointing to the TOC it created (which is an inline TOC, just one that is placed at the end of the book content). And the likely reason the Kindle isn't seeing your hand-coded inline TOC is because there is no "guide" item pointing to it (possibly no OPF file at all?). You can certainly hand code an OPF and NCX file to accompany the HTML file(s) for your ebook, and you might decide to do that a couple of times to become familiar with the various files that go into an EPUB or MOBI ebook, but in the longer term, I'd definitely second the recommendations others have made regarding using Sigil and Calibre. Although your final goal is a MOBI version of your book(s), it's worth using EPUB as an intermediate stage, since it is easier to ensure that all the component files are present and correct, and to edit the content of these files if required. I'd suggest switching off the "HTML Tidy" feature in Sigil to minimise the changes it makes to the HTML code (given your desire to maintain as much control as possible over the actual code ). Add your HTML file(s), then use the TOC editor to create the logical/NCX TOC, and the Metadata editor to add the required metadata (title, author and language are the minimum requirements). Sigil will take care of creating the NCX and OPF files - you won't see them in the file list on the left of the screen, but they're there in the "package" that Sigil is creating which it will zip up into the final EPUB file. (Note: As you add your HTML file(s), Sigil will parse them, and automatically find and add any external CSS files they link to, and any image files they refer to. Unless you have included your cover image as the first page of the book content, you should then add the cover image file in the "Images" sub-directory in the left panel, and use the "Add Semantics" feature (as described below) to designate that image file as the cover image. Sigil makes its own copies of all of these files - your original files will remain where they are, and unchanged.) There are two routes to getting the required table of contents "guide" item into the OPF file:
Last edited by DMSmillie; 03-14-2011 at 06:23 AM. Reason: minor edits for clarity |
03-20-2011, 01:57 PM | #20 |
Overenthusiastic Noob
Posts: 69
Karma: 896
Join Date: Feb 2011
Location: France
Device: Kindle 3
|
Sorry for bumping this but I really wanted to thank you for your detailed explaination. You must have spent ages writing this!
I don't expect I'll ever need any extra info on TOCs ever again. This looks like pretty much all there is to know about them. I will definitely be saving this post on my computer to really study it carefully. Thanks again This post should be like, extracted and stickied or something. |
03-20-2011, 03:20 PM | #21 |
Enquiring Mind
Posts: 562
Karma: 42350
Join Date: Aug 2010
Location: London, UK
Device: Kindle 3 (WiFi)
|
You're very welcome, Algiedi.
Heh... it did take me a while to write, yes. But it was a useful exercise - I kept finding myself writing bits of it over and over again in response to various questions in other threads, and now I've got it all together in one post that I can either copy and paste, or point to, in response to similar questions in future. Sheer laziness really. |
07-10-2011, 09:08 AM | #22 | |
Enthusiast
Posts: 28
Karma: 10
Join Date: Jun 2011
Device: Kindle
|
Quote:
Code:
<h2>1</h2> <span class="chaptitle" title="Chapter 1" /> Code:
//h:span[re:test(@class, "chaptitle", "i")] |
|
07-11-2011, 10:48 AM | #23 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Sorry, ignore this post
Last edited by jackie_w; 07-11-2011 at 10:53 AM. |
07-23-2011, 10:54 PM | #24 | |
Enthusiast
Posts: 28
Karma: 10
Join Date: Jun 2011
Device: Kindle
|
Quote:
<h2><span style="display: none">Chapter </span>1</h2> Of course, that won't work in all cases, but it will for your example. |
|
07-24-2011, 01:06 AM | #25 | |
Member
Posts: 10
Karma: 10
Join Date: Jul 2011
Device: Nook Simple Touch
|
Doesn's seem working
Quote:
Last edited by Dellu; 07-24-2011 at 01:15 AM. |
|
07-24-2011, 01:12 AM | #26 |
Member
Posts: 10
Karma: 10
Join Date: Jul 2011
Device: Nook Simple Touch
|
Thanks for the wonderful explanation. I really want the last option. I have a dozen of books to convert to epub. Marking the headings of each of the contents in Sigil is more time consuming. Since my html has inline bookmarks (contents), the last approach seems to promising. I edited the OPF file as you instructed. But, I couldn't get any Content(Table of contents) in my e-reader.
Last edited by Dellu; 07-24-2011 at 01:17 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre settings for using 'chapter' in TOC | TargonD | Calibre | 13 | 11-03-2010 08:57 PM |
Les Miserables - TOC / Chapter Flags? | gshipley | Amazon Kindle | 1 | 09-28-2009 10:07 PM |
ADE and long chapter names in ToC | frabjous | Reading and Management | 3 | 08-14-2009 11:16 AM |
Chapter or TOC Creation help needed | gandor62 | Calibre | 4 | 04-15-2009 02:18 PM |
html2epub TOC and chapter detection help | ilovejedd | Calibre | 6 | 02-22-2009 05:58 PM |