From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [PATCH] Properly escape ~ for LaTeX export Date: Sun, 31 Mar 2013 22:21:09 -0400 Message-ID: <1364782869-2049-1-git-send-email-aaronecay@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMUN3-00063m-8D for emacs-orgmode@gnu.org; Sun, 31 Mar 2013 22:21:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMUN2-0006wc-0H for emacs-orgmode@gnu.org; Sun, 31 Mar 2013 22:21:17 -0400 Received: from mail-qc0-x235.google.com ([2607:f8b0:400d:c01::235]:62105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMUN1-0006wY-SC for emacs-orgmode@gnu.org; Sun, 31 Mar 2013 22:21:15 -0400 Received: by mail-qc0-f181.google.com with SMTP id a22so879083qcs.40 for ; Sun, 31 Mar 2013 19:21:15 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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