emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Properly escape ~ for LaTeX export
@ 2013-04-01  2:21 Aaron Ecay
  2013-04-01  7:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Ecay @ 2013-04-01  2:21 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Properly escape ~ for LaTeX export
  2013-04-01  2:21 [PATCH] Properly escape ~ for LaTeX export Aaron Ecay
@ 2013-04-01  7:56 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2013-04-01  7:56 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

Hello,

Aaron Ecay <aaronecay@gmail.com> writes:

> * lisp/ox-latex.el:
> (org-latex-plain-text): Properly escape ~ for LaTeX export

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-01  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-01  2:21 [PATCH] Properly escape ~ for LaTeX export Aaron Ecay
2013-04-01  7:56 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).