Creating a Table of Contents for EPUB that does not have any. I have a bunch of books that do not have a table of contents, just one very big chapter.
There are 2 types of chapters. Literary and epub chapters. The book will organize its topics by chapters or in fiction books, just a bunch of chapters for progress tracking. E-pub chapters are internal organization of electronic file format. Ideally, each epub chapter should be small as the readers have tiny memory. link
You can generate a table of contents using Calibre. (Tools → Table of Contents). The program will pull together the major headings (HTML tags H1, H2) or other markers. Click OK to save. This will create an embedded table of contents for the e-reader to use.
If the chapter headings are formatted to a stylesheet’s selector, you can use Calibre’s XPath command to search for it and mark it as a table of contents heading.
To create a table of contents within the text of the epub, (Tools → Table of Contents → Insert inline Table of Contents.) This is mainly for a physical book, you flip to the table of contents. In an e-book, you don’t flip to the front for the table of contents. Instead, you call up the table of contents using the reader’s function.
Things get interesting if the table of contents cannot be generated from the major headings. There are 2 ways to go about it.
Manually mark the start position of each chapter. Or add heading information using HTML tags H1 etc on the text at the desired point.
Marking the position of the literary chapters does not guarantee it will start at the top of the page. This is a visual aspect to have the chapter start at start of each page. To do that, split the file just before the chapter wording. This will create an epub chapter with the literary chapter on the first line.
Edit 8 Apr 24:
Updated to include the difference between literary and epub chapters. To avoid confusion, removed the reference to the word “file”.
Pingback: Fixing ebooks with Calibre – Alfred's New Ramblings