[tex4ht] [bug #228] tex4ht does not accept \setcounter{tocdepth} in report class

Michal Hoftich michal.h21 at gmail.com
Tue Aug 19 14:53:53 CEST 2014


Nasser,

sorry for late reply, I had a busy weekend. You don't have to apply
patches I send here yourself, Karl applies them to the tex4ht sources
and corrected files are then uploaded to TeX Live, so you should need
only to update TL with Tlmgr.

But, if you really want to apply them yourself, you need to obtain
tex4ht literate sources. To do this, you need to install subversion
and run this command:

     svn checkout http://svn.gnu.org.ua/sources/tex4ht

literate sources are placed in

     tex4ht/src/tex4ht/trunk/lit

these files are in special literate programming format, called ProTex
[1]. Output `.4ht` files and documentation are produced with running
`htlatex` or `httex` on these files. If you are not interested in
documentation, you can just run `latex` or `tex` on these files. There
is also makefile, so you can use `make` command, but it took about an
hour on my computer to compile all literate  sources. I've placed
generated documentation online [2]

File `tex4ht-4ht.tex` is really important one, because this is the
place where LaTeX packages are redefined to insert tex4ht hooks, which
are then seeded in other files. So dozens of .4ht files are generated
after compilation of this file.

Best regards,
Michal



[1] http://www.tex.ac.uk/ctan/web/protex/LitProg
[2] http://michal-h21.github.io/src4ht/

2014-08-15 19:20 GMT+02:00 Nasser M. Abbasi <nma at 12000.org>:
> On 8/15/2014 6:16 AM, Michal Hoftich wrote:
>>
>> I've found source of this issue, details are in my answer at TeX.sx:
>> http://tex.stackexchange.com/a/195628/2891
>>
>> strange thing is that this code is used several times at different
>> places in the sources, but I also found, that for ams classes, correct
>> method is used:
>>
>> \<entries for tocs of amsbook.cls\><<<
>> \ifnum \c at tocdepth >-2 part,likepart,\fi
>> \ifnum \c at tocdepth >\m at ne chapter,likechapter,appendix,\fi
>> \ifnum \c at tocdepth >\z@ section,likesection,\fi
>> \ifnum \c at tocdepth >1 subsection,likesubsection,\fi
>> \ifnum \c at tocdepth >2 subsubsection,likesubsubsection,\fi
>> \ifnum \c at tocdepth >3 paragraph,\fi
>> \ifnum \c at tocdepth >4 subparagraph,\fi
>> UnDFexyz
>>>>>
>>>>>
>>
>> I hope that I updated all occurrences in the sources and didn't break
>> anything, testers are welcomed!
>>
>
> Michal;
>
> Thanks for the patch file.
>
> Can you please  give the command one needs to use to apply
> the patch file you attached in Linux? To use the patch command
> one needs to know the patch file to patch.
>
> Looking at the top of the patch file you attached, it
> says tex4ht-4ht.tex, but I do not have such a file on my tree:
>
> ---------------------------
>>
>> pwd
>
> /usr/local/texlive
>>
>> find . -name tex4ht-4ht.tex
>
> ------------------------
>
> Nothing found. I assume I need to do, as root
>
> patch tex4ht-4ht.tex < toc.patch
>
> ?
>
> Where toc.patch is the file you attached.
>
> thanks,
> --Nasser
>
>
>>
>> 2014-08-09 21:31 GMT+02:00 Nasser M. Abbasi <puszcza-hackers at gnu.org.ua>:
>>>
>>> URL:
>>>    <http://puszcza.gnu.org.ua/bugs/?228>
>>>
>>>                   Summary: tex4ht does not accept \setcounter{tocdepth}
>>> in
>>> report class
>>>                   Project: tex4ht
>>>              Submitted by: nma123
>>>              Submitted on: Sat 09 Aug 2014 10:31:39 PM EEST
>>>                  Category: None
>>>                  Priority: 5 - Normal
>>>                  Severity: 5 - Normal
>>>                    Status: None
>>>                   Privacy: Public
>>>               Assigned to: None
>>>          Originator Email:
>>>               Open/Closed: Open
>>>           Discussion Lock: Any
>>>
>>>      _______________________________________________________
>>>
>>> Details:
>>>
>>> Reference:
>>>
>>>
>>> http://tex.stackexchange.com/questions/195608/why-tex4ht-does-not-accept-setcountertocdepth-in-report-class-but-it-does-in
>>>
>>> When setting \setcounter{tocdepth}{0} in report class, then the PDF file
>>> shows
>>> only the chapters as expected in toc, but the HTML shows both chapter and
>>> sections in toc.
>>>
>>> When setting \setcounter{tocdepth}{1} in artice class, then the PDF file
>>> shows
>>> only the sections as expected in toc, and now the HTML shows only the
>>> sections
>>> in toc as expected as well.
>>>
>>> So, the question is: Why tex4ht agrees with pdf toc for article and not
>>> for
>>> report?
>>>
>>> When compiling this file
>>>
>>> \documentclass{report}%
>>> \setcounter{tocdepth}{0}
>>> \begin{document}
>>> \tableofcontents
>>> \clearpage
>>>
>>> \chapter{This is chapter 1}
>>> some text in chapter 1
>>> \section{1}
>>> some text in chapter, section
>>>
>>> \chapter{This is chapter 2}
>>> some text in chapter 2
>>> \section{1}
>>> some text in chapter, section
>>>
>>>
>>> \chapter{This is chapter 3}
>>> some text in chapter 3
>>> \section{1}
>>> some text in chapter, section
>>>
>>> \end{document}
>>>
>>> The section is added to the TOC in html. This is wrong. Only chapter
>>> should
>>> show up in TOC.
>>>
>>> This was on TexLive 2014
>>>
>>>
>>>
>>>
>>>      _______________________________________________________
>>>
>>> Reply to this item at:
>>>
>>>    <http://puszcza.gnu.org.ua/bugs/?228>
>>>
>>> _______________________________________________
>>>    Message sent via/by Puszcza
>>>    http://puszcza.gnu.org.ua/
>>>
>


More information about the tex4ht mailing list