2

My book does not have numbered chapters, and it is typeset correctly, but in the ncx table of contents TeX4ebook provides the chapter number 0 before chapters in the main matter only. Here is my MWE:

\documentclass[10pt]{book}

\usepackage{titletoc}   %fails if commented out
\usepackage{titlesec}
\usepackage{tex4ebook}
\setcounter{secnumdepth}{-2}%   don't number parts or anything else

\begin{document}
\frontmatter
\chapter{Preface}
This is the preface.

\mainmatter
\chapter{One}
A chapter

\chapter{Two}
Another chapter

\backmatter
\chapter{Backmatter}
No chapter number here, either

\end{document}

And here is the .cfg file:

\Preamble{xhtml}
  \CutAt{section}
  \ConfigureMark{chapter}{} %has no effect either way
\begin{document}
\EndPreamble

"Preface" and "Backmatter" have no zero put in front in the ncx TOC, but "One" and "Two" do.

One thing I note as well is that there is a blank page at the beginning of the ebook, presumably because ebook readers put a page break between files. This is not a problem for me (and maybe not for anyone else) since my book has cover, copyright etc up front, but I just thought I'd mention it. Seems like it might be hard to "fix" and probably not worth it.

Many thanks, as always!

3

ncxtable is printed using complicated customized \tableofcontents. I didn't realize that I have to deal with missing sectioning numbers when secnumdepth counter is used. I updated tex4ebook with some tests for this case and it should work correctly on your file now:

  <navMap>
    <navPoint id="navPoint-1" playOrder="1">
      <navLabel>
        <text>Preface</text>
      </navLabel>
      <content src="samplech1.html#x3-2000" />
    </navPoint>
    <navPoint id="navPoint-2" playOrder="2">
      <navLabel>
        <text>One</text>
      </navLabel>
      <content src="samplech2.html#x4-30000" />
    </navPoint>
    <navPoint id="navPoint-3" playOrder="3">
      <navLabel>
        <text>Two</text>
      </navLabel>
      <content src="samplech3.html#x5-40000" />
    </navPoint>
    <navPoint id="navPoint-4" playOrder="4">
      <navLabel>
        <text>Backmatter</text>
      </navLabel>
      <content src="samplech4.html#x6-50000" />
    </navPoint>
  </navMap>

Your configuration with \ConfigureMark can't work because it is used in sectioning commands, not in table of contents.

Regarding blank file, this is because it is because you have no text outside chapters and sections, which are all extracted to standalone files. So this is the main file, from which all information is cut off. You can add some text here if you place it before first \chapter command. if you've used \maketitle, title page would be placed here.

  • thanks again so much for your help! I will try this out on my full project. – Nat Kuhn Oct 27 '14 at 21:34
  • @NatKuhn you are welcome. there is lack of testers of tex4ebook, so I am actually happy when I can fix some deficiencies which I wouldn't find otherwise – michal.h21 Oct 27 '14 at 21:38
  • Thanks @michal.h21. I have a series of TeX4ebook questions which will be coming up, I guess the best thing is just to keep posting them here? – Nat Kuhn Oct 27 '14 at 22:38
  • @NatKuhn sure, post it here, as it may be useful also for other users – michal.h21 Oct 27 '14 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.