[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Mon, 31 Jul 2006 22:19:21 -0000
foxr Mon Jul 31 18:19:21 2006 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Made the left margin value really the left margin value rather than relative
to 1.0 in. as per Felicia's suggestion in bug 4878
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.469 loncom/interface/lonprintout.pm:1.470
--- loncom/interface/lonprintout.pm:1.469 Mon Jul 31 06:32:00 2006
+++ loncom/interface/lonprintout.pm Mon Jul 31 18:19:21 2006
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.469 2006/07/31 10:32:00 foxr Exp $
+# $Id: lonprintout.pm,v 1.470 2006/07/31 22:19:21 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3030,9 +3030,16 @@
}
}
- $result .= <<ELEMENTHTML;
+ # Adjust margin for LaTeX margin: .. requires units == cm or in.
+ if ($size{'margin_unit'} eq 'in') {
+ $size{'margin'} += 1;
+ } else {
+ $size{'margin'} += 2.54;
+ }
+ $result .= <<ELEMENTHTML;
+
<p>How should each column be formatted?</p>
@@ -3074,7 +3081,7 @@
return $result;
}
-# If the user didn't select 1 column, skip this state.
+
sub preprocess {
my $self = shift;
my $helper = Apache::lonhelper::getHelper();
@@ -3107,7 +3114,7 @@
foreach my $dim ('width', 'height', 'lmargin') {
my ($value, $units) = split(/ /, $size{$dim});
-
+
&Apache::lonnet::logthis("$dim : $value : $units");
$helper->{VARS}->{"$var.".$dim} = $value;
@@ -3149,6 +3156,14 @@
}
if ($lmargin !~ /^-?[0-9]*(\.[0-9]*)?$/) {
$error .= "Invalid left margin; please type only a number.<br />\n";
+ } else {
+ # Adjust for LaTeX 1.0 inch margin:
+
+ if ($env{"form.${var}.lmarginunit"} eq "in") {
+ $helper->{VARS}->{$var.'.lmargin'} = $lmargin - 1;
+ } else {
+ $helper->{VARS}->{$var.'.lmargin'} = $lmargin - 2.54;
+ }
}
if (!$error) {