[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Tue, 13 Mar 2007 13:35:40 -0000
foxr Tue Mar 13 09:35:40 2007 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
Correct table widths. The original frame correction was not sufficient.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.357 loncom/xml/londefdef.pm:1.358
--- loncom/xml/londefdef.pm:1.357 Fri Mar 9 12:10:33 2007
+++ loncom/xml/londefdef.pm Tue Mar 13 09:35:39 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.357 2007/03/09 17:10:33 foxr Exp $
+# $Id: londefdef.pm,v 1.358 2007/03/13 13:35:39 foxr Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -1925,7 +1925,7 @@
if ($#Apache::londefdef::table==0) {
$textwidth=&recalc($env{'form.textwidth'}); #result is always in mm
$textwidth=~/(\d+\.?\d*)/;
- $textwidth=0.95*$1; #accounts "internal" LaTeX space for table frame
+ $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
@@ -2028,6 +2028,7 @@
$available_space=$available_space-$Apache::londefdef::table[-1]{'TeXlen'}[0][$jn];
}
}
+
#boundaries for contents columns
my @min_len=();#columns can not be narrower
my @max_len=();#maximum length of column
@@ -2219,6 +2220,16 @@
$Apache::londefdef::table[-1]{'content'}=\@cleaned_table;
@fwidth=@cleaned_header;
}
+ # At this time we must be sure the table does not overhang the total width
+ # this can happen due to our 'average width' adjustment.
+ # Total the column widths and see if they are larger than the avail width;
+ # If so scale them down in proportion to their percentage of total width.
+
+ my $current_total_width = 0;
+ for (my $col = 0; $col < $#fwidth; $col++) {
+ $current_total_width = $current_total_width + $fwidth[$col];
+ }
+
#construct header of the table
my $header_of_table = '{'.$Apache::londefdef::table[-1]{'vvinc'};
for (my $in=0;$in<=$#fwidth;$in++) {