Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 10-16-2020, 05:38 AM   #1
JJ Johnson
Connoisseur
JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.
 
Posts: 70
Karma: 2119794
Join Date: Feb 2020
Location: Colorado
Device: Kobo Libra H20
Where do displayed chapter titles come from?

I have some text file renderings of books that I'm running through a python script to break up into chapters and generate epubs. I'm just getting started, but so far, I break it up and format the content into chapter html files, generate container.xml and content.opf, then zip it up along with a standard css file. Still to do is to generate a table of contents and add a cover image.

When I load the epub (using calibre, which is converting to kepub) onto my Kobo Libra, it looks great, except that the chapter titles shown are the actual html filenames. In each hmtl file I have a <title> tag in the header (with "Chapter One", "Chapter Two", etc.), which is where I assumed it would get this data, but apparently not.

My content.opf is pretty simple, along with headers and metadata, it looks like:
Code:
  <manifest>
    <item href="chapter00.html" id="chapter00" media-type="application/xhtml+xml"/>
    <item href="chapter01.html" id="chapter01" media-type="application/xhtml+xml"/>
  </manifest>
  <spine>
    <itemref idref="chapter00"/>
    <itemref idref="chapter01"/>
  </spine
Does it require a toc? Or is there something additional I can add to the manifest items?

Last edited by JJ Johnson; 10-16-2020 at 05:51 AM.
JJ Johnson is offline   Reply With Quote
Old 10-16-2020, 08:34 AM   #2
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,496
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Technically your book has no chapters so calibre is creating its own from the file names.

For EPUB 2 you need to create an NCX file. For EPUB 3 you need a navigation document, with NCX being an optional fallback.
jhowell is offline   Reply With Quote
Old 10-16-2020, 01:20 PM   #3
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
If you want to eyeball a well formed epub 2 or epub 3 you could use Calibre's editor or Sigil; I use the latter. Add an h2 at the start of each file. Then, in Sigil, use Ctl-T to generate a table of contents from the h2 tags. I prefer to make epub 3s so after I generate the table of contents, in Sigil's Tools menu I run the first two items in the Tools > Epub 3 tools menu; Generate ... and Update ... so that I get the optional fallback that jhowell mentioned. With Sigil you can have it start a new epub as either epub 3 or epub 2
hobnail is offline   Reply With Quote
Old 10-16-2020, 01:35 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by jhowell View Post
Technically your book has no chapters so calibre is creating its own from the file names.

For EPUB 2 you need to create an NCX file. For EPUB 3 you need a navigation document, with NCX being an optional fallback.
The ePub 3 needs an NCX to be backwards compatible with ePub 2. So IMHO, if the ePub 3 is not using any specific ePub 3 features that would break with ePub 2, then an NCX is necessary.
JSWolf is offline   Reply With Quote
Old 10-16-2020, 05:38 PM   #5
JJ Johnson
Connoisseur
JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.
 
Posts: 70
Karma: 2119794
Join Date: Feb 2020
Location: Colorado
Device: Kobo Libra H20
Quote:
Originally Posted by hobnail View Post
If you want to eyeball a well formed epub 2 or epub 3 you could use Calibre's editor or Sigil; I use the latter. Add an h2 at the start of each file. Then, in Sigil, use Ctl-T to generate a table of contents from the h2 tags. I prefer to make epub 3s so after I generate the table of contents, in Sigil's Tools menu I run the first two items in the Tools > Epub 3 tools menu; Generate ... and Update ... so that I get the optional fallback that jhowell mentioned. With Sigil you can have it start a new epub as either epub 3 or epub 2
Looks like I have a bit more work to do than I thought. I take it, then, that chapter titles are typically displayed in H2 tags? Is that mostly just an Sigil/Calibre application convention, or part of some standard?

I'm using epub 3. I only have a need to ever view these books on my Kobo, so I'm not too worried about backward compatibility or publishing these books. So this is mostly an exercise in learning a bit about epub structure, and also a means of honing my python skills.

I'm still very fuzzy on the interplay between this navigation file, a TOC page, and the manifest and spine portions of the content.opf files. I'm sure I'll have more questions.
JJ Johnson is offline   Reply With Quote
Old 10-16-2020, 07:49 PM   #6
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by JJ Johnson View Post
I take it, then, that chapter titles are typically displayed in H2 tags? Is that mostly just an Sigil/Calibre application convention, or part of some standard?
H2 is what I use. Sometimes books have Parts and I use h1 for those titles. You could just as easily use h5 for the chapter titles. The only convention that I know of is that Sigil nests the higher numbered h tags in the lower numbered ones; e.g., h2 is nested in h1. In the table of contents the nested ones are indented. When you generate the table of contents with Ctl-T you can specify which ones to include/use so I specify h2 and h1.
hobnail is offline   Reply With Quote
Old 10-16-2020, 07:56 PM   #7
JJ Johnson
Connoisseur
JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.JJ Johnson ought to be getting tired of karma fortunes by now.
 
