From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: LaTeX-export: letters after $..$ turn off math-mode Date: Fri, 15 Feb 2013 23:04:56 +0100 Message-ID: <87mwv58c8n.fsf@bzg.ath.cx> References: <85272.1359978716@greg-minshalls-mbp.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6TOu-0006QF-8I for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 17:05:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6TOt-0002D0-70 for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 17:05:00 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6TOs-0002Cs-Uo for emacs-orgmode@gnu.org; Fri, 15 Feb 2013 17:04:59 -0500 Received: by mail-wi0-f172.google.com with SMTP id ez12so1689452wid.17 for ; Fri, 15 Feb 2013 14:04:58 -0800 (PST) In-Reply-To: <85272.1359978716@greg-minshalls-mbp.local> (Greg Minshall's message of "Mon, 04 Feb 2013 06:51:56 -0500") 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: Greg Minshall Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Greg, Greg Minshall 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, --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ox-latex-escape-char.patch 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))) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--