mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 22:32:51 +00:00
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.
This commit is contained in:
parent
6caddbca05
commit
fa3b4830b8
|
@ -2031,18 +2031,22 @@ TEXT is the string to transcode. INFO is a plist holding
|
||||||
contextual information."
|
contextual information."
|
||||||
(let ((specialp (plist-get info :with-special-strings))
|
(let ((specialp (plist-get info :with-special-strings))
|
||||||
(output text))
|
(output text))
|
||||||
;; Protect %, #, &, $, ~, ^, _, { and }.
|
;; Protect %, #, &, $, ^, _, { and }.
|
||||||
(while (string-match "\\([^\\]\\|^\\)\\([%$#&{}~^_]\\)" output)
|
(while (string-match "\\([^\\]\\|^\\)\\([%$#&{}^_]\\)" output)
|
||||||
(setq output
|
(setq output
|
||||||
(replace-match
|
(replace-match
|
||||||
(format "\\%s" (match-string 2 output)) nil t output 2)))
|
(format "\\%s" (match-string 2 output)) nil t output 2)))
|
||||||
;; Protect \. If special strings are used, be careful not to
|
;; Protect \. If special strings are used, be careful not to
|
||||||
;; protect "\" in "\-" constructs.
|
;; protect "\" in "\-" constructs.
|
||||||
(let ((symbols (if specialp "-%$#&{}~^_\\" "%$#&{}~^_\\")))
|
(let ((symbols (if specialp "-%$#&{}^_\\" "%$#&{}^_\\")))
|
||||||
(setq output
|
(setq output
|
||||||
(replace-regexp-in-string
|
(replace-regexp-in-string
|
||||||
(format "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%s]\\|$\\)" symbols)
|
(format "\\(?:[^\\]\\|^\\)\\(\\\\\\)\\(?:[^%s]\\|$\\)" symbols)
|
||||||
"$\\backslash$" output nil t 1)))
|
"$\\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
|
;; Activate smart quotes. Be sure to provide original TEXT string
|
||||||
;; since OUTPUT may have been modified.
|
;; since OUTPUT may have been modified.
|
||||||
(when (plist-get info :with-smart-quotes)
|
(when (plist-get info :with-smart-quotes)
|
||||||
|
|
Loading…
Reference in a new issue