Posts: 70
Karma: 2119794
Join Date: Feb 2020
Location: Colorado
Device: Kobo Libra H20
Quote:
Originally Posted by hobnail View Post
H2 is what I use. Sometimes books have Parts and I use h1 for those titles. You could just as easily use h5 for the chapter titles. The only convention that I know of is that Sigil nests the higher numbered h tags in the lower numbered ones; e.g., h2 is nested in h1. In the table of contents the nested ones are indented. When you generate the table of contents with Ctl-T you can specify which ones to include/use so I specify h2 and h1.
Is the 'table of contents' that you speak of Sigil generating the navigation document required of epub 3s, or is it a table of contents (x)html file? Or does it generate both?
JJ Johnson is offline   Reply With Quote
Old 10-16-2020, 08:09 PM   #8
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by JJ Johnson View Post
Is the 'table of contents' that you speak of Sigil generating the navigation document required of epub 3s, or is it a table of contents (x)html file? Or does it generate both?
As per the epub3 specs the nav.xhtml file can be (and should be if I remember correctly) used for the navigation document as well as the displayed html table of contents. But sigil puts the nav.xhtml at the end of the epub. If you drag the nav.xhtml to just after the title page or wherever in Sigil's Book Browser it still shows up at the end on my Kobo Forma (I also make epub3s). If you drag in Calibre's equivalent then the displayed table of contents shows up where you dragged it to. Eyeballing the content.opf I saw that calibre deleted the linear="no" from the following line as soon as you drag the nav.xhtml anywhere:


<itemref idref="nav.xhtml" linear="no"/>

Last edited by hobnail; 10-16-2020 at 08:18 PM.
hobnail is offline   Reply With Quote
Old 10-16-2020, 11:53 PM   #9
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,380
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by JJ Johnson View Post
Looks like I have a bit more work to do than I thought. I take it, then, that chapter titles are typically displayed in H2 tags? Is that mostly just an Sigil/Calibre application convention, or part of some standard?

I'm using epub 3. I only have a need to ever view these books on my Kobo, so I'm not too worried about backward compatibility or publishing these books. So this is mostly an exercise in learning a bit about epub structure, and also a means of honing my python skills.

I'm still very fuzzy on the interplay between this navigation file, a TOC page, and the manifest and spine portions of the content.opf files. I'm sure I'll have more questions.
There are 6 header tags (h1 ... h6). My personal preference is to use h1 for books in a omnibus volume, h2 for parts in a single book and h3 for chapter headings. h4 get occasional use for sub-chapters. If I find myself wanting to use h5 and h6, it's time to step back and look at the way I'm structuring a book. Most renderers will display the ToC with indentation to indicate precedence.

Code:
h1
   h2
      h3
      h3
      h3
         h4
   h2
etc...
If for example, if I have <h3>Chapter x<h3> at the start of each chapter file, Sigil and calibre will generate the ToC document from those tags. I prefer using Sigil where it will generate the epub3 nav.xhtml document with the option to automatically generate the epub2 compatible toc.ncx file. OTOH, there are things that the calibre editor will do easier than Sigil so I keep and use both.

Last edited by DNSB; 10-16-2020 at 11:55 PM.
DNSB is offline   Reply With Quote
Old 10-17-2020, 03:14 PM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Most publishers use <p class="someclass">Chapter One</p> for the chapter title. But if you are wanting to make it easy to built a ToC from the chapter titles, use <h2>Chapter One</h2> and define what you want h2 to be in CSS.
JSWolf is offline   Reply With Quote
Old 10-17-2020, 05:50 PM   #11
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Most Some publishers use <p class="someclass">Chapter One</p> for the chapter title....




....and I would add that although it is certainly possible to do it that way, I would recommend using the <h1-6> tags for their semantically correct purpose of providing a heading hierarchy. You can apply the exact same CSS to the <h> tags and visually it will be identical, but automated systems, accessibility systems, etc. can figure out the structure of your document much better/faster(/stronger??) if you use the proper markup.

It also has the added benefit of programs like Calibre or Sigil creating the automated ToC based on your <h> tags - as has been mentioned above.

Last edited by Turtle91; 10-17-2020 at 05:52 PM.
Turtle91 is offline   Reply With Quote
Old 10-17-2020, 07:15 PM   #12
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by Turtle91 View Post
Most Some publishers use <p class="someclass">Chapter One</p> for the chapter title....
A pox on those pusillanimous publishers.
hobnail is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter Heading formate displayed wrong in Kobo Kaylee Skylyn ePub 9 07-26-2015 12:13 AM
Titles displayed incorrectly in reader anthony.burton4 Library Management 5 02-28-2013 06:12 PM
Chapter #s or Chapter Titles? bmcox Writers' Corner 33 02-01-2013 07:03 AM
Ebook chapter titles: with or without chapter number? amoroso Writers' Corner 16 06-14-2011 06:35 AM
PRS-350 Breaks after Chapter Titles Rand Brittain Sony Reader 2 10-25-2010 12:53 PM


All times are GMT -4. The time now is 05:31 AM.


MobileRead.com is a privately owned, operated and funded community.