[LON-CAPA-cvs] cvs: doc /help texxml2latex.pl

bowersj2 lon-capa-cvs@mail.lon-capa.org
Mon, 21 Jul 2003 15:22:14 -0000


bowersj2		Mon Jul 21 11:22:14 2003 EDT

  Modified files:              
    /doc/help	texxml2latex.pl 
  Log:
  Filter out extraneous \labels and \indexes added by pod2latex.
  
  
Index: doc/help/texxml2latex.pl
diff -u doc/help/texxml2latex.pl:1.6 doc/help/texxml2latex.pl:1.7
--- doc/help/texxml2latex.pl:1.6	Fri Jul 18 16:58:33 2003
+++ doc/help/texxml2latex.pl	Mon Jul 21 11:22:14 2003
@@ -96,7 +96,14 @@
 	    system ("echo > $tmpdir/$tempfile; cat $file | podselect $section >> $tmpdir/$tempfile; cd $tmpdir; pod2latex -h1level 2 $tempfile");
 	    my $latexFile = substr($tempfile, 0, rindex($tempfile, '.')) . '.tex';
 	    open LATEX_FILE, $tmpdir . '/' . $latexFile;
-	    print <LATEX_FILE>;
+	    # pod2latex inserts \labels and \indexs for every section,
+	    # which is horrible because the section names tend to get
+	    # reused a lot. This filters those out, so we need to do
+	    # create our own indexes.
+	    for (<LATEX_FILE>) {
+		$_ =~ s/\\([^{]*)section(\*?)\{([^\\]+)\\label\{[^\\]+\}\\index\{([^\\]+)\}\}/\\\1section\2\{\3\}/g;
+		print $_;
+	    }
 	    print "\n\n";
 	}
     }