org-e-latex: Don't use mathrm in sub/superscripts with a single LaTeX command or entity

* contrib/lisp/org-e-latex.el (org-e-latex-subscript,
  org-e-latex-superscript): Don't use mathrm in sub/superscripts with
  a single LaTeX command or entity.
This commit is contained in:
Nicolas Goaziou 2012-07-18 17:02:08 +02:00
parent 8769f9d014
commit d80661e764

View file

@ -2151,7 +2151,14 @@ holding contextual information."
"Transcode a SUBSCRIPT object from Org to LaTeX.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
(format (if (= (length contents) 1) "$_%s$" "$_{\\mathrm{%s}}$") contents))
(format (if (or (= (length contents) 1)
(let ((parsed-contents (org-element-contents subscript)))
(and (not (cdr parsed-contents))
(memq (org-element-type (car parsed-contents))
'(entity latex-fragment)))))
"$_%s$"
"$_{\\mathrm{%s}}$")
contents))
;;;; Superscript
@ -2160,7 +2167,14 @@ contextual information."
"Transcode a SUPERSCRIPT object from Org to LaTeX.
CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
(format (if (= (length contents) 1) "$^%s$" "$^{\\mathrm{%s}}$") contents))
(format (if (or (= (length contents) 1)
(let ((parsed-contents (org-element-contents superscript)))
(and (not (cdr parsed-contents))
(memq (org-element-type (car parsed-contents))
'(entity latex-fragment)))))
"$^%s$"
"$^{\\mathrm{%s}}$")
contents))
;;;; Table