emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Filter not working (org 8.0.3)


From: Nicolas Goaziou
Subject: Re: [O] Filter not working (org 8.0.3)
Date: Thu, 05 Sep 2013 20:45:50 +0200

Roger Mason <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]