version 1.1, 2010/08/18 12:04:31
|
version 1.2, 2010/08/27 09:42:48
|
Line 140 array element is a table row. However:
|
Line 140 array element is a table row. However:
|
These are treated as LaTeX/TeX commands and, when the table is generated, |
These are treated as LaTeX/TeX commands and, when the table is generated, |
passed without interpretation. |
passed without interpretation. |
|
|
=item Empty cells |
=item Lines with one cell that is empty. |
|
|
These produce a horizontal rule that spans the width of the table. |
These produce a horizontal rule that spans the width of the table. |
|
|
Line 222 sub generate_string {
|
Line 222 sub generate_string {
|
sub table_header() |
sub table_header() |
{ |
{ |
my ($self) = @_; |
my ($self) = @_; |
my $result = 'begin{tabular}['; |
my $result = '\begin{tabular}{'; |
my $coldef = $self->{'coldef'}; |
my $coldef = $self->{'coldef'}; |
|
|
if ($coldef eq '') { |
if ($coldef eq '') { |
Line 252 sub table_header()
|
Line 252 sub table_header()
|
# |
# |
sub table_body() |
sub table_body() |
{ |
{ |
return ''; |
my ($self) = @_; |
|
my $result = ''; |
|
foreach my $row (@{$self->{'data'}}) { |
|
# |
|
# If a row has only a single cell we need to deal with the two special cases |
|
# Pass LaTeX uninterpreted or \hline. |
|
# |
|
if ((scalar @{$row}) == 1) { |
|
my $cell = $row->[0]; |
|
if ($cell eq '') { |
|
$result .= '\hline' . "\n"; |
|
} elsif (substr($cell, 0, 1) eq "\\") { |
|
$result .= $cell . "\n"; |
|
} else { |
|
# could just be a table with one col... |
|
|
|
$result .= $cell . ' \\\\ ' ."\n"; |
|
} |
|
} else { |
|
my $line = ''; |
|
foreach my $cell (@{$row}) { |
|
$line .= $cell . ' & '; |
|
} |
|
# Replace the last ' & ' with \\ and a line terminator.. |
|
# and append the line to the result. |
|
|
|
$line =~ s/ & $/ \\\\\n/; |
|
$result .= $line; |
|
} |
|
} |
|
return $result; |
} |
} |
|
|
# |
# |