* [PATCH] Protect active characters such as `~' when exporting to LaTeX
@ 2015-01-16 14:58 Sebastien Vauban
2015-01-16 16:42 ` Nick Dokos
2015-01-16 17:12 ` Aaron Ecay
0 siblings, 2 replies; 3+ messages in thread
From: Sebastien Vauban @ 2015-01-16 14:58 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
[-- Attachment #1: Type: text/plain, Size: 393 bytes --]
Hello,
When ~code~ is converted to LaTeX, it becomes \verb~code~; i.e., it uses
a potentially "dangerous" character, in this case `~' which is active.
In most cases, it is unnoticeable, but in some environments, it breaks.
The solution is to protect the command, what the attached patch does.
PS- Nicolas, can you apply this one without problem?
Best regards,
Seb
--
Sebastien Vauban
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Protect-active-characters-such-as.patch --]
[-- Type: text/x-patch, Size: 1143 bytes --]
From e5a6525898a41a4e4381c46575f7c54e8a367700 Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
Date: Fri, 16 Jan 2015 15:53:40 +0100
Subject: [PATCH] Protect active characters such as `~'
---
lisp/ox-latex.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 66cc6c2..cb6d75c 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1,6 +1,6 @@
;;; ox-latex.el --- LaTeX Back-End for Org Export Engine
-;; Copyright (C) 2011-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2015 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
;; Keywords: outlines, hypermedia, calendar, wp
@@ -1122,7 +1122,7 @@ INFO is a plist used as a communication channel. See
;; and use "\\verb" command.
((eq 'verb fmt)
(let ((separator (org-latex--find-verb-separator text)))
- (concat "\\verb" separator
+ (concat "\\protect\\verb" separator
(replace-regexp-in-string "\n" " " text)
separator)))
;; Handle the `protectedtexttt' special case: Protect some
--
2.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Protect active characters such as `~' when exporting to LaTeX
2015-01-16 14:58 [PATCH] Protect active characters such as `~' when exporting to LaTeX Sebastien Vauban
@ 2015-01-16 16:42 ` Nick Dokos
2015-01-16 17:12 ` Aaron Ecay
1 sibling, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2015-01-16 16:42 UTC (permalink / raw)
To: emacs-orgmode
Sebastien Vauban <sva-news@mygooglest.com>
writes:
> Hello,
>
> When ~code~ is converted to LaTeX, it becomes \verb~code~; i.e., it uses
> a potentially "dangerous" character, in this case `~' which is active.
>
> In most cases, it is unnoticeable, but in some environments, it breaks.
>
> The solution is to protect the command, what the attached patch does.
>
I'm not sure it solves the problem. I had looked at this problem five
years ago and had concluded that \protect was a bust, because \verb is
special - see
http://thread.gmane.org/gmane.emacs.orgmode/14256/focus=14257
Maybe I got it wrong back then, but I thought I'd bring it to your
attention.
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Protect active characters such as `~' when exporting to LaTeX
2015-01-16 14:58 [PATCH] Protect active characters such as `~' when exporting to LaTeX Sebastien Vauban
2015-01-16 16:42 ` Nick Dokos
@ 2015-01-16 17:12 ` Aaron Ecay
1 sibling, 0 replies; 3+ messages in thread
From: Aaron Ecay @ 2015-01-16 17:12 UTC (permalink / raw)
To: Sebastien Vauban, emacs-orgmode
Hi Sebastien,
2015ko urtarrilak 16an, Sebastien Vauban-ek idatzi zuen:
>
> Hello,
>
> When ~code~ is converted to LaTeX, it becomes \verb~code~; i.e., it uses
> a potentially "dangerous" character, in this case `~' which is active.
>
> In most cases, it is unnoticeable, but in some environments, it breaks.
>
> The solution is to protect the command, what the attached patch does.
If this is the problem, would a simpler solution be to remove ~ (and other
special characters, like #^_$) from ‘org-latex--find-verb-separator’?
But as Nick points out, the problem with \verb is probably deeper. The
protectedtexttt case in ox-latex already implements the suggestion from
the thread he linked. Perhaps the solution is to change the code entry
in ‘org-latex-text-markup-alist’ to use protectedtexttt and drop the
verb case entirely from ‘org-latex--text-markup’. What do you think?
Thanks,
--
Aaron Ecay
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-16 17:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 14:58 [PATCH] Protect active characters such as `~' when exporting to LaTeX Sebastien Vauban
2015-01-16 16:42 ` Nick Dokos
2015-01-16 17:12 ` Aaron Ecay
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).