1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-29 07:58:21 +00:00

LaTeX export: Fix problem with subscripts in emphasis

Eric Fraga sent this test file:

> * Problem with underscore (subscript) in emphasised text.
>   1. Design for CO_2 capture.
>   2. The paper /Design for CO_2 capture/ is very interesting.
>   3. This item is combined with the previous and the previous is
>      actually formatted wrongly.
>   4. This item seems to come out just fine.
This commit is contained in:
Carsten Dominik 2009-11-09 20:51:28 +01:00
parent 45191cd220
commit 1c142da592

View File

@ -1469,7 +1469,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
org-export-latex-emphasis-alist))
(beg (match-beginning 0))
(end (match-end 0))
rpl)
rpl s)
(unless emph
(message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\""
(match-string 3)))
@ -1482,12 +1482,20 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(and (org-at-table-p)
(string-match
"[|\n]" (buffer-substring beg end))))))
(setq s (match-string 4))
(setq rpl (concat (match-string 1)
(org-export-latex-emph-format (cadr emph)
(match-string 4))
(match-string 5)))
(if (caddr emph)
(setq rpl (org-export-latex-protect-string rpl)))
(setq rpl (org-export-latex-protect-string rpl))
(save-match-data
(if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).\\'" rpl)
(progn
(add-text-properties (match-beginning 1) (match-end 1)
'(org-protected t) rpl)
(add-text-properties (match-beginning 3) (match-end 3)
'(org-protected t) rpl)))))
(replace-match rpl t t)))
(backward-char)))
@ -1520,8 +1528,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(setq char (or (cdr (assoc char trans)) (concat "\\" char))
rtn (concat rtn char)))
(setq string (concat rtn string) format "\\texttt{%s}")))))
(setq string (org-export-latex-protect-string
(format format string))))
(format format string))
(defun org-export-latex-links ()
;; Make sure to use the LaTeX hyperref and graphicx package