Eric S Fraga writes: > On Friday, 28 Sep 2018 at 11:39, Christian Moe wrote: >> Hi, >> >> I am trying to generate a PNG file with a TikZ picture from a LaTeX src >> block, looking at instructions here: >> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html >> >> I try this: >> >> #+header: :file "tikzpic.png" :fit yes :results raw file :exports results :headers '("\\usepackage{tikz}") >> #+begin_src latex >> \begin{tikzpicture} >> \draw [fill=green] (0,4) -- (3,0) -- (-3,0) -- cycle; >> \end{tikzpicture} >> #+end_src It seems that the function `org-babel-execute:latex' ignores the property :headers under certain circumstances. Therefore the line "\usepackage{tikz}" will be missing in your resulting latex document. The property is not ignored if you also append the property ":imagemagick t" to the #+header line. So you can use the following header as a fix (for another fix, see below): #+header: :file "tikzpic.png" :fit yes :results raw file :exports results :headers '("\\usepackage{tikz}") :imagemagick t I've drafted a patch that fixes the issue. I would appreciate if some maintainer could have a look and comment, or apply the patch: