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

foxr lon-capa-cvs-allow@mail.lon-capa.org
Fri, 20 Apr 2007 20:33:36 -0000


foxr		Fri Apr 20 16:33:36 2007 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Removing the page_format_transformation and other page junk helps
  printing of raw LaTeX resources quite a bit.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.498 loncom/interface/lonprintout.pm:1.499
--- loncom/interface/lonprintout.pm:1.498	Fri Apr 20 16:13:58 2007
+++ loncom/interface/lonprintout.pm	Fri Apr 20 16:33:35 2007
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.498 2007/04/20 20:13:58 foxr Exp $
+# $Id: lonprintout.pm,v 1.499 2007/04/20 20:33:35 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1293,6 +1293,7 @@
     my ($r,$helper,$rparmhash) = @_;
     my %parmhash = %$rparmhash;
     $resources_printed = '';
+    my $do_postprocessing = 1;
     my $js = <<ENDPART;
 <script type="text/javascript">
     var editbrowser;
@@ -1489,6 +1490,7 @@
 	    #
 
 	    $result = &fetch_raw_resource($currentURL);
+	    $do_postprocessing = 0; # Don't massage the result.
 
 	} else {
 	    $result.=&unsupported($currentURL,$helper->{'VARS'}->{'LATEX_TYPE'},
@@ -1894,15 +1896,20 @@
 	$result .= '\end{document}';      	
     }
 #-------------------------------------------------------- corrections for the different page formats
-    $result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade);
-    $result = &latex_corrections($number_of_columns,$result,$selectionmade,
-				 $helper->{'VARS'}->{'ANSWER_TYPE'});
-    #if ($numberofcolumns == 1) {
+
+    # Only post process if that has not been turned off e.g. by a raw latex resource.
+
+    if ($do_postprocessing) {
+	$result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade);
+	$result = &latex_corrections($number_of_columns,$result,$selectionmade,
+				     $helper->{'VARS'}->{'ANSWER_TYPE'});
+	#if ($numberofcolumns == 1) {
 	$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
 	$result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
 	$result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
 	$result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
-    #}
+	#}
+    }
 
 #-- writing .tex file in prtspool 
     my $temp_file;