From bffc94c0b19481199691d302a79acc233be334ef Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 12 May 2013 09:56:26 +0200 Subject: [PATCH] ox-latex: Fix regular caret protection * lisp/ox-latex.el (org-latex-plain-text): Protect ^ char with \^{}, not only \^, so it doesn't become a diacritic. --- lisp/ox-latex.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 66eefa112..41cf1d0d7 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1917,11 +1917,15 @@ TEXT is the string to transcode. INFO is a plist holding contextual information." (let ((specialp (plist-get info :with-special-strings)) (output text)) - ;; Protect %, #, &, $, ^, _, { and }. - (while (string-match "\\([^\\]\\|^\\)\\([%$#&{}^_]\\)" output) + ;; Protect %, #, &, $, _, { and }. + (while (string-match "\\([^\\]\\|^\\)\\([%$#&{}_]\\)" output) (setq output (replace-match (format "\\%s" (match-string 2 output)) nil t output 2))) + ;; Protect ^. + (setq output + (replace-regexp-in-string + "\\([^\\]\\|^\\)\\(\\^\\)" "\\\\^{}" output nil nil 2)) ;; Protect \. If special strings are used, be careful not to ;; protect "\" in "\-" constructs. (let ((symbols (if specialp "-%$#&{}^_\\" "%$#&{}^_\\"))) -- 2.11.4.GIT