On 2016-03-08 11:33, Alan Schmitt writes: > Thank you for the suggestion. At the moment I use a macro (because I > need to put the resulting figure in a figure environment, as I want a > label and caption), but I will give this a try. I'm fairly happy with what I ended up doing (using a macro as I need to pass some extra arguments, and I don't know how to extend a source block with custom arguments), so here is my solution. I define this utility function that is lob-ingested: #+name: wrap-res #+BEGIN_SRC emacs-lisp :var link="" :var caption="" :var label="" :results raw :exports none (concat "#+LABEL: " label "\n#+CAPTION: " caption "\n" link) #+END_SRC I also define a macro (it's on one line but for this email I'm wrapping it) #+macro: tikzfig #+header: :file (by-backend (latex "$1.tikz") (t "$1.png")) :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 300 :results file raw :fit yes :headers '("\\usepackage{tikz}") :post wrap-res(link=*this*,label="fig:$1",caption="$2") I can then have the following that is exported both in tikz and png (I do not use svg as I found htlatex lacking for text nodes): {{{tikzfig(cnf-example,An ordinal in Cantor normal form)}}} #+begin_src latex \begin{tikzpicture}[scale=2, every node/.style={transform shape}] \node[color=blue]{$\omega^{(\omega^\omega\,+\, \omega^2 \times 8 \,+\, \omega)}+ \omega^\omega + \omega^4+ 6$}; \end{tikzpicture} #+end_src The first argument of the macro is the label of the figure (with "fig:" added automatically) as well as the file used to export the figure, the second argument is the caption. Hopefully this may be useful to others. Best, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO₂ (2016-02, Mauna Loa Obs.): 404.02