[l2h] Tabular problems - solved

John O'Gorman john.ogorman at zombie.co.nz
Sun Feb 22 10:57:36 CET 2004


My most grateful thanks Ross.

I'm amazed that you could penetrate so deeply into the cause of the 
problem in so little time.

I will alter the perl as you suggest.

Warmest regards
John O'Gorman


Ross Moore wrote:
> Hi John,
> 
>   I've looked at the examples, thanks.
>   As I thought, the problem was rather subtle:
> 
>   The \providecommand  replacement of \tabularnewline  was not
>   taking place, when the document has sections --- unless the table
>   occurs *before* the first \section (or \chapter, etc.) command.
> 
>   Following the logic of the command-replacement coding, it became
>   apparent that a Perl variable $within_preamble  was not being
>   reset to 0 after the first sectioned-segment of the full document;
>   i.e., after the preamble has been fully processed, for documents
>   containing multiple (sub-)sections, etc.
> 
>   The value of $within_preamble only affects the handling of macros
>   defined using \providecommand, and for which there is no
>   \renewcommand definition also. (It's used to indicate the need to
>   put the \providecommand line itself into the preamble constructed
>   for generating images.)
> 
>   Also, if the macro was expanding into ordinary text, then there
>   would probably not have been a noticeable problem, as the replacement
>   would then have taken place later in the processing.
> 
>   However, since the intended expansion is  \tabularnewline --> \\
>   to create the delimiter for table rows, your example produces
>   something rather unexpected --- but explainable.
>   In fact, you would get the same result if you replace all
>   (in fact, the first is enough) instances of \tabularnewline
>   by \newline .
> 
>   So here's a simple fix, which I'm rather confident is robust,
>   and will be included in the next update of LaTeX2HTML.
> 
> 
>   In the  latex2html  script (any version, so I won't give line numbers),
>   find the following code portion, and insert the indicated lines:
> 
> 
>             } else { push(@pieces, $this_cmd) }
>           }
>           push(@pieces, $after);
> #### INSERT the next 2 lines:
>           # after the first segment we should no longer be in the preamble.
>           $within_preamble = 0;
> #### end of INSERT
>         }
>         print " $replacements new-command replacements\n"
>             if (($VERBOSITY>1) && $replacements);
>         # recombine the processed pieces
> 
> 
>>
>> Go to http://www.og.co.nz and follow the aubit4gl link.
>> I have agreed to do the documentation for the Aubit 4GL project.
>>
>> I have put 3 triplets there based on table.lyx and badtable.lyx.
>> The generated .tex and html trees are href'd on that page.
>> These are the minimal examples of a good and a bad table. For me it 
>> seems that putting a table after any section or subsection causes the 
>> problem. Note that I am using -split 3 -link 4 in order to get a node 
>> for each section with a toc at the top of the page.
>>
>> The aubit file above are also big examples of the problem (the pdf is 
>> good, the htmls have only the 1st row of tables int them.
> 
> 
> Yes. When LaTeX2HTML finds excess cells in a line, they are omitted 
> altogether.
> This is better than trying to guess the correct structure of a table,
> because HTML browser do really weird, unfriendly things with incomplete
> and badly-formed tables.
> However, there should be a warning message that something is wrong;
> so I'll look into adding that for future releases.
> 
>>
>> Happy hunting!
> 
> 
> 
> Thanks for the bug report.
> That was a rather special combination of circumstances
> which had not been anticipated, hence went untested,
> when devising the support for \providecommand .
> 
> Best regards,
> 
>     Ross Moore
> 
>>
>> John O'Gorman
>>
> ------------------------------------------------------------------------
> Ross Moore                                         ross at maths.mq.edu.au
> Mathematics Department                             office: E7A-419
> Macquarie University                               tel: +61 +2 9850 8955
> Sydney, Australia                                  fax: +61 +2 9850 8114
> ------------------------------------------------------------------------
> 
> 





More information about the latex2html mailing list