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.
This commit is contained in:
Nicolas Goaziou 2013-05-12 09:56:26 +02:00
parent 7e4c7edb8a
commit bffc94c0b1
1 changed files with 6 additions and 2 deletions

View File

@ -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 "-%$#&{}^_\\" "%$#&{}^_\\")))