[l2h] found possible bug in table of contents generation

Jeroen Haak j.haak@amc.uva.nl
Fri, 6 Apr 2001 11:48:30 +0200


--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

I just started using latex2html and I'm very happy with it.  However I
think I found a bug.  I wanted to make the background color of my html
pages white, so I included \usepackage{html} and
\bodytext{bgcolor=white} in my document.  After doing so, the main
page still contains a table of contents.  However the table of contents
page was empty.

Next I tried the color package with \pagecolor{white} and setting
$BODYTEXT.  They both also resulted in an empty table of contents page.

I started in browsing and hacking through the latex2html code of which
I only understand about 10% and finally I found something suspicious
in the add_real_child_links subroutine.

Here I found the following piece of code.  However the fourth element
of $section_info{$next} doesn't contain "star" info like
$toc_section_info as is used in the next if section.  The fourth
element of $section_info{$next} contains "body" information.

#           if ($exclude) {
                ($next_depth, $file, $title, $star) =
                        split($delim,$section_info{$next}); 
#           }
            if (!$title) {
                ($next_depth, $file, $title, $star) =
                        split($delim,$toc_section_info{$next});
            }

Therefor I changed the code to:

#         if ($exclude) {
              $star='';
              ($next_depth, $file, $title) =
                      split($delim,$section_info{$next}); 
#         }

After this change latex2html made a correct table of contents page and
everything seems to work fine.

So I don't know for sure if this is a good patch, but it seems to work
fine.

I've attached an example latex file named test.tex which demonstrates
the problem.  You can just in- or exclude the \bodytext line.

My latex2html version is:

% latex2html -V
This is LaTeX2HTML Version 99.2beta6 (1.42)
by Nikos Drakos, Computer Based Learning Unit, University of Leeds.

In the test I used "latex2html text.tex" without any arguments.

Regards,
Jeroen.

--
Jeroen Haak, Academical Medical Center, The Netherlands
J.Haak@amc.uva.nl, phone +31 20 5662916, fax .. 5669020


--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="latex2html.patch"

*** latex2html	Fri Apr  6 11:05:49 2001
--- latex2html.patched	Fri Apr  6 11:05:45 2001
***************
*** 7723,7729 ****
  	foreach $next (@subtree) {
  	    $title = '';
  #	    if ($exclude) {
! 		($next_depth, $file, $title, $star) =
  			split($delim,$section_info{$next}); 
  #	    }
  	    if (!$title) {
--- 7723,7730 ----
  	foreach $next (@subtree) {
  	    $title = '';
  #	    if ($exclude) {
! 		$star='';
! 		($next_depth, $file, $title) =
  			split($delim,$section_info{$next}); 
  #	    }
  	    if (!$title) {

--U+BazGySraz5kW0T
Content-Type: application/x-tex
Content-Disposition: attachment; filename="test.tex"

\documentclass{article}

\usepackage{html}

\bodytext{bgcolor=white}

\begin{document}

\tableofcontents

\section{Section a}
Text section a

\subsection{Subsection a}
Text subsection a

\subsection{Subsection b}
Text subsection b


\section{Section b}
Text section b

\subsection{Subsection a}
Text subsection a

\subsection{Subsection b}
Text subsection b

\end{document}

--U+BazGySraz5kW0T--