I'm exporting an Org Mode project both to LaTeX and to HTML (with MatJax). Now I need to add a TikZ picture which can be exported nativelly on LaTeX and must be rendered in svg for HTML.
Writing the TikZ env in Org directly works for LaTeX and even for HTML with dvipng/dvisvg, but not with MatJax:
#some org
\begin{tikzpicture}
% some tikz
\end{tikzpicture}
# some org
I tried embedding that in a LaTeX
special block:
#some org
#+BEGIN_LaTeX
\begin{tikzpicture}
% some tikz
\end{tikzpicture}
#+END_LaTeX
# some org
but the result was the same. (BTW I read this syntax is now deprecated)
I tried with a babel block:
;; without this the tikz env is exported as verbatim code
(org-babel-do-load-languages 'org-babel-load-languages '((latex . t)))
#some org
#+BEGIN_SRC latex :file myfile.svg :imagemagick :results (if (org-export-derived-backend-p org-export-current-backend 'latex) "latex" "file")
\begin{tikzpicture}
% some tikz
\end{tikzpicture}
#+END_SRC
# some org
and in this case it ignores the header: it tries to export to a temporary pdf file, regardless of the options of file
and results
. I tried also with the #+header:
syntax.