From d80661e76452201e0c822b920e90a5af5d88d1e0 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 18 Jul 2012 17:02:08 +0200 Subject: [PATCH] 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. --- contrib/lisp/org-e-latex.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 20ea186cf..736be263c 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -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