[l2h] [99.2beta2] @{} produces an extra column

Ross Moore Ross Moore <ross@ics.mq.edu.au>
Thu, 14 Oct 1999 08:41:24 +1000 (EST)


> Hi,
> 
> using @{} in the specification of a tabular generates an extra column. This
> shows up if the resulting TABLE has a border. I can understand that this is
> needed for the case of "@{xxx}" but IMHO not for "@{}". Take for instants
> 
>   \begin{tabular}{@{}ll@{}}
>     \hline
>     Item & Description \\
>     \hline
>     A    & Item 1 \\
>     B    & Item 2 \\
>     \hline
>   \end{tabular}
> 
> In LaTeX it generates 2 nice columns without excess left and right space
> but in HTML I get 4 columns. Applying the patch included below solves this
> problem.
> 
> Is there any reason not to apply the patch?
> If not, could it be included in the distribution?
 
OK. scanning for an obvious special case is no problem.

But then, why not generalise a bit?

   my $celldata_test = &translate_commands($celldata);
   push(@colspec, join ........
	unless ($celldata_test =~ /^\s*$/);

That is, leave it out if it is empty or just blank space,
after expanding macros. I use a new container $celldata_test
since $celldata may contain commands to set a style or font
or change a counter value for each line in the table.
So the template needs to keep the original code, not its
expansion.

Can anyone foresee any problems with this ?


> Best regards,
> 
> Luc Van Eycken

Thanks for suggesting this.

	Ross Moore

> 
> --- latex2html-99.2beta2/versions/html3_2.pl.orig	Fri Sep 17 07:15:09 1999
> +++ latex2html-99.2beta2/versions/html3_2.pl	Wed Oct 13 17:29:17 1999
> @@ -413,7 +413,8 @@
>  #	    if ( $#colspec > -1) {
>  #	        $colspec[$#colspec] .= join('', "<TD ALIGN=\"LEFT\">",$celldata,'</TD>');
>  #	    } else { $at_text .= join ('', $celldata , '</TD><TD>' ) }
> -	    push (@colspec, join('', "<TD ALIGN=\"LEFT\">",$celldata,'</TD>'));
> +	    push (@colspec, join('', "<TD ALIGN=\"LEFT\">",$celldata,'</TD>'))
> +	      if $celldata ne '';
>  	    $celldata = '';
>  
>  	} elsif ( $char =~ /\>/ ) {