[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 19 Jun 2003 15:04:31 -0000


sakharuk		Thu Jun 19 11:04:31 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Corrected a stupid own bug: I used from the very beginning only integer numbers for the size of the text line on the page (in mm). This was the sourse of unpredictable behavior of table's width - Ed guessed this was brauser dependible. Now everything looks more or less correct though I need somehow to take into account "internal" space for the table elements. I am working with this. But even now you have a powerful possibility to print your table in a reasonablway - you just need to specify width of cells (in only one raw) using TeXwidth="N mm/cm/in" attribute in <td> or <th>.                                      
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.189 loncom/interface/lonprintout.pm:1.190
--- loncom/interface/lonprintout.pm:1.189	Thu Jun 19 10:54:51 2003
+++ loncom/interface/lonprintout.pm	Thu Jun 19 11:04:30 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.189 2003/06/19 14:54:51 bowersj2 Exp $
+# $Id: lonprintout.pm,v 1.190 2003/06/19 15:04:30 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -328,13 +328,13 @@
     if ($papersize eq '0') {
 	if ($layout eq 'book') {
 	    if ($numberofcolumns == 1) {
-		$textwidth = '18 cm';
-		$textheight = '25.9 cm';
+		$textwidth = '7.1 in';      #'18 cm';
+		$textheight = '10.2 in';    #'25.9 cm';
 		$oddoffset = '-0.57 in';
 		$evenoffset = '-0.57 in';
 	    } elsif ($numberofcolumns == 2) {
-		$textwidth = '93 mm';
-		$textheight = '25.9 cm';
+		$textwidth = '3.66 in';     #'93 mm';
+		$textheight = '10.2 in';    #'25.9 cm';
 		$oddoffset = '-0.57 in';
 		$evenoffset = '-0.57 in';
 	    }
@@ -419,10 +419,9 @@
 	    $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$name}} \\hfill  $courseidinfo} \\vskip 5 mm /;
     } elsif ($layout eq 'book') {
 	if ($choice ne 'All class print') { 
-		$text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} - $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/;
+	    $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} - $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/;
 	} else {
-	    $text =~ s/\\pagestyle{fancy}\\rhead{}\\chead{}\s*\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\begin{document}\\voffset=-0\.8cm\\setcounter{page}{1}  \\vskip 5 mm /;
-
+	    $text =~ s/\\pagestyle{fancy}\\rhead{}\\chead{}\s*\\begin{document}/\\textheight = $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\begin{document}\\voffset=-0\.8cm\\setcounter{page}{1}  \\vskip 5 mm /;
 	}
     }
     return $text;
@@ -525,11 +524,11 @@
     my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$laystyle,$numberofcolumns);
     my $assignment =  $ENV{'form.assignment'};
     my $LaTeXwidth; 
-    if ($textwidth=~/(\d+)\s*cm/) {
+    if ($textwidth=~/(\d+\.?\d*)\s*cm/) {
 	$LaTeXwidth = $1*10;
-    } elsif ($textwidth=~/(\d+)\s*mm/) {
+    } elsif ($textwidth=~/(\d+\.?\d*)\s*mm/) {
 	$LaTeXwidth = $1;
-    } elsif ($textwidth=~/(\d+)\s*in/) {
+    } elsif ($textwidth=~/(\d+\.?\d*)\s*in/) {
 	$LaTeXwidth = $1*25.4;
     }
     $LaTeXwidth.=' mm';
@@ -748,8 +747,8 @@
 #-------------------------------------------------------- corrections for the different page formats
     $result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'});
     $result = &latex_corrections($number_of_columns,$result);
-#    #changes page's parameters for the one column output 
-#    if ($ENV{'form.numberofcolumns'} == 1) {
+    #changes page's parameters for the one column output 
+#    if ($numberofcolumns == 1) {
 #	$result =~ s/\\textwidth= 9cm/\\textwidth= $ENV{'form.width'}/;
 #	$result =~ s/\\textheight 25\.9cm/\\textheight $ENV{'form.height'}/;
 #	$result =~ s/\\evensidemargin = -0\.57in/\\evensidemargin= $ENV{'form.leftmargin'}/;
@@ -799,12 +798,6 @@
 #	return OK;
 
     my %parmhash=&Apache::lonnet::coursedescription($ENV{'request.course.id'});
-#    $r->print('<br /> START '.$ENV{'request.course.fn'}.' FINISH <br />');
-#    my $key; 
-#    foreach $key (keys %parmhash) {
-#	$r->print(' '.$key.'->'.$parmhash{$key}.'<-<br />');
-#    }
-#    return OK;
     
 
     &output_data($r,$helper,\%parmhash);