--- loncom/xml/londefdef.pm 2005/03/31 15:54:33 1.265 +++ loncom/xml/londefdef.pm 2005/10/18 21:30:49 1.289 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.265 2005/03/31 15:54:33 albertel Exp $ +# $Id: londefdef.pm,v 1.289 2005/10/18 21:30:49 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -39,7 +39,7 @@ package Apache::londefdef; -use Apache::lonnet(); +use Apache::lonnet; use strict; use Apache::lonxml; use Apache::File(); @@ -47,7 +47,7 @@ use Image::Magick; use Apache::lonmenu(); use Apache::lonmeta(); use Apache::Constants qw(:common); - +use File::Basename; BEGIN { @@ -55,6 +55,7 @@ BEGIN { } + sub initialize_londefdef { $Apache::londefdef::TD_redirection=0; @Apache::londefdef::table = (); @@ -90,7 +91,8 @@ sub start_m { $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); #&Apache::lonxml::debug("M is evaulated to:$inside:"); } - $currentstring = &Apache::lontexconvert::converted(\$inside); + my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval); + $currentstring = &Apache::lontexconvert::converted(\$inside,$display); if ($Apache::lontexconvert::errorstring) { &Apache::lonxml::warning("tth error: ". $Apache::lontexconvert::errorstring); @@ -132,7 +134,7 @@ sub start_tthoption { if ($target eq 'web') { my $inside = &Apache::lonxml::get_all_text("/tthoption",$parser); $inside=~s/^\s*//; - if ($ENV{'browser.mathml'}) { + if ($env{'browser.mathml'}) { &tth::ttmoptions($inside); } else { &tth::tthoptions($inside); @@ -151,20 +153,21 @@ sub end_tthoption { sub start_html { my ($target,$token) = @_; my $currentstring = ''; - my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'}; + my $options=$env{'course.'.$env{'request.course.id'}.'.tthoptions'}; &Apache::lontexconvert::init_tth(); - if ($target eq 'web' || $target eq 'edit') { + if ($target eq 'web' || $target eq 'edit' || $target eq 'webgrade' ) { $currentstring = &Apache::lonxml::xmlbegin(); } elsif ($target eq 'tex') { $currentstring .= '\documentclass[letterpaper]{article}'; - if (($ENV{'form.latex_type'}=~'batchmode') || - (!$ENV{'request.role.adv'})) {$currentstring .='\batchmode';} + if (($env{'form.latex_type'}=~'batchmode') || + (!$env{'request.role.adv'})) {$currentstring .='\batchmode';} $currentstring .= '\newcommand{\keephidden}[1]{}'. '\renewcommand{\deg}{$^{\circ}$}'. '\usepackage{longtable}'. '\usepackage{textcomp}'. '\usepackage{makeidx}'. '\usepackage[dvips]{graphicx}'. + '\usepackage{wrapfig}'. '\usepackage{picins}'. '\usepackage{epsfig}'. '\usepackage{calc}'. @@ -201,7 +204,7 @@ sub start_head { sub end_head { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web' && $ENV{'request.state'} eq 'published') { + if ($target eq 'web' && $env{'request.state'} eq 'published') { $currentstring = &Apache::lonmenu::registerurl(undef,$target). $token->[2]; } @@ -489,15 +492,15 @@ sub start_body { return ''; } if (!$Apache::lonxml::registered && - $ENV{'request.state'} eq 'published') { + $env{'request.state'} eq 'published') { $currentstring.='
'. &Apache::lonmenu::registerurl(undef,$target).''; } # Accessibility - if ($ENV{'browser.imagesuppress'} eq 'on') { + if ($env{'browser.imagesuppress'} eq 'on') { delete($token->[2]->{'background'}); } - if ($ENV{'browser.fontenhance'} eq 'on') { + if ($env{'browser.fontenhance'} eq 'on') { my $style=''; foreach my $key (keys(%{$token->[2]})) { if ($key =~ /^style$/i) { @@ -507,7 +510,7 @@ sub start_body { } $token->[2]->{'style'}=$style.'; font-size: x-large;'; } - if ($ENV{'browser.blackwhite'} eq 'on') { + if ($env{'browser.blackwhite'} eq 'on') { delete($token->[2]->{'font'}); delete($token->[2]->{'link'}); delete($token->[2]->{'alink'}); @@ -534,23 +537,25 @@ sub start_body { $token->[2]->{'onunload'}=&Apache::lonmenu::unloadevents(). ';'.$onUnload; - if ($ENV{'request.state'} ne 'construct') { - $currentstring .= '<'.$token->[1]; - } + $currentstring .= '<'.$token->[1]; foreach (keys %{$token->[2]}) { $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"'; } - if ($ENV{'request.state'} ne 'construct') { - $currentstring.='>'; - } - if ($ENV{'request.state'} ne 'published') { - my $remote=($ENV{'environment.remote'} ne 'off'); - $currentstring=&Apache::loncommon::bodytag(undef,undef, - $currentstring,$remote); + $currentstring.='>'; + &Apache::lontexconvert::jsMath_reset(); + if ($env{'environment.texengine'} eq 'jsMath') { + $currentstring.=&Apache::lontexconvert::jsMath_header(); + } + if ($env{'request.state'} ne 'published') { + if ($env{'environment.remote'} eq 'off') { + $currentstring.= + &Apache::lonmenu::constspaceform(). + &Apache::lonmenu::menubuttons(1,'web',1); + } $currentstring.=(<if ($target eq 'web') { - $currentstring = &Apache::lonxml::xmlend($target,$parser); + $currentstring .= &Apache::lonxml::xmlend($target,$parser); } elsif ($target eq 'tex') { - $currentstring = '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}'; + $currentstring .= '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}'; } return $currentstring; } @@ -576,11 +581,11 @@ sub end_body { #--
sub start_b {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web') {
$currentstring = $token->[4];
} elsif ($target eq 'tex') {
- $currentstring = '\textbf{';
+ &disable_para();
+ $currentstring .= '\textbf{';
}
return $currentstring;
}
@@ -614,18 +621,21 @@ sub end_b {
if ($target eq 'web') {
$currentstring = $token->[2];
} elsif ($target eq 'tex') {
- $currentstring = '}';
+ &enable_para();
+ $currentstring = '}';
}
return $currentstring;
}
#-- tag (end tag required)
+# NOTE: in TeX mode disables internal
sub start_strong {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web') {
$currentstring = $token->[4];
} elsif ($target eq 'tex') {
+ &disable_para();
$currentstring = '\textbf{';
}
return $currentstring;
@@ -637,6 +647,7 @@ sub end_strong {
if ($target eq 'web') {
$currentstring = $token->[2];
} elsif ($target eq 'tex') {
+ &enable_para();
$currentstring = '}';
}
return $currentstring;
@@ -645,7 +656,7 @@ sub end_strong {
#-- is a bit strange since it does not require a closing
+
+# Some tags are fragile meaning that inside of them
+# does not work within TeX mode. This is managed via the
+# counter below:
+#
+
+ my $para_disabled = 0;
+
+sub disable_para {
+ $para_disabled++;
+}
+sub enable_para {
+ $para_disabled--;
+}
+
+
#-- tag (end tag optional)
#optional attribute - align="center|left|right"
sub start_p {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
my $currentstring = '';
if ($target eq 'web') {
+ $currentstring .= &end_p(); # close off prior para if in progress.
$currentstring .= $token->[4];
- } elsif ($target eq 'tex') {
+ if (! ($currentstring =~ /\//)) {
+ $closing_string = ' does not work inside ...
- foreach my $tag (@$tagstack) {if (lc($tag) eq 'b') {$signal=0;}
- if (!$signal) {$currentstring = '';}
- }
+
}
return $currentstring;
}
-
+#
+# End paragraph processing just requires that we output the
+# closing string that was saved and blank it.
sub end_p {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
- if ($target eq 'web') {
- $currentstring .= $token->[2];
- } elsif ($target eq 'tex') {
- my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1);
- if (not defined $align) {
- $currentstring.='\strut\\\\\strut ';
- } elsif ($align eq 'center') {
- $currentstring .= '\end{center}';
- } elsif ($align eq 'right') {
- $currentstring .= '}}';
- } elsif ($align eq 'left') {
- $currentstring .= '}\hfill}';
- }
+ # Note only 'tex' mode uses disable_para and enable_para
+ # so we don't need to know the target in the check below:
+
+ if (!$para_disabled) {
+ my $current_string = $closing_string;
+ $closing_string = ''; # Not in a para anymore.
+ return $current_string;
+ } else {
+ return '';
}
- return $currentstring;
-}
+}
+}
#-- in the prior to the list.
if ($target eq 'web') {
- $currentstring = $token->[4];
+ $currentstring .= $token->[4];
} elsif ($target eq 'tex') {
- $currentstring = " \\begin{itemize} ";
+ $currentstring .= " \\begin{itemize} ";
}
return $currentstring;
}
@@ -1652,9 +1731,9 @@ sub end_dir {
#-- prior to the list.
if ($target eq 'web') {
- $currentstring = $token->[4];
+ $currentstring .= $token->[4];
} elsif ($target eq 'tex') {
$Apache::londefdef::list_index=0;
my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
@@ -1706,11 +1785,11 @@ sub end_ol {
#-- unclosed prior to the list.
if ($target eq 'web') {
- $currentstring = $token->[4];
+ $currentstring .= $token->[4];
} elsif ($target eq 'tex') {
- $currentstring = '\begin{description}';
+ $currentstring .= '\begin{description}';
$Apache::londefdef::DL++;
push(@Apache::londefdef::description,[]);
$Apache::londefdef::DD[$Apache::londefdef::DL]=0;
@@ -1813,19 +1892,25 @@ sub end_dd {
}
#-- that is not closed.
+# but, unless I allow 's to nest, that's the
+# only way I could think of to allow in
+# in the row.
if ($target eq 'web') {
- $currentstring = $token->[2];
+ $currentstring .= $token->[2];
} elsif ($target eq 'tex') {
if ($Apache::londefdef::TD_redirection) {
&end_td_tex($parstack,$parser,$safeeval);
@@ -2413,9 +2502,9 @@ sub end_th_tex {
sub end_th {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close any open in the row.
if ($target eq 'web') {
- $currentstring = $token->[2];
+ $currentstring .= $token->[2];
} elsif ($target eq 'tex') {
$Apache::londefdef::TD_redirection =0;
&end_th_tex($parstack,$parser,$safeeval);
@@ -2442,14 +2531,15 @@ sub start_img {
my $inside = &Apache::lonxml::get_all_text("/img",$parser);
return '';
}
- $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src;
+ push(@Apache::lonxml::extlinks,
+ &Apache::lonnet::clutter(&Apache::lonnet::hreflocation($Apache::lonxml::pwd[-1],$src)));
my $currentstring = '';
my $scaling = .3;
# Render unto browsers that which are the browser's...
if ($target eq 'web') {
- if ($ENV{'browser.imagesuppress'} ne 'on') {
+ if ($env{'browser.imagesuppress'} ne 'on') {
$currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
} else {
my $alttag= &Apache::lonxml::get_param
@@ -2475,7 +2565,11 @@ sub start_img {
$safeeval,
undef,1));
if(!$align) {
- $align = "bottom"; # This is html's default so it's ours too.
+ if (&is_inside_of($tagstack, "table")) {
+ $align = "right"; # Force wraptext use.
+ } else {
+ $align = "bottom"; # This is html's default so it's ours too.
+ }
}
#
&Apache::lonxml::debug("Alignemnt = $align");
@@ -2492,24 +2586,30 @@ sub start_img {
undef,0);
&Apache::lonxml::debug("LaTeX rendering = $latex_rendering");
if(!$latex_rendering) {
- $latex_rendering = "parbox";
+ $latex_rendering = "texwrap";
}
&Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src");
#if original gif/jpg/png file exist do following:
+ my $origsrc=$src;
my ($path,$file) = &get_eps_image($src);
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
&Apache::lonxml::debug("path = $path file = $file src = $src");
if (-e $src) {
&Apache::lonxml::debug("$src exists");
my ($height_param,$width_param)=
- &image_size($src,0.3,$parstack,$safeeval);
+ &image_size($origsrc,0.3,$parstack,$safeeval);
my $destpath = $path;
$destpath =~ s/ /\_/g; # Spaces in path cause LaTex to vomit.
my $destfile = $file;
$destfile =~ s/ /\_/g;
+ my $size;
+ if ($width_param) { $size.='width='.$width_param.' mm,'; }
+ if ($height_param) { $size.='height='.$height_param.' mm]'; }
+ $size='['.$size;
+ $size=~s/,$/]/;
$currentstring .= '\graphicspath{{'.$destpath.'}}'
- .'\includegraphics[width='.$width_param.' mm,height='.$height_param.'mm]{'.$destfile.'} ';
+ .'\includegraphics'.$size.'{'.$destfile.'} ';
# If there's an alignment specification we need to honor it here.
# For the horizontal alignments, we will also honor the
@@ -2527,16 +2627,17 @@ sub start_img {
} elsif ($align eq "left") {
if ($latex_rendering eq "parpic") {
$currentstring = '\parpic[l]{'.$currentstring.'}';
- } else { # parbox rendering
- $currentstring = "\\strut\\newline\n".
- '\parbox{'.$width_param.'mm}{'.$currentstring.'}';
+ } else { # wrapfig render
+ $currentstring = '\begin{wrapfigure}{l}{'.$width_param.'mm}'
+ .'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}';
}
} elsif ($align eq "right") {
if ($latex_rendering eq "parpic") {
$currentstring = '\parpic[r]{'.$currentstring.'}';
- } else { # parbox rendering.
- $currentstring = '\parbox{'.$width_param.'mm}{\begin{flushright}'
- .$currentstring.'\end{flushright}} \newline'."\n";
+ } else { # wrapfig rendering
+ $currentstring = '\begin{wrapfigure}{r}{'.$width_param.'mm}'
+ .'\scalebox{1.0}{'.$currentstring.'}\end{wrapfigure}';
+
}
} else { # Bottom is also default.
# $currentstring = '\raisebox{'.$height_param.'mm}{'.$currentstring.'}';
@@ -2649,7 +2750,7 @@ sub start_applet {
my $currentstring = '';
if ($target eq 'web') {
- if ($ENV{'browser.appletsuppress'} ne 'on') {
+ if ($env{'browser.appletsuppress'} ne 'on') {
$currentstring = &Apache::lonenc::encrypt_ref($token,
{'code'=>$code,
'archive'=>$archive}
@@ -2695,7 +2796,7 @@ sub start_embed {
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src;
my $currentstring = '';
if ($target eq 'web') {
- if ($ENV{'browser.embedsuppress'} ne 'on') {
+ if ($env{'browser.embedsuppress'} ne 'on') {
$currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
} else {
my $alttag=&Apache::lonxml::get_param
@@ -2788,10 +2889,10 @@ sub end_allow {
#-- tag (end tag required)
sub start_h1 {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off any prior para.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -660,9 +671,9 @@ sub start_h1 {
}
my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval,undef,0);
if (not defined $TeXsize) {$TeXsize="large";}
- $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';
+ $currentstring .= '\strut\newline '.$pre.'{\\'.$TeXsize.' \textbf{';
} elsif ($target eq 'meta') {
- $currentstring='
tag
sub start_h2 {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off any prior para.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -709,7 +720,7 @@ sub start_h2 {
}
my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval,undef,0);
if (not defined $TeXsize) {$TeXsize="large";}
- $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';
+ $currentstring .= '\strut\newline '.$pre.'{\\'.$TeXsize.' \textbf{';
}
return $currentstring;
}
@@ -737,7 +748,7 @@ sub end_h2 {
#--
tag
sub start_h3 {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off any prior para.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -752,7 +763,7 @@ sub start_h3 {
}
my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval,undef,0);
if (not defined $TeXsize) {$TeXsize="large";}
- $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';
+ $currentstring .= '\strut\newline '.$pre.'{\\'.$TeXsize.' \textbf{';
}
return $currentstring;
}
@@ -780,7 +791,7 @@ sub end_h3 {
#--
tag
sub start_h4 {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off any prior para.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -795,7 +806,7 @@ sub start_h4 {
}
my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval,undef,0);
if (not defined $TeXsize) {$TeXsize="large";}
- $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';
+ $currentstring .= '\strut\newline '.$pre.'{\\'.$TeXsize.' \textbf{';
}
return $currentstring;
}
@@ -823,7 +834,7 @@ sub end_h4 {
#--
tag
sub start_h5 {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off any prior paras.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -838,7 +849,7 @@ sub start_h5 {
}
my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval,undef,0);
if (not defined $TeXsize) {$TeXsize="large";}
- $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';
+ $currentstring .= '\strut\newline '.$pre.'{\\'.$TeXsize.' \textbf{';
}
return $currentstring;
}
@@ -866,7 +877,7 @@ sub end_h5 {
#--
tag
sub start_h6 {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off any prior paras.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -881,7 +892,7 @@ sub start_h6 {
}
my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval,undef,0);
if (not defined $TeXsize) {$TeXsize="large";}
- $currentstring .= $pre.'{\\'.$TeXsize.' \textbf{';
+ $currentstring .= '\strut\newline '.$pre.'{\\'.$TeXsize.' \textbf{';
}
return $currentstring;
}
@@ -1113,52 +1124,80 @@ sub end_q {
return $currentstring;
}
+#
tag (end tag forbidden)
sub start_br {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
@@ -1168,6 +1207,9 @@ sub start_br {
} elsif ($target eq 'tex') {
my @tempo=@$tagstack;
my $signal=0;
+ # Not going to factor this to is_inside_of since that would require
+ # multiple stack traversals.
+ #
for (my $i=$#tempo;$i>=0;$i--) {
if (($tempo[$i] eq 'b') || ($tempo[$i] eq 'strong') ||
($tempo[$i] eq 'ol') || ($tempo[$i] eq 'ul') ||
@@ -1276,8 +1318,8 @@ sub start_font {
if ($target eq 'web') {
my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);
if ($face!~/symbol/i) {
- if (($ENV{'browser.fontenhance'} eq 'on') ||
- ($ENV{'browser.blackwhite'} eq 'on')) { return ''; }
+ if (($env{'browser.fontenhance'} eq 'on') ||
+ ($env{'browser.blackwhite'} eq 'on')) { return ''; }
}
$currentstring = $token->[4];
} elsif ($target eq 'tex') {
@@ -1404,7 +1446,7 @@ sub end_sup {
#--
tag (end tag forbidden)
sub start_hr {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # End enclosing para.
if ($target eq 'web') {
$currentstring .= $token->[4];
} elsif ($target eq 'tex') {
@@ -1442,12 +1484,44 @@ sub end_hr {
}
#-- tag (end tag required)
sub start_ul {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # Close off enclosing list.
if ($target eq 'web') {
- $currentstring = $token->[4];
+ $currentstring .= $token->[4];
} elsif ($target eq 'tex') {
my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0);
$Apache::londefdef::list_index=0;
@@ -1629,11 +1708,11 @@ sub end_menu {
#--
tag (end tag required)
sub start_ol {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # In case there's a
tag (end tag required)
sub start_dl {
my ($target,$token) = @_;
- my $currentstring = '';
+ my $currentstring = &end_p(); # In case there's a
tag (end tag required)
+#
also ends any prior
bodies
+#
#list of supported attributes: border,width,TeXwidth
sub start_table {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- my ($textwidth,$currentstring)=('','');
+ my $textwidth = '';
+ my $currentstring = &end_p();
if ($target eq 'web') {
- $currentstring = $token->[4];
+ $currentstring .= $token->[4];
} elsif ($target eq 'tex') {
my $aa = {};
push @Apache::londefdef::table, $aa;
$Apache::londefdef::table[-1]{'row_number'} = -1;
#maximum table's width (default coincides with text line length)
if ($#Apache::londefdef::table==0) {
- $textwidth=&recalc($ENV{'form.textwidth'}); #result is always in mm
+ $textwidth=&recalc($env{'form.textwidth'}); #result is always in mm
$textwidth=~/(\d+\.?\d*)/;
$textwidth=0.95*$1; #accounts "internal" LaTeX space for table frame
} else {
@@ -1872,7 +1957,9 @@ sub start_table {
$Apache::londefdef::table[-1]{'vvinc'} = '';
}
if ($#Apache::londefdef::table==0) {
- $Apache::londefdef::table[-1]{'output'}='\strut\newline\strut\setlength{\tabcolsep}{1 mm}';
+ # Note that \newline seems to destroy the alignment envs.
+ # $Apache::londefdef::table[-1]{'output'}='\strut\newline\strut\setlength{\tabcolsep}{1 mm}';
+ $Apache::londefdef::table[-1]{'output'}='\strut'.'\\\\'."\n".'\strut\setlength{\tabcolsep}{1 mm}';
}
$Apache::londefdef::table[-1]{'output'}.=' \noindent \begin{tabular} ';
$Apache::londefdef::table[-1]{'TeXlen'}=[];
@@ -1882,7 +1969,7 @@ sub start_table {
$Apache::londefdef::table[-1]{'minlen'}=[];
$Apache::londefdef::table[-1]{'content'}=[];
$Apache::londefdef::table[-1]{'align'}=[];
- $currentstring='\keephidden{NEW TABLE ENTRY}';
+ $currentstring.='\keephidden{NEW TABLE ENTRY}';
}
return $currentstring;
}
@@ -2095,7 +2182,9 @@ sub end_table {
}
$output.=' \\\\ '.$Apache::londefdef::table[-1]{'hinc'}.' ';
}
- $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut\newline\strut ';
+ # Note that \newline destroys alignment env's produced by e.g.