[LON-CAPA-cvs] cvs: loncom /interface printout.pl

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 26 Jun 2006 10:11:49 -0000


foxr		Mon Jun 26 06:11:49 2006 EDT

  Modified files:              
    /loncom/interface	printout.pl 
  Log:
  1. Only do the necessary latex's during repagination (not sure.. may be able
     to remove the makeindex prior to repag.).
  2. ensure that \pagebreak really does make a 'blank' page by adding the text
     'this page left intentionally blank'.  Otherwise seems like latex would
     glom multiple \pagebreaks together if the page was blank??
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.104 loncom/interface/printout.pl:1.105
--- loncom/interface/printout.pl:1.104	Tue Jun 20 05:39:47 2006
+++ loncom/interface/printout.pl	Mon Jun 26 06:11:48 2006
@@ -487,16 +487,28 @@
 	      &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
 				 "for $status_statement first latex to repaginate",
 				 \%prog_state, $name_file);
-	      &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
-				 "for $status_statement second latex to repaginate",
-				 \%prog_state, $name_file);
-	      &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
-				 "for $status_statement third latex to repaginate",
-				 \%prog_state, $name_file);
+	      if ($tableofcontents eq 'yes') {
+		  &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
+				     "for $status_statement second latex to repaginate",
+				     \%prog_state, $name_file);
+		  &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
+				     "for $status_statement third latex to repaginate",
+				     \%prog_state, $name_file);
+	      }
+	      if ($tableofindex eq 'yes') {
+		  my $idxname = $latex_file;
+		  $idxname =~ s/\.tex$/\.idx/;
+		  &busy_wait_command("makindex $idxname",
+				     "Re-creating index file",
+				     \%prog_state, $idxname);
+		  &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
+				     "for $status_statement now Recreting index (latex)",
+				     \%prog_state, $dvi_file);
+
+	      }
 	      &busy_wait_command("$comma $name_file 1>dev/null 2>/dev/null",
 				 "for $status_statement dvips to repaginate",
 				 \%prog_state, $new_name_file);
-
 	      print "\n<h1>PDF output file (see link below)</h1>\n";
 	      $new_name_file =~ m/^(.*)\./;
 	      my $ps_file = my $tempo_file = $1.'temporar.ps';
@@ -577,12 +589,24 @@
 	      &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
 				 "for $status_statement first latex to repaginate",
 				 \%prog_state, $name_file);
-	      &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
-				 "for $status_statement second latex to repaginate",
-				 \%prog_state, $name_file);
-	      &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
-				 "for $status_statement third latex to repaginate",
-				 \%prog_state, $name_file);
+	      if ($tableofcontents eq 'yes') {
+		  &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
+				     "for $status_statement second latex to repaginate",
+				     \%prog_state, $name_file);
+		  &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
+				     "for $status_statement third latex to repaginate",
+				     \%prog_state, $name_file);
+	      }
+	      if ($tableofindex eq 'yes') {
+		  my $idxname = $latex_file;
+		  $idxname    =~ s/\.tex$/\.idx/;
+		  &busy_wait_command("makeindex $idxname",
+				     "Re-creating index file",
+				     \%prog_state, $idxname);
+		  &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null",
+				     "for $status_statement now Recreting index (latex)",
+				     \%prog_state, $dvi_file);
+	      }
 	      &busy_wait_command("$comma $name_file 1>/dev/null 2>/dev/null",
 				 "for $status_statement dvips to repaginate",
 				 \%prog_state, $new_name_file);
@@ -808,7 +832,8 @@
 	    my $addlines = $max_pages - $pages_in_student[$student_number];
 	    &Apache::lonnet::logthis("student: $pages_in_student[$student_number] add: $addlines");
 	    while($addlines)  {
-		print LATEXOUT '\pagebreak';
+		print LATEXOUT '\linebreak This page left intentionally blank \pagebreak';
+
 		$addlines--;
 	    }