Nasser M. Abbasi nma at 12000.org
Sun Aug 11 10:15:11 CEST 2013

On 8/11/2013 1:36 AM, Radhakrishnan CV wrote:

>

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
that would be great. That is the main stumbling block for me and
if any one can solve it, it would be you :)

(for some reason it makes a page break in each chapater, but I
am sure this is an etoc setting and I have not had time to look at it)

-------------------------------------------------
\documentclass{report}%
\usepackage{etoc}
\setcounter{tocdepth}{0}
\setcounter{secnumdepth}{4}

\makeatletter
{\let\iftexforht\@firstoftwo}
{\let\iftexforht\@secondoftwo}
\makeatother

\begin{document}

\title{test TOC with tex4ht 2}
\author{me}
\date{\today}
\maketitle

\ifdefined\HCode %thanks to Radhakrishnan CV for this solution
\Configure{tableofcontents*}{chapter}
\fi

\tableofcontents  % MAIN TOC

\ifdefined\HCode  %reset for local TOC for tex4ht
\TocAt{chapter,section,subsection,subsubsection}
\fi
%------ F I R S T    C H A P T E R -----
\ifdefined\HCode
\else
{
\setcounter{tocdepth}{4}  %reset for local TOC for pdf
\localtableofcontents
}
\fi

some text
\section{Heading section 1 under chapter 1}
text
\subsection{Heading subsection 1 under section 1 under chapter 1}
text
text

%------ S E C O N D     C H A P T E R -----

\ifdefined\HCode
\TocAt{chapter,section} %reset for local TOC for tex4ht
\fi

\ifdefined\HCode\
\else
{
\setcounter{tocdepth}{2}  %reset for local TOC for pdf
\localtableofcontents
}
\fi

some text
\section{Heading section 1 under chapter 2}
some text
\subsection{Heading subsection 1 under section 1 under chapter 2}
text
\subsubsection{Heading subsubsection 1 under subsection 1 under section 1 under chapter 2}
text

\end{document}

--Nasser