--- loncom/xml/londefdef.pm 2011/04/05 10:02:57 1.428 +++ loncom/xml/londefdef.pm 2011/04/05 10:33:15 1.429 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.428 2011/04/05 10:02:57 foxr Exp $ +# $Id: londefdef.pm,v 1.429 2011/04/05 10:33:15 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -2107,88 +2107,6 @@ sub start_table { push(@Apache::londefdef::table, $table); $currentstring.=' \keephidden{NEW TABLE ENTRY}'; - #-------------------------------------------------------- - # Old table code here. - #-------------------------------------------------------- - - - if (0) { - push(@Apache::londefdef::table, {}); - $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=~/(\d+\.?\d*)/; - $textwidth=0.85*$1; #accounts "internal" LaTeX space for table frame - } else { - if ($Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]=~/\d/) { - #the maximum width of nested table is determined by LATeX width of parent cell - $textwidth=$Apache::londefdef::table[-2]{'TeXlen'}[$Apache::londefdef::table[-2]{'row_number'}][$Apache::londefdef::table[-2]{'counter_columns'}]; - } else { - #try to use all space not used before (minus 5% for LaTeX table internal) - rather silly - $textwidth=$Apache::londefdef::table[-2]{'width'}; - for (my $i=0;$i<$Apache::londefdef::table[-2]{'counter_columns'};$i++) { - $textwidth=$textwidth-$Apache::londefdef::table[-2]{'TeXlen'}[0][$i]; - } - } - } - - # width either comes forced from the TeXwidth or the width parameters. - # in either case it can be a percentage or absolute width. - # in the width case we ignore absolute width - my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); - if (!defined($TeXwidth)) { - my $htmlwidth = &Apache::lonxml::get_param('width',$parstack, - $safeeval,undef,1); - if ($htmlwidth =~ /%/) { - $TeXwidth = $htmlwidth; - } else { - $TeXwidth = $textwidth; - } - } - # if the width is specified as a % it is converted to an absolute width. - # otherwise.. just plugged right in the hash - - if ($TeXwidth=~/%/) { - $TeXwidth=~/(\d+)/; - $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; - } else { - $Apache::londefdef::table[-1]{'width'}=$TeXwidth; - } - # In the end, however the table width cannot be wider than $textwidth... - - if ($Apache::londefdef::table[-1]{'width'} > $textwidth) { - $Apache::londefdef::table[-1]{'width'} = $textwidth; - } - #table's border - my $border = &Apache::lonxml::get_param('border',$parstack,$safeeval); - my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0); - unless (defined $border) { $border = 0; } - if ($border) { - $Apache::londefdef::table[-1]{'hinc'} = '\hline '; - $Apache::londefdef::table[-1]{'vinc'} = '&'; - $Apache::londefdef::table[-1]{'vvinc'} = '|'; - } else { - $Apache::londefdef::table[-1]{'hinc'} = ''; - $Apache::londefdef::table[-1]{'vinc'} = '&'; - $Apache::londefdef::table[-1]{'vvinc'} = ''; - } - if ($#Apache::londefdef::table==0) { - # 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'}=[]; - $Apache::londefdef::table[-1]{'objectlen'}=[]; - $Apache::londefdef::table[-1]{'objectsignal'}=[]; - $Apache::londefdef::table[-1]{'maxlen'}=[]; - $Apache::londefdef::table[-1]{'minlen'}=[]; - $Apache::londefdef::table[-1]{'content'}=[]; - $Apache::londefdef::table[-1]{'align'}=[]; - $currentstring.=' \keephidden{NEW TABLE ENTRY}'; - } - } return $currentstring; } @@ -2201,8 +2119,6 @@ sub end_table { } elsif ($target eq 'tex') { - # New table code: - my $table = pop(@Apache::londefdef::table); my $t = $table->generate(); # &Apache::lonnet::logthis("Generating string");