[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
foxr
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 06 Apr 2007 10:23:46 -0000
foxr Fri Apr 6 06:23:46 2007 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
Fix width calculation for tables... not the best fix but at present
I don't understand what the intent was and I think the original author
may have been clever enough to confuse himself too.
- Fix consists of forcing table widths to always believe they are calculating
percentage of full line width.. since
o that seems to work.
o If a TeXwidth="aa%" is specified the absolute width is calculated
and scaling is evidently done correctly anyway.
- This is hopefully in response to the last gasps of BZ 4967
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.361 loncom/xml/londefdef.pm:1.362
--- loncom/xml/londefdef.pm:1.361 Thu Mar 22 18:34:23 2007
+++ loncom/xml/londefdef.pm Fri Apr 6 06:23:46 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.361 2007/03/22 22:34:23 foxr Exp $
+# $Id: londefdef.pm,v 1.362 2007/04/06 10:23:46 foxr Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -1987,12 +1987,19 @@
}
} else {
$Apache::londefdef::table[-1]{'forcedtablewidth'} = 1;
- }
+ }
+ # This stuff looks a bit hokey..
+ # Percentage width is actually given as an absolute width..
+ # but it appears that unless the 'percent' flag is set,
+ # The table is just allowed to go to its natural width
+ # for now let's always claim 'percent' is set..
+ #
if ($TeXwidth=~/%/) {
$Apache::londefdef::table[-1]{'percent'}=1;
$TeXwidth=~/(\d+)/;
$Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100;
} else {
+ $Apache::londefdef::table[-1]{'percent'} = 1; # kludge until we get the intent.
$Apache::londefdef::table[-1]{'width'}=$TeXwidth;
}
# In the end, however the table width cannot be wider than $textwidth...
@@ -2000,7 +2007,6 @@
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);
@@ -2141,6 +2147,7 @@
$space_neeeded=$space_neeeded+$max_len[$jn];
}
if ($space_neeeded<=$available_space) {
+
for (my $jn=0;$jn<=$#max_len;$jn++) {
if ($fwidth[$jn]==0) {
$fwidth[$jn]=$max_len[$jn];