From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Filter not working (org 8.0.3) Date: Thu, 05 Sep 2013 20:45:50 +0200 Message-ID: <8761uf150h.fsf@gmail.com> References: <5228A8DF.5010704@mun.ca> <87y57bp7gv.fsf@gmail.com> <5228B9EB.10909@mun.ca> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHeYp-0007E3-TZ for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 14:45:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHeYj-0000vK-D4 for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 14:45:43 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:56331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHeYj-0000vE-5W for emacs-orgmode@gnu.org; Thu, 05 Sep 2013 14:45:37 -0400 Received: by mail-wi0-f172.google.com with SMTP id c10so6659767wiw.17 for ; Thu, 05 Sep 2013 11:45:36 -0700 (PDT) In-Reply-To: <5228B9EB.10909@mun.ca> (Roger Mason's message of "Thu, 05 Sep 2013 14:35:47 -0230") 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: Roger Mason Cc: org-mode Roger Mason writes: > Unfortunately, :exports both does not make any difference. Looking at > the generated LaTeX file I see that it contains: > > \begin{verbatim} > (defun margin-graphics (contents backend info) > (when (eq backend 'latex) > (replace-regexp-in-string "\\`\\\\includegraphics.+\\({.+}\\)" > "\\\\marginpar{\\\\includegraphics[width=0.9\\\\marginparwidth]\\1} " > contents))) > > (add-to-list 'org-export-filter-link-functions 'margin-graphics) > \end{verbatim} > > which seems odd. It is to be expected since ":exports both" is meant to leave source code behind. Anyway, the following works for me (I had to tweak your regexp): --8<---------------cut here---------------start------------->8--- #+LATEX_HEADER: \usepackage[right=2in,left=0.5in]{geometry} #+LATEX_HEADER: \usepackage{parskip} * Setup :noexport: #+BEGIN_SRC emacs-lisp :exports both (defun margin-graphics (contents backend info) (when (eq backend 'latex) (replace-regexp-in-string "\\`\\\\includegraphics.*?\\({.+}\\)" "\\\\marginpar{\\\\includegraphics[width=0.9\\\\marginparwidth]\\1} " contents))) (add-to-list (make-local-variable 'org-export-filter-link-functions) 'margin-graphics) #+END_SRC * Document [[file:~/Documents/work/2-data/images/2-echantillonnage-1-fluctuations-fig1.png]] --8<---------------cut here---------------end--------------->8--- I suggest to use `make-local-variable' to keep global filters list clean. Regards, -- Nicolas Goaziou