View Single Post
Old 01-27-2011, 01:01 PM   #11
chyron8472
Groupie
chyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead communitychyron8472 has become a pillar of the MobileRead community
 
chyron8472's Avatar
 
Posts: 175
Karma: 15942
Join Date: Jan 2011
Device: Kindle 2
I have bought more than one ebook for my Kindle from Amazon that didn't come with chapter markers, as well it didn't have an NCX file (and sometimes didn't even have a Table of Contents). God knows why someone would publish said books without these things. =\

But anyways, I've learned how to get Calibre to create decent chapter markers for said books. Different books have different problems, but I've found that, for the most part, the following works:

(In the convert settings for the book)

change the "Detect Chapters at" field at the top of the Structure Detection section to:
//*[((name()='h1' or name()='h2' or name()='h3') and re:test(., 'chapter|book|section|part|prologue|epilogue\s+', 'i')) or @class = 'chapter']
(most of it is default, but I add the bolded part)

Check the box for "Force use of auto-generated Table of Contents" in the Table of Contents section

For books that have a TOC but no chapter markers, a good thing to do is to:
Check the box for "Do not add Table of Contents to book" under MOBI output (or w/e output you use) if the book already has a working TOC, so that it will add chapter markers in places where the generated TOC would link them, but linking to the TOC from the menu takes you to the original TOC at the front of the book instead having created a new one in the back.



With Star Trek: New Frontier, which contains the first 4 books of the series in one volume (and which came with no chapter marks, no table of contents, and an NCX file which was in a tree format which didn't seem to work at all,) I basically did this while leaving the "Do not add Table of Contents to book" unchecked in the MOBI Output section, since there was no TOC in the first place. The formatting of the chapters is really weird for this book, but what Calibre did for it was certainly tolerable.


Now, in the case of my copy of the 50th anniversary The Lord of the Rings (one volume containing all 3 books,) the only chapter markers that existed pointed to the start of each book (ie. there were only 3 chapter markers, period.) When I used the above method, Calibre added chapter markers for each entry in the existing TOC itself, made a pagebreak between each, and detected the actual chapter headings and their subheadings as seperate chapter breaks. So I had to change the dropbox labeled "Chapter Mark" in Structure Detection to none, and put the word Chapter in the "TOC Filter" box in Table of Contents (because it also detected the chapter headings and subheadings as different chapters.) I did check the "Do not add Table of Contents to book" in the MOBI Output section, since a TOC came with the book and did work. This all sounds sloppy, but it works rather well.

Last edited by chyron8472; 01-27-2011 at 01:13 PM.
chyron8472 is offline   Reply With Quote