Hi Eric et al., I now have a system I am happy with mostly for using LaTeX code blocks heading to multiple export targets. The solution I am using is a combination of what has been discussed in this thread (by-backend customisation of headers for babel) and using noweb substitution for the main content. I have two LaTeX babel source blocks, one for PDF export and the other for HTML export. Each of these has a tikzpicture environment which then includes the actual instructions for drawing brought in using noweb.
The problem I have remaining is how to get the version used to export to PDF via LaTeX to use a figure environment with captioning. I had thought that something along these lines would work: #+begin_src org ,#+name: picturecontents ,#+begin_src latex :noweb yes :exports none \node[red!50!black] (a) {A}; \node (b) [right of=a] {B}; \draw[->] (a) -- (b); ,#+end_src ,#+name: flowdiagram ,#+header: :exports (if (and (boundp 'backend) (eq (org-export-backend-name backend) (intern "latex"))) "results" "none") ,#+header: :results latex ,#+header: :noweb yes ,#+begin_src latex \begin{tikzpicture} <<picturecontents>> \end{tikzpicture} ,#+end_src ,#+caption: Testing figure caption for figure going to multiple destinations ,#+results: flowdiagram #+end_src as I expected the export to put the results of the flowdiagram code block after the results line. This doesn't work: the exported LaTeX has no figure environment etc. The diagram does come out but it is placed directly into the document. I hope this all makes sense? Any suggestions? thanks, eric -- : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.5-337-g9f3bed