A little bit of progress, but no solution yet. I thought I update
in case someone can help with this last part.
I found a way to remove the section entry from the main tableofcontents
(on first page) so that only chapters show up, like this:
1. chapter 1
2. chapter 2
Before it was like this:
1. chapter 1
1.1 section 1
2. chapter 2
2.1 section 1
This is good, which is what I wanted. The problem is that this
solution now removed section and anything above it entries from
the local table(s) of contents that I had in each chapter later on.
I am not able to figure how to get that back.
The trick is to use \ConfigureToc{section} {} {} {} {} BEFORE
issuing \tableofcontents.
Here is the current version of MWE. I am not able to find what
configuration option to tweak. There are simply too many configurations
and hard to know what each one does and where it acts and what it does
as there is minimal documentation and examples. So it is all done by
trial and error.
htlatex foo.tex "htm,2,notoc*,info"
-------------------------
\documentclass{report}%
\usepackage{lipsum}
\setcounter{tocdepth}{0}
\setcounter{secnumdepth}{4}
\begin{document}
\title{test TOC with tex4ht 2}
\author{me}
\date{\today}
\maketitle
\ifdefined\HCode %to prevent section showing up in main TOC
\ConfigureToc{section} {} {} {} {}
\fi
\tableofcontents
\ifdefined\HCode
%----> I need to do something here
%----> to make section show up in local TOC again, how???
\TocAt{chapter,section,subsection,subsubsection}
\fi
%-----------
\chapter{this is chapter 1}
\lipsum{1}
\section{this is section 1 under chapter 1}
text
\subsection{this is subsection 1 under section 1 under chapter 1}
text
\subsubsection{this is subsubsection 1}
%----------------
\chapter{this is chapter 2}
\lipsum{1}
\section{this is section 1 under chapter 2}
\end{document}
---------------------
--Nasser
On 8/10/2013 4:56 PM, Nasser M. Abbasi wrote:
I do not know if this is a bug or a feature of tex4ht that can
be modified by additional configurations. But I have a very simple
file, with chapter and sections.
All what I wanted is to have the main \tableofcontents show only
chapters in it, and not chapters and sections.
pdflatex output is correct, the TOC there shows only chapters. But
tex4ht insist in showing the chapter and the section in the TOC.
Here is MWE. \setcounter{tocdepth}{0} causes only chapters to show
up in the PDF's TOC, which is what I want, but not in HTML.
\setcounter{tocdepth}{1} causes chapters+section to show up in
the TOC of the PDF, but HTML shows now subsections as well. It seems
htlatex has one extra step in counting?
So, I said let me try \setcounter{tocdepth}{-1} may be that will make
htlatex think it is actually "0" now. But no luck, this caused
no TOC at all to be shown in HTML. So I have no idea what logic is used.
Do I have to use \ConfigureToc{??}{}{}{}{} somehow here? But this is
for the main (top) tableofcontents.
Any advice in how to make htlatex produce only chapters in this example?
I just wanted it to show the same TOC as the PDF in this example.
htlatex foo.tex "htm"
----------------------------------
\documentclass{report}%
\usepackage{lipsum}
\setcounter{tocdepth}{0} %this causes only chapters to show up
%but only in PDF. In html, it shows
%section as well in the TOC, why?
\begin{document}
\title{test TOC with tex4ht 2}
\author{me}
\date{\today}
\maketitle
\tableofcontents
%-----------
\chapter{chapter 1}
\lipsum{1}
\section{section 1 under chapter 1}
text
\subsection{subsection 1 under section 1 under chapter 1}
text
\subsubsection{subsubsection 1}
%----------------
\chapter{chapter 2}
\lipsum{1}
\section{section 1 under chapter 2}
\end{document}
----------------------------------
thanks
--Nasser