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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 05 Mar 2003 16:28:04 -0000


sakharuk		Wed Mar  5 11:28:04 2003 EDT

  Modified files:              
    /loncom/interface	printout.pl 
  Log:
  Exact (or more correctly almost exact) "pointer" to the problem where LaTeX error was occured is shows up on the screen. Added one more LaTeX error indication (one of the most frequent errors).
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.21 loncom/interface/printout.pl:1.22
--- loncom/interface/printout.pl:1.21	Wed Sep 18 14:42:57 2002
+++ loncom/interface/printout.pl	Wed Mar  5 11:28:04 2003
@@ -57,12 +57,17 @@
   my $body_log_file = join(' ',@content_of_file); 
   if ($body_log_file=~m/!\s+Emergency stop/) {
       #LaTeX failed to parse tex file 
-      print "<h1>LaTeX could not successfully parse your tex file.</h1>";
-      print "<h2>It probably has errors in it.</h2>";
-      print "Here are the error messages in the LaTeX log file</br>";
+      print "<h2>LaTeX could not successfully parse your tex file.</h2>";
+      print "It probably has errors in it.<br />";
+      my $whereitbegins = rindex $body_log_file,'STAMPOFPASSEDRESOURCESTART';
+      my $whereitends = rindex $body_log_file,'STAMPOFPASSEDRESOURCEEND';
+      if ($whereitbegins!=-1 and $whereitends!=-1) {
+	print "With very high probability this error occured in ".substr($body_log_file,$whereitbegins+26,$whereitends-$whereitbegins-26)."<br /><br />";
+      }
+      print "Here are the error messages in the LaTeX log file</br><br />";
       my $sygnal = 0;
       for (my $i=0;$i<=$#content_of_file;$i++) {
-	  if ($content_of_file[$i]=~m/^!/) {
+          if ($content_of_file[$i]=~m/^Runaway argument?/ or $content_of_file[$i]=~m/^!/) {
 	      $sygnal = 1;
 	  } 
 	  if ($content_of_file[$i]=~m/Here is how much of/) {
@@ -84,7 +89,7 @@
 	  $new_name_file =~ m/^(.*)\./;
 	  my $tempo_file = $1.'temporar.ps';
 	  my $name_file = $1.'.pdf';
-	  if ($laystyle eq 'album') {
+	  if ($laystyle eq 'album' and $numberofcolumns eq '2') {
 	      $comma = "psnup -2 -s1.0 $new_name_file";
 	      system("$comma $tempo_file"); 
 	      system("ps2pdf $tempo_file $name_file");
@@ -104,7 +109,7 @@
 	  $texdvi =~ s/\.tex/\.dvi/;
 	  $texps =~ s/\.tex/\.ps/;
 	  my @garb = ($texlog,$texaux,$texdvi,$texps);
-	  unlink @garb;
+#	  unlink @garb;
 	  unlink $duefile;
 	  print "<a href=\"/prtspool/$name_file\">Your PDF document</a>";
 	  print "\n";