2

I'm working on an ebook and i'm trying to make a main toc at the beginning like

1. chapter 1
    1.1 section 
    1.2 section
2. chapter 2
...

and minitocs at every chapter like

1.1 section
   1.1.1 subsection
1.2 section
...

the "minitocs" work fine with

\TocAt{chapter,section,subsection}

and the maintoc works almost fine with

\Configure{tableofcontents*}{chapter,section}

but the sections go 1,2,3,4 instead of 1.1,1.2,1.3,1.4. I somewhere found the config.cfg

\begin{document}
  \ConfigureToc{section}
      {\tocNesting{1}\HCode{<li>}}{ }{}{ }
   \ConfigureToc{subsection}
      {\tocNesting{2}\HCode{<li>}}{ }{}{ }
   \ConfigureToc{subsubsection}
      {\tocNesting{3}\HCode{<li>}}{ }{}{ }
   \Configure{tableofcontents}
      {} {\tocNesting{0}} {} {} {}

   \newcount\c
   \def\tocNesting#1{%
      \expandafter\ifx \csname level#1\endcsname\relax
          \ifnum #1>0 \HCode{<ul>}\fi
          \expandafter\def \csname level#1\endcsname{\HCode{</ul>}}
      \fi
      \c=#1 \advance\c by 1
      \loop
        \csname level\the\c\endcsname
        \expandafter\let \csname level\the\c\endcsname\relax
        \advance\c by 1
      \ifnum \c<10   \repeat
   }

now the numbering is correct, but subsections are also printed (which should be an easy fix i guess?) and in some epub-viewers i get an error message like "wrong tag, expected <\li>". Is there a way to configure the main toc to achieve what i want, without affecting the minitocs?

And another question: is it possible to include list of figures and list of tables in each chapter in tex4ht? (like minilof and minilot)

2

It seems that you generate Ebook in the Epub 3 format. It requires table of contents in a specific format, where numbered html list is used. It interfered with the section numbering explicitly added by tex4ht, so I disabled the section numbering and used only numbers added by the reading application. It is possible to revert this behavior with the following configuration:

\Preamble{xhtml}
\TocAt{chapter,section,subsection}
\Configure{tableofcontents*}{chapter,section}
\Configure{NavSection}{%
\booltrue{tocnoempty}
\HCode{<li>}}{\HCode{<ol>\Hnewline}}{}{\Tg</ol>\Tg</li>}
\Css{nav\#toc ol{list-style: none;}}
\begin{document}
\EndPreamble

The NavSection configuration takes care of the HTML list, in the original version it also suppressed the section numbering. The \Css command disables the HTML numbering for TOC.

This is the result:

enter image description here

Regarding your last question, it should be possible, but it would be better if you could to post a new question with a full MWE.

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.