[l2h] How to generate a table using latex2html without horizontal lines between rows?

Ross Moore ross.moore at mq.edu.au
Fri Feb 10 21:27:39 CET 2012

Hello Nasser,

On 10/02/2012, at 22:13, "Nasser M. Abbasi" <nma at 12000.org> wrote:

> But, this does not solve the issue at hand, which is how to
> tell it not add boarder between rows, unless \hline is given.

The model for handling tables in LaTeX and HTML are quite different.
They cannot be made to match easily, without the user adding extra markup into the source document. Besides, what looks good in a table in print, does not necessarily translate easily to how it is best represented onscreen.

For example, the \hline command occurs after a group of cells in the LaTeX source; it causes a line to be drawn under the whole group of cells.
But in HTML each cell, or row of cells, has its decoration controlled by CSS style properties. 

CSS is not HTML, but is a whole separate architecture which allows for many, many possibilities.
To add styles to a cell requires specifying a class name, then adding properties to be used by that class. Shigeharu showed you how to do that.

At the time when LaTeX2HTML was under active development, browsers had limited support for CSS, and different browsers would support a different set of features, or would handle the same features differently. Thus there was little incentive to code up actions for detailed styling in tables, since you could not know what web surfers would actually see onscreen.

Without CSS, you can only ask for borders in all cells or no borders at all.
LaTeX2HTML simply takes the presence of an \hline  anywhere to trigger showing borders.
Besides, is the \hline  meant to be affecting the styles of the cells above, or below?
You could write some coding that does what you want, but would fail for someone else.

> The above just says that the table should have a line between the
> rows of thickness "1".

Not just between, but all around.

> If I try:
> ---------------------------------------
> \documentclass[12pt]{article}
> \usepackage{html}
> \begin{document}
> \HTMLsetenv{TBLADDOPT}{BORDER="1" RULES="cols"}
> \begin{tabular}{|l|l|}
>  a & b \\
>  c & d \\  \hline
>  e & f \\
> \end{tabular}
> \end{document}
> -----------------------------------------
> Then no lines are shown between rows, ok, but also no line is shown between the
> second row and the third even though I said \hline. Ofcourse, this is becuase
> of \HTMLsetenv took over.

Yes. But also because there is no canonical way to say what styles should be applied to which cells, and how these should be combined with any other styling requests.

> What I want it to be able to control, using \hline, when a line should appear.

Sure, but it is not well defined just what should happen in HTML and CSS.
Some user help is the best way to handle this.

> I will keep trying other things, as this is the first time I knew
> I can use \HTMLsetenv like this from inside latex. May be there is
> a trick, but so far, I do not see it.

This can be a very powerful mechanism, especially when the author can do a bit of Perl programming.

> Thanks again for Shigeharu help on this.
> --Nasser

Hope this helps,


Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the latex2html mailing list