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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 04 Aug 2004 18:18:41 -0000


sakharuk		Wed Aug  4 14:18:41 2004 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Bug 3266 (A4 printing fails to work properly) is fixed. Continue to work on other formats.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.318 loncom/interface/lonprintout.pm:1.319
--- loncom/interface/lonprintout.pm:1.318	Wed Jul 28 15:07:16 2004
+++ loncom/interface/lonprintout.pm	Wed Aug  4 14:18:40 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.318 2004/07/28 19:07:16 albertel Exp $
+# $Id: lonprintout.pm,v 1.319 2004/08/04 18:18:40 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -422,14 +422,16 @@
 	if ($layout eq 'book') {
 	    if ($numberofcolumns == 1) {
 		$textwidth = '176 mm';
-		$textheight = '254 mm';
+		$textheight = '272 mm';
 		$oddoffset = '-0.57 in';
 		$evenoffset = '-0.57 in';
+		$topmargin = '-0.5 in';
 	    } elsif ($numberofcolumns == 2) {
 		$textwidth = '91 mm';
-		$textheight = '254 mm';
+		$textheight = '272 mm';
 		$oddoffset = '-0.57 in';
 		$evenoffset = '-0.57 in';
+		$topmargin = '-0.5 in';
 	    }
 	} elsif ($layout eq 'album') {
 	    if ($numberofcolumns eq '1') {
@@ -483,15 +485,19 @@
     my $name = &get_name();
     my $courseidinfo = &get_course();
     if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
+    my $topmargintoinsert = '';
+    if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}
     if ($layout eq 'album') {
-	my $topmargintoinsert = '';
-	if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}
 	    $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}} \\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1} /;
     } 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 $topmargintoinsert\\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 $topmargintoinsert\\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 /;
+	}
+	if ($papersize eq '6') {
+	    $text =~ s/(\\begin{document})/$1\\special{papersize=210mm,297mm}/;
 	}
     }
     if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;}