[l2h] alignmentproblem eqnarray - amsmath - test-case

Ross Moore ross at ics.mq.edu.au
Wed Dec 31 04:26:43 CET 2003


Hi again,

On Wed, 31 Dec 2003, Ross Moore wrote:

>
> Hi Peter,
>
> Now I see what is the problem:
>    where to put the extra white-space, of undetermined amount.
> (In TeX this is done using \hfill.)

> After a bit of experimentation, I can now see how to get the
>  'proper' centering. The HTML needs to have:
>   <td width=50% .....>
>      ^^^^^^^^^^
> for the left and right cells of the mathematics in the alignment
>  <TABLE>.  (The eqn-number cells remain as fixed-width.)
>
> It should be quite easy to adjust the LaTeX2HTML coding to add these
> extra width attributes.
>

Hmm; it seems to be more complicated than this, if we wish to stick
strictly within the HTML recommendations.

It seems that for HTML 3.2, the attribute   width=50%
is *not* valid for <TD> and <TH> tags --- cannot use %-amounts
though it *is* a valid notation for the <TABLE> as a whole.

For HTML 4.0 the notation works, at least with my validator,
but for <TD> and <TH> the  width  and  height  attributes are
deprecated.

Of course these still work fine in browsers, at least for now.



In HTML 4.0, the replacement for using these tags is to make
use of  <colgroup>  declarations;
e.g. (for the eqnarray cols, with eqn-numbers on the right):

   <colgroup span=1 width=.5* align=right valign=middle>
   <colgroup span=1 width=10px align=center valign=middle>
   <colgroup span=1 width=.5* align=left valign=middle>
   <colgroup span=1 width=10px align=right valign=middle>

with the cell contents given most simply:
   <td> ....mathematics... </td>

Unfortunately, neither of the standard browsers gets this right,
on my laptop:

  Netscape v7.1
     gets the spacing right, but fails to inherit alignment;

  IE v5.1.4
     fails to get the spacing right, but aligns correctly.

Under these circumstances, I see no better course of action than to
stick with the deprecated attributes for <TD ... > tags, when
LaTeX2HTML is generating code for HTML 4.0 or HTML 4.01.

For HTML 3.2, there should be *no change* to the present behaviour
--- though you can alter your own installation if validity isn't an
 issue for you.


> You can expect another email soon, telling you the required edits;

The files to be edited are:
    $LATEX2HTMLDIR/versions/math.pl
    $LATEX2HTMLDIR/versions/html4_0.pl
    $LATEX2HTMLDIR/versions/html4_1.pl

e.g.  for  math.pl  here's what will become part of the next update:

landau.ics.mq.edu.au> diff -c
       {/usr/local/lib/latex2html,.}/versions/math.pl
*** /usr/local/lib/latex2html/versions/math.pl  Wed Dec 31 12:15:59 2003
--- ./versions/math.pl  Sat Oct  5 10:12:28 2002
***************
*** 964,971 ****
        ($sarray, $eccell, $srcell, $erow, $earray, $sempty) = (
            "\n<TABLE$env_id CELLPADDING=\"0\" "
            , "</TD>\n<TD WIDTH=\"10\" ALIGN=\"CENTER\" NOWRAP>"
!           , "</TD>\n<TD ALIGN=\"LEFT\" NOWRAP"
!               . (($HTML_VERSION >3.3)? ' WIDTH="50%"':'').'>'
            , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
        $sarray .= "ALIGN=\"CENTER\" WIDTH=\"100%\">";
        $env_id = '';
--- 977,983 ----
        ($sarray, $eccell, $srcell, $erow, $earray, $sempty) = (
            "\n<TABLE$env_id CELLPADDING=\"0\" "
            , "</TD>\n<TD WIDTH=\"10\" ALIGN=\"CENTER\" NOWRAP>"
!           , "</TD>\n<TD ALIGN=\"LEFT\" NOWRAP>"
            , "</TD></TR>", "\n</TABLE>", "</TD>\n<TD>" );
        $sarray .= "ALIGN=\"CENTER\" WIDTH=\"100%\">";
        $env_id = '';
***************
*** 976,988 ****
        if ($EQN_TAGS =~ /L/) { # number on left
            ($srow, $slcell, $ercell) = (
                "\n<TR$valign>". $seqno
!               , "</TD>\n<TD NOWRAP"
!                   . (($HTML_VERSION >3.3)? ' WIDTH="50%"':'').' ALIGN='
!               , '');
        } else { # equation number on right
            ($srow, $slcell, $ercell) = (
!               "\n<TR$valign>" , "<TD NOWRAP"
!                   . (($HTML_VERSION >3.3)? ' WIDTH="50%"':'').' ALIGN='
                , '</TD>'. $seqno );
        }

--- 988,997 ----
        if ($EQN_TAGS =~ /L/) { # number on left
            ($srow, $slcell, $ercell) = (
                "\n<TR$valign>". $seqno
!               , "</TD>\n<TD NOWRAP ALIGN=", '');
        } else { # equation number on right
            ($srow, $slcell, $ercell) = (
!               "\n<TR$valign>" , "<TD NOWRAP ALIGN="
                , '</TD>'. $seqno );
        }

***************

Thus there are 3 smallish edits to the subroutine block
   sub do_env_eqnarray {


In  html4_0.pl  and html4_1.pl   the edits are similar,
but there is then no need to test the  $HTML_VERSION .



> It will take a bit longer before the repository is updated at
>    www.latex2html.org
> as I'm planning to submit many more changes than just these.


The question remains as to whether other alignments (from AMSmath)
should have their coding adjusted in a similar way.


>
> Thanks for the examples, which clearly indicate the problem.
>

Happy New Year,

	Ross Moore



More information about the latex2html mailing list