--- loncom/xml/londefdef.pm 2007/04/06 10:33:37 1.363 +++ loncom/xml/londefdef.pm 2007/04/06 10:41:45 1.364 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.363 2007/04/06 10:33:37 foxr Exp $ +# $Id: londefdef.pm,v 1.364 2007/04/06 10:41:45 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -1985,19 +1985,14 @@ sub start_table { } else { $TeXwidth = $textwidth; } - } else { - $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1; - } - # This stuff looks a bit hokey.. - # Percentage width is actually given as an absolute width.. - # so what's the difference? - # + } + # if the width is specified as a % it is converted to an absolute width. + # otherwise.. just plugged right in the hash + if ($TeXwidth=~/%/) { - $Apache::londefdef::table[-1]{'percent'}=1; $TeXwidth=~/(\d+)/; $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; } else { - $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1; # may or may not need this? $Apache::londefdef::table[-1]{'width'}=$TeXwidth; } # In the end, however the table width cannot be wider than $textwidth... @@ -2229,16 +2224,16 @@ sub end_table { } } } - #use all available width if it is defined in % or as TeXwidth - if (($Apache::londefdef::table[-1]{'percent'}==1) || ($Apache::londefdef::table[-1]{'forcedtablewidth'}==1)) { - my $current=0; - for (my $i=0;$i<=$#fwidth;$i++) { - $current+=$fwidth[$i]; - } - my $coef=$Apache::londefdef::table[-1]{'width'}/$current; - for (my $i=0;$i<=$#fwidth;$i++) { - $fwidth[$i]*=$coef; - } + # use all available width or specified width as if not specified, + # the specified width gets defaulted to the available width. + + my $current=0; + for (my $i=0;$i<=$#fwidth;$i++) { + $current+=$fwidth[$i]; + } + my $coef=$Apache::londefdef::table[-1]{'width'}/$current; + for (my $i=0;$i<=$#fwidth;$i++) { + $fwidth[$i]*=$coef; } #removing of empty columns if allowed my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0);