TOC numbers correct, Chapter numbers always 1

Bug #1273559 reported by Johnathan Stein on 2014-01-28
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

In a simple conversion of DOCX to MOBI, the TOC displays chapter numbers increment, but when clicked, every chapter title is numbered "1."

Simple document, only four (4) styles used, Normal, Title, H1 and H2. There are seven (7) H1 and thirty (30) H2 elements.

Left most everything at default for conversion. In Word 2010, generated TOC is fine, as are the chapter numbers.


Calibre 1.21
Word 2010

  • Input file Edit (482.6 KiB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
LukeKendall (luke-zeta) wrote :

This is currently happening for me; I'm using Calibre v2.45. I'm working from a LibreOffice 5.0.3 .odt file. The chapters are numbered correctly in the TOC generated by Calibre (although it puts 2 chapters per page, then a page break, in the TOC: I think because all the Chapter headings are html H1 elements. I need to re-check, but certainly on my 1st try, the toc.ncx file has stuff like this:

<navPoint id="ujwaAQQK4di35KOrpmPFchB" playOrder="1">
        <text>Prolog 1</text>
      <content src="index_split_004.xhtml"/>
    <navPoint id="utE7axnMMjYH5AzmPYfyOp2" playOrder="2">
        <text>Part I 14</text>
      <content src="index_split_005.xhtml"/>
    <navPoint id="uyHLH5SBCmIBt42iiswSe24" playOrder="3">
        <text>Chapter 1 15</text>
      <content src="index_split_006.xhtml"/>

and the corresponding index_split_004.xhtml file, for example, has this:
<h1 class="p-p18" id="calibre_toc_2">
   <a href="index_split_075.xhtml#anchor8" class="s-t">
       <span class="s-t4">Prolog 1</span>
  <a id="anchor9" class="s-t"></a>
  <a class="s-t"></a>

I'm also curious as to why there are three anchors there (1st with content and an actual href link, the next two with neither): I thought maybe for the chapter name, the leaders/spacing-dots, and page no., but that wouldn't explain how the page number got embedded in the chapter name.

My Chapters are showing up as "1.", also with the text "1." as the last thing from the end of the preceding chapter. Except the Chapter style (heading 1) pages which I'm using for the Parts (there are 4), *are* correctly appearing as "Part I", "Part II" etc. Those Parts also don't have the spurious "1." inserted at the end of the previous chapter.
Note that the Part pages *do* get the spurious "1." added at the end of them, too.

LukeKendall (luke-zeta) wrote :

Hmm, if I open the TOC editor, half the chapters are missing, even though all are listed (as pairs per page) in the actual TOC. In the editor, for some reason the 1st chapter is an H1 tag, and the second is an H3 tag:

<h1 class="p-p15" id="calibre_toc_3"><a class="s-t"></a><a href="index_split_043.xhtml#anchor12" class="s-t"><span class="s-t4"> Chapter 2 23</span></a><a id="anchor13" class="s-t"></a><a class="s-t"></a></h1><a class="calibre4">

</a><h3 class="p-p16"><a class="s-t"></a><a href="index_split_044.xhtml#anchor14" class="s-t"><span class="s-t4"> Chapter 3 35</span></a><a id="anchor15" class="s-t"></a><a class="s-t"></a></h3><a class="calibre4">

I turned off the "Renumber sequences of <h1> or <h2> tags to prevent splitting. Ah, yes: that stops that problem. Now I'm back to the 1 TOC entry per page problem in the TOC. I still have the problem of all chapters (except the Prolog, and four Parts) appear in the text of the book as "1." and so forth, as described above.

LukeKendall (luke-zeta) wrote :

If I turn off all the heuristic processing, I don't get the extra "1." added at the end of chapters, I just get the problem of each TOC entry on its own page, and each chapter in he body of the book being named "1.". Hope that information he,ps.

Luke -- Thanks for the info.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments