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

Shigeharu TAKENO shige at iee.niit.ac.jp
Fri Feb 10 03:35:33 CET 2012


shige 02/10 2012
----------------

"Nasser M. Abbasi" <nma at 12000.org> wrote:
> Thank you, but as I said in the followup that I can't use the
> trick shown since it renders the whole table as an image.
> 
> This means the links are lost.

I don't mean to use makeimage, but mean Ex.1 or Ex.4 in the 
message. To achive Ex.1,

1-1) put

  $TBLADDOPT = '';

after the line

  $TD__AXES_rx = $TH__AXES_rx = $id_list_type;

in versions/html4_0.pl (or versions/html3_2.pl), and modify

  elsif ( $frames || $rules ) { $border = " BORDER=\"1\""; };

to 

  if ( $TBLADDOPT ) { $border = " $TBLADDOPT"; }
  elsif ( $frames || $rules ) { $border = " BORDER=\"1\""; }

in the subroutine process_tabular in the same file.

1-2) write the table as following:

   \usepackage{html}
   ...
   \HTMLsetenv{TBLADDOPT}{BORDER="1" RULES="rows"}
   \begin{tabular}{|l|l|}
   a & b \\
   c & d \\
   \end{tabular}

Then, the html table will become

  <TABLE CELLPADDING=3 BORDER="1" RULES="rows">
  <TR>
  <TD ALIGN="LEFT">a</TD>
  <TD ALIGN="LEFT">b</TD>
  </TR>
  <TR>
  <TD ALIGN="LEFT">c</TD>
  <TD ALIGN="LEFT">d</TD>
  </TR>


To achive Ex.4,

2-1) put 

  $TDADDOPT = $THADDOPT = '';

after the line

  $TD__AXES_rx = $TH__AXES_rx = $id_list_type;

in versions/html4_0.pl (or versions/html3_2.pl), and put

  $colspec =~ s/<TD/<TD $TDADDOPT/g if $TDADDOPT;
  $colspec =~ s/<TH/<TH $THADDOPT/g if $THADDOPT; 

after the line

  if ($headcell) {
     $colspec =~ s/<TD/<$headcell/g;
     $colspec =~ s/<\/TD/<\/$headcell/g;
  }
 
in the subroutine process_tabular in the same file.

2-2) write the table as following:

   \usepackage{html}
   \newcommand{\celi}{\HTMLset{TDADDOPT}{CLASS="celgrp1"}}
   \newcommand{\celii}{\HTMLset{TDADDOPT}{CLASS="celgrp2"}}
   ...
   \begin{tabular}{|l|l|}
   \celi a & \celii b \\
   \celi c & \celii d \\
   \end{tabular}
   \htmlsetstyle[TD]{celgrp1}{background-color=#ffccff}
   \htmlsetstyle[TD]{celgrp2}{background-color=#ffffcc}


Then, latex2html will make the HTML file with

  <TABLE CELLPADDING=3 BORDER="1">
    <TR>
    <TD CLASS="celgrp1" ALIGN="LEFT">a</TD>
    <TD CLASS="celgrp2" ALIGN="LEFT">b</TD>
    </TR>
    <TD CLASS="celgrp1" ALIGN="LEFT">c</TD>
    <TD CLASS="celgrp2" ALIGN="LEFT">d</TD>
    <TR>
  </TABLE>

and the CSS file with

  TD.celgrp1 { background-color : #ffccff }
  TD.celgrp2 { background-color : #ffffcc }

Also to set border 0, you may combinate Ex.4 with Ex.1.

+========================================================+
 Shigeharu TAKENO     NIigata Institute of Technology
                       kashiwazaki,Niigata 945-1195 JAPAN
 shige at iee.niit.ac.jp   TEL(&FAX): +81-257-22-8161
+========================================================+



More information about the latex2html mailing list