bell notificationshomepageloginedit profileclubsdmBox

10.01% popularity   0 Reactions

All of the chapters in my EPUB contain only the text of the chapter and do not have the chapter number or the chapter title at the beginning of the body.

The Table of Contents file, (nav.xhtml) has the correct chapter numbers and titles along with hyperlinks to each of the different chapter files, (xhtml files).

How can I automate a process in which the chapter number and title for each chapter file is copied from the table of contents and pasted into the beginning of each corresponding chapter file? I have and use Calibre, but I cannot figure out a process.

Thanks.


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (1)

Login to follow story

More posts by @James

1 Comments

Sorted by latest first Latest Oldest Best

 

@Karen

10% popularity   0 Reactions

You're looking at the problem backwards.

My admittedly complex solution is to code in Docbook XML, and then the XML to XHTML transformation autogenerates the TOC with correct title. (Docbook XSLT autogenerates the epub nav document and all related material).

With most tools the nav.xhtml file is autogenerated by whatever is H1 in the particular chapter.

To give another example: You can create an epub very easily in LibreOffice or MS Word by putting everything in a single document and then styling the chapter headings with the HEADING style (or something like that). You can run calibre on that -- and as long as the chapter heads have a heading style, it will autogenerate the navigation document from the headings.

My Docbook-based production method includes an autonumber feature -- but I generally turn it off because I'd rather hard code the chapter numbers. Perhaps MSOFFICe/LIBOFFICE let you do autonumbering in the heading element.

The navigation document is usually both human readable and machine readable. Unlike epub2/older Kindle ebooks (where you needed to create a logical TOC (html document) and a ncx file, today's navigation documents serve both purposes.

I have not used transformations on Calibre, but I'm guessing it is theoretically possible to autogenerate these things from within it with xpath/xslt.


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (0)

 

Back to top