emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Greg Minshall <minshall@umich.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: LaTeX-export: letters after $..$ turn off math-mode
Date: Fri, 15 Feb 2013 23:04:56 +0100	[thread overview]
Message-ID: <87mwv58c8n.fsf@bzg.ath.cx> (raw)
In-Reply-To: <85272.1359978716@greg-minshalls-mbp.local> (Greg Minshall's message of "Mon, 04 Feb 2013 06:51:56 -0500")

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

Hi Greg,

Greg Minshall <minshall@umich.edu> writes:

> i'd like to plead the case of allowing the user to suppress dollar-sign
> behavior (or, force dollar-signs to mean math-mode).

I'm attaching a patch that introduces `org-latex-escape-chars' which
would allow you to bind it to something different for each buffer --
e.g., without the dollar sign.

Nicolas, let me know if this looks okay for you.

Thanks,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ox-latex-escape-char.patch --]
[-- Type: text/x-patch, Size: 1098 bytes --]

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9d5b5c5..805eeb7 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -510,6 +510,14 @@ default we use here encompasses both."
   :group 'org-export-latex
   :type 'string)
 
+(defcustom org-latex-escape-chars "%$#&{}~^_"
+  "Characters to escape.
+Each character in this string will be escaped.
+E.g., _ will be escaped into \_."
+  :group 'org-export-latex
+  :version "24.3"
+  :type 'string)
+
 
 ;;;; Tables
 
@@ -1942,8 +1950,11 @@ 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 characters from `org-latex-escape-chars', i.e.,
+    ;; %, #, &, $, ~, ^, _, { and } by default.
+    (while (string-match
+	    (concat "\\([^\\]\\|^\\)\\([" org-latex-escape-chars "]\\)")
+	    output)
       (setq output
 	    (replace-match
 	     (format "\\%s" (match-string 2 output)) nil t output 2)))

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2013-02-15 22:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 11:51 LaTeX-export: letters after $..$ turn off math-mode Greg Minshall
2013-02-15 22:04 ` Bastien [this message]
2013-02-16  7:25   ` Nicolas Goaziou
2013-02-16 11:48     ` Nicolas Goaziou
2013-02-16 16:33       ` Nick Dokos
2013-02-16 16:45         ` Nick Dokos
2013-02-16 14:32     ` Bastien
2013-02-16 15:26       ` Rasmus
  -- strict thread matches above, loose matches on Subject: below --
2012-02-06 18:32 Daniel Schoepe
2012-02-06 19:23 ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwv58c8n.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=minshall@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).