Browse Source

Fix sub/superscript issues in LaTeX export.

Carsten Dominik 16 years ago
parent
commit
25b227e5ca
2 changed files with 12 additions and 5 deletions
  1. 4 0
      lisp/ChangeLog
  2. 8 5
      lisp/org-export-latex.el

+ 4 - 0
lisp/ChangeLog

@@ -1,5 +1,9 @@
 2008-10-17  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-export-latex.el (org-export-latex-treat-sub-super-char):
+	Honor the {} value of the subsuperscript setting.  Make sure that
+	longer subsuperscripts are typeset in a roman font.
+
 	* org.el (org-clock-update-time-maybe): Compute negative clock
 	intervals correctly.
 

+ 8 - 5
lisp/org-export-latex.el

@@ -940,12 +940,15 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
 			  ((string-match "[({]?\\([^)}]+\\)[)}]?" string-after)
 			   (format "%s%s{%s}" string-before char
 				   (match-string 1 string-after))))))
-	       ((and subsup
-		     (> (length string-after) 1)
+	       ((and (> (length string-after) 1)
+		     (or (eq subsup t)
+			 (and (equal subsup '{}) (eq (string-to-char string-after) ?\{)))
 		     (string-match "[({]?\\([^)}]+\\)[)}]?" string-after))
-		(format "$%s%s{%s}$" string-before char
-			(match-string 1 string-after)))
-	       (subsup (concat "$" string-before char string-after "$"))
+		(format "%s$%s{%s}$" string-before char
+			(if (> (match-end 1) (1+ (match-beginning 1)))
+			    (concat "\\mathrm{" (match-string 1 string-after) "}")
+			(match-string 1 string-after))))
+	       ((eq subsup t) (concat string-before "$" char string-after "$"))
 	       (t (org-export-latex-protect-string
 		   (concat string-before "\\" char "{}" string-after)))))
 	(t (org-export-latex-protect-string