summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ecay <aaronecay@gmail.com>2013-03-31 22:21:09 -0400
committerNicolas Goaziou <n.goaziou@gmail.com>2013-04-01 09:55:07 +0200
commitfa3b4830b8443f24b8aa5e91f78fe5dd078871a7 (patch)
treeb0ee79ab2c871d713104af7b53495c0ace3984b5
parent6caddbca052399f3f46c94e49c983b2ebceebc81 (diff)
downloadorg-mode-fa3b4830b8443f24b8aa5e91f78fe5dd078871a7.tar.gz
ox-latex: Properly escape ~ for export
* lisp/ox-latex.el: (org-latex-plain-text): Properly escape ~ for LaTeX export In LaTeX, \~ gives a tilde diacritic (as in ã). \textasciitilde{} is the correct escape for a tilde.
-rw-r--r--lisp/ox-latex.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 8727adc..f6897f9 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2031,18 +2031,22 @@ 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 \. If special strings are used, be careful not to
;; protect "\" in "\-" constructs.
- (let ((symbols (if specialp "-%$#&{}~^_\\" "%$#&{}~^_\\")))
+ (let ((symbols (if specialp "-%$#&{}^_\\" "%$#&{}^_\\")))
(setq output
(replace-regexp-in-string
(format "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%s]\\|$\\)" symbols)
"$\\backslash$" output nil t 1)))
+ ;; Protect ~.
+ (setq output
+ (replace-regexp-in-string
+ "\\([^\\]\\|^\\)\\(~\\)" "\\textasciitilde{}" output nil t 2))
;; Activate smart quotes. Be sure to provide original TEXT string
;; since OUTPUT may have been modified.
(when (plist-get info :with-smart-quotes)