Roger Mason <rma...@mun.ca> writes: > On 09/05/2013 04:15 PM, Nicolas Goaziou wrote: >> #+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 > That got rid of the verbatim output. Thanks. > > Unfortunately the replacement of \includegraphics... by \marginpar... > still does not work: > > #+CAPTION: Acicular > [[../images/acicular.eps]] > > produces > > \begin{figure}[htb] > \centering > \includegraphics[width=.9\linewidth]{../images/acicular.eps} > \caption{Acicular} > \end{figure}
In this case, you need to remove "\\`" from your regexp. Regards, -- Nicolas Goaziou