[tex4ht] How to make table of contents use correct settings of \setcounter{tocdepth} for \tableofcontents ?

Radhakrishnan CV cvr at river-valley.org
Sun Aug 11 14:34:04 CEST 2013


On Sun, Aug 11, 2013 at 1:45 PM, Nasser M. Abbasi <nma at 12000.org> wrote:

> On 8/11/2013 1:36 AM, Radhakrishnan CV wrote:
>
>
>> I think, the following might help you:
>>
>
> Thanks you very much. Yes, that worked very well.
>
> For completion, I  have a MWE below which generates a local TOC
> for one chapter which is larger than the second local TOC for
> the second chapter, both for pdflatex and htlatex.  The main
> page TOC only shows the chapters in its TOC.
>
> ps. If you would have any hints or insight for the splitting problem
> http://tug.org/pipermail/**tex4ht/2013q3/000860.html<http://tug.org/pipermail/tex4ht/2013q3/000860.html>
>


Here is one of the solutions:


%---------------------------------------------------------------------------------

\documentclass{report}
\setcounter{tocdepth}{0}
\setcounter{secnumdepth}{4}
\usepackage{lipsum}

\begin{document}

\title{test cutat}
\author{me}
\date{\small\today}
\maketitle
\Configure{tableofcontents*}{chapter}

\tableofcontents

%---------------------
\ifx\HCode\undefined \else
\TocAt{chapter,section,subsection,subsubsection}
\fi
\chapter{chapter 1}
\section{section 1 in chapter 1}
\lipsum[2]
\subsection{subsection 1 in section 1 in chapter 1}
\subsection{subsection 2 in section 1 in chapter 1}
\subsubsection{subsubsection 1 subsection 2 in section 1 in chapter 1}
\section{section 2 in chapter 1}
\lipsum[3]
\subsection{subsection 1 in section 2 in chapter 1}
\subsection{subsection 2 in section 2 in chapter 1}
\subsubsection{subsubsection 1 subsection 2 in section 1 in chapter 1}
%----------------

\ifx\HCode\undefined \else
\TocAt{chapter,section}
\PauseCutAt{section}
\fi

\chapter{chapter 2}
\section{section 1 in chapter 2}
\lipsum[1]
\subsection{subsection 1 in section 1 in chapter 2}
\subsection{subsection 2 in section 1 in chapter 2}

\end{document}

%---------------------------------------------------------------------------------

htlatex <filename> 'html,3'

-- 
Radhakrishnan
River Valley<https://maps.google.com/maps?q=River%20Valley,%20Thiruvananthapuram%20Neyyardam%20Road,%20Kerala,%20India&vector=1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tex4ht/attachments/20130811/ceeb4abd/attachment.html>


More information about the tex4ht mailing list