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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 25 Feb 2005 06:42:36 -0000


albertel		Fri Feb 25 01:42:36 2005 EDT

  Modified files:              
    /loncom/xml/algebra	AlgParser.pm 
  Log:
  - no uch thing as \sech \csch and \coth
  
  
Index: loncom/xml/algebra/AlgParser.pm
diff -u loncom/xml/algebra/AlgParser.pm:1.11 loncom/xml/algebra/AlgParser.pm:1.12
--- loncom/xml/algebra/AlgParser.pm:1.11	Fri Feb 25 01:31:00 2005
+++ loncom/xml/algebra/AlgParser.pm	Fri Feb 25 01:42:35 2005
@@ -606,7 +606,11 @@
 	      return ('\log_{10}'. $p1 . $args[1]->tolatex() . $p2);
 	  }
 	  elsif (defined($2)) {
-	      return ('\\' . $2.$3 .'^{-1}'. $p1 . $args[1]->tolatex() . $p2);
+	      if (defined($3) && ($2 eq 'sec' || $2 eq 'csc' || $2 eq 'cot')) {
+		  return ('\mathrm{' . $2.$3 .'}^{-1}'. $p1 . $args[1]->tolatex() . $p2);
+	      } else {
+		  return ('\\' . $2.$3 .'^{-1}'. $p1 . $args[1]->tolatex() . $p2);
+	      }
 	  }
 	  elsif (defined($4)) {
 	      return ('|' . $args[1]->tolatex() . '|');
@@ -616,7 +620,11 @@
 	  }
       }
       else {
-        return ('\\' . $args[0] . $p1 . $args[1]->tolatex() . $p2);
+	  if ($args[0] =~/(sec|csc|cot)h/) {
+	      return ('\mathrm{' . $args[0] . '}' . $p1 . $args[1]->tolatex() . $p2);
+	  } else {
+	      return ('\\' . $args[0] . $p1 . $args[1]->tolatex() . $p2);
+	  }
       }
   };
   /special/ && do {