The caption, label and attr_latex lines will be applied to the named result. #+CAPTION: my great picture #+LABEL: fig:my_picture #+ATTR_LaTeX: #+results: mypicture [[file:fig/mypicture.pdf]] This code block may be anywhere in the Org-mode file the result will always be placed at the named results line above. #+srcname: mypicture #+begin_src latex :file fig/mypicture.pdf :packages '(("" "tikz")) :border 1em :fit :results raw \begin{tikzpicture}[line width=1pt,text centered, inner sep = 2] \draw[fill=red!50] (0,0) rectangle ++(5,1); \draw[fill=yellow!50] (1,1) rectangle ++(1,0.25); \draw[fill=yellow!50] (3,1) rectangle ++(1,0.25); \draw[fill=green!50] (0.75,1) rectangle ++(1.5,-0.4); \draw[fill=green!50] (2.75,1) rectangle ++(1.5,-0.4); \end{scope} \end{tikzpicture} #+end_src