* 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. --- 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 8727adc..af7e11e 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2031,8 +2031,8 @@ 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))) @@ -2043,6 +2043,10 @@ contextual information." (replace-regexp-in-string (format "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%s]\\|$\\)" symbols) "$\\backslash$" output nil t 1))) + ;; Protect ~ + (while (string-match "\\([^\\]\\|^\\)\\(~\\)" output) + (setq output + (replace-match "\\textasciitilde{}" nil t output 2))) ;; Activate smart quotes. Be sure to provide original TEXT string ;; since OUTPUT may have been modified. (when (plist-get info :with-smart-quotes) -- 1.8.2