From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Fischmeister Subject: Re: Annotating org exporters Date: Wed, 11 May 2016 01:31:09 -0400 Message-ID: <874ma5qivl.fsf@uwaterloo.ca> References: <87futqvwy6.fsf@uwaterloo.ca> <87lh3indnl.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> Reply-To: sfischme@uwaterloo.ca Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Mjw-0004rK-9x for emacs-orgmode@gnu.org; Wed, 11 May 2016 01:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0Mjr-0008JY-2h for emacs-orgmode@gnu.org; Wed, 11 May 2016 01:31:20 -0400 Received: from mailservices.uwaterloo.ca ([129.97.128.141]:50444 helo=mailchk-m01.uwaterloo.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0Mjq-0008JN-Gj for emacs-orgmode@gnu.org; Wed, 11 May 2016 01:31:15 -0400 In-Reply-To: <87lh3indnl.fsf@aquinas.i-did-not-set--mail-host-address--so-tickle-me> 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" To: Richard Lawrence , emacs-orgmode@gnu.org Hi Richard, > There's an example of how to do something like this in the "Advanced > Configuration" section of the Export section in the manual. Maybe you > could adapt it like this? > > (defun my-latex-filter-rightarrow (text backend info) > (when (org-export-derived-backend-p backend 'latex) > (replace-regexp-in-string "=>" "$\rightarrow$" text))) > > (add-to-list 'org-export-filter-plain-text-functions > 'my-latex-filter-rightarrow) That works very well. Thank you very much. The only adjustment is to set LITERAL to non-nil for replace-regexp-in-string and use double backslash. (defun my-latex-filter-rightarrow (text backend info) (when (org-export-derived-backend-p backend 'latex) (replace-regexp-in-string "=>" "$\\rightarrow$" text nil t))) I'm still undecided between a regex replace and org-entities. Is there a straightforward way to define own directives for orgmode to then support something like the following? #+LaTeX_EXPORT: "=>":"$\rightarrow$" or more generic #+EXPORT_EXPAND: latex:"=>":"$\rightarrow$" Then I could just make these expansions part of the standard header in my org files. Sebastian