Browse Source

ox-latex: Use \text command for subscript and superscript

* lisp/ox-latex.el (org-latex--script-size): Use \text command for
  subscript and superscript.  This is far superior to \mathrm, but it
  requires "amstext" package.  In particular, accented characters are
  now allowed within sub/superscript.
* lisp/org.el (org-latex-default-packages-alist): Add "amstext"
  package.
Nicolas Goaziou 4 years ago
parent
commit
99f8821995
2 changed files with 3 additions and 6 deletions
  1. 2 0
      lisp/org.el
  2. 1 6
      lisp/ox-latex.el

+ 2 - 0
lisp/org.el

@@ -3810,6 +3810,7 @@ header, or they will be appended."
     (""     "wasysym"   t)
     (""     "latexsym"  t)
     (""     "amssymb"   t)
+    (""     "amstext"   nil)
     (""     "hyperref"  nil)
     "\\tolerance=1000")
   "Alist of default packages to be inserted in the header.
@@ -3821,6 +3822,7 @@ The packages in this list are needed by one part or another of
 Org mode to function properly:
 
 - inputenc, fontenc:  for basic font and character selection
+- amstext: for subscript and superscript
 - textcomp, marvosymb, wasysym, latexsym, amssym: for various
   symbols used for interpreting the entities in `org-entities'.
   You can skip some of these packages if you don't use any of the

+ 1 - 6
lisp/ox-latex.el

@@ -2232,12 +2232,7 @@ channel."
 			     (and blank (> blank 0) "\\ "))))))
 	  (plain-text
 	   (setq output
-		 (format "%s\\mathrm{%s}"
-			 output
-			 ;; \mathrm command doesn't handle spaces, so
-			 ;; we have to enforce them.
-			 (replace-regexp-in-string
-			  " " "\\\\ " (org-export-data obj info)))))
+		 (format "%s\\text{%s}" output (org-export-data obj info))))
 	  (otherwise
 	   (setq output
 		 (concat output