[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 11 Jul 2006 09:44:04 -0000


foxr		Tue Jul 11 05:44:04 2006 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Correct order of substitutions for LaTeX special chars.
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.414 loncom/xml/lonxml.pm:1.415
--- loncom/xml/lonxml.pm:1.414	Mon Jul  3 06:34:30 2006
+++ loncom/xml/lonxml.pm	Tue Jul 11 05:44:04 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.414 2006/07/03 10:34:30 foxr Exp $
+# $Id: lonxml.pm,v 1.415 2006/07/11 09:44:04 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -367,13 +367,13 @@
     }
     if ($where eq 'header') {
 	$string =~ s/\\/\$\\backslash\$/g; # \  -> $\backslash$ per LaTex line by line pg  10.
-	$string =~ s/_/\\_/g;              # _ -> \_
-	$string =~ s/\^/\\\^{}/g;          # ^ -> \^{} 
 	$string =~ s/(\$|%|\{|\})/\\$1/g;
 	$string=&Apache::lonprintout::character_chart($string);
 	# any & or # leftover should be safe to just escape
         $string=~s/([^\\])\&/$1\\\&/g;
         $string=~s/([^\\])\#/$1\\\#/g;
+	$string =~ s/_/\\_/g;              # _ -> \_
+	$string =~ s/\^/\\\^{}/g;          # ^ -> \^{} 
     } else {
 	$string=~s/\\/\\ensuremath{\\backslash}/g;
 	$string=~s/\\\%|\%/\\\%/g;