[l2h] Re: Tables

Ross Moore Ross Moore <ross@ics.mq.edu.au>
Thu, 23 Dec 1999 20:28:38 +1100 (EST)

> On Thu, 23 Dec 1999, Joerg Broeker wrote:
> > By "bad" I mean it does not *look* like in the postscript version of
> > the document...
> This is - as far as I can see - a limitation of HTML: it is not possible
> to mimic stuff like {l|ccc} in HTML, so a simple table with BORDER=1 is
> used. This is bad, but at the moment I do not see any feasible method to
> emulate the borders appropriately.
> > > (Note: This is a 2 rows x 3 columns table, right?)
> > 
> > Depends, from the "logic" point of view you are right, but my Latex Book
> > (Latex by Helmut Kopka, Addison-Wesly, sorry german only) says thats the
> > way to do a table with a row with two lines in that row.
> > 
> > In HTML I get 2 rows with one line each, which is not the result I want.
> Ok, then you maybe want a \parbox or a \minipage as the table element. I
> don't know whether LaTeX allows for this - anyone?

Use \parbox , either in the body of the {tabular} or as a 'p' in the header.

In this simple case use:

  ...stuff in 1st cell.. 
 & ...stuff in 2nd cell\newline more stuff
 & ...stuff in 3rd cell \\


  ...stuff in 1st cell.. 
 & \parbox{<width>}{...stuff in 2nd cell\\ more stuff}
 & ...stuff in 3rd cell \\

Note that LaTeX2HTML scans tabulars for \parbox commands,
to replace any \\ inside by \newline .
If you use the 'p' in the header, then you *must* use \newline
inside the body of the cell, else the \\ will cause a new row prematurely.

The <width> can be conveniently given as a fraction (e.g. .65\textwidth
to become  65% of the browser window.)  rather than as an absolute length.

With  \usepackage{array} it is easy to vertically align large cells.
Use declarations  'm' 'b' (and 't' with LaTeX2HTML) for middle and bottom
(and top) alignments where 'p' aligns from the top in LaTeX (but may not
always do so with LaTeX2HTML).

> > > No, because LaTeX2HTML translates the logic behind the LaTeX commands into
> > > the logic of HTML, and in this case a HTML table with 2 rows and two
> > > columns is produced.

Yes; this is as it should be.

> > In Latex "logic" there is a difference between row and row ;-) - A
> > "logical" row is ended with "\\" a "optical" row is ended with "\hline".
> > In HTML the "logical" and the "optical" row are identical, a row is
> > always ended with "</TR>".

No; that is just someone's *cute* way of using visual positioning
to make it look right. It is still wrong in any sensible form of markup.

> Again, there is no simple solution to map the "|" in the tabular
> definition and the \hline to HTML table boxes. Any proposals how to do
> that are welcome! Your suggestion to use \hline as the delimiter for HTML
> rows is a first start. This would mean that we simply would keep a stack
> for each column and push LaTeX row by row to it until a \hline
> follows. Should be possible.

It doesn't come close. There are many situations in LaTeX when you want
lines under some rows, but not others.

To get lines around some cells but not others in HTML, you can do it
using tricky style-sheet rules. You have to customise these for each layout.
Tag the <TABLE> with a name or ID:  <TABLE CLASS="mytable" ID="table341">
to give the stylesheet a way of selecting this table and no others,
or all tables of this CLASS.

> > > The look can be controlled by customized style sheets. There is no point
> > > in "optimizing" the look at such a level. And it is definitely *not*
> > > simple to implement!

> > Another stupid question: How can I do that?

Not stupid at all.
It just needs more personal work than LaTeX2HTML can be expected to provide
for free.

> By looking at the latex2html script and editing the code for the tabular
> environment. :-)

Oh no; please don't touch it!!!

That risks hours/days of hard work implementing {array} and {tabularx}
to be automatically recognised in LaTeX2HTML.

Learn to use these packages in LaTeX and your tables will improve
dramatically on paper as well as on-screen in HTML.

> Hope this helps!
> Happy Xmas,

Agreed; again.  ;-)

	Ross Moore

> Marek