1

I am trying to create a SVG image from latex code in an org-mode file.

#+name: foo
#+header: :file foo.svg
#+begin_src latex
bar
#+end_src

But I keep getting the following error:

executing Latex code block (foo)...
org-babel-execute:latex: HTML file produced but SVG file requested

On the Shell Command Output buffer the following error seems relevant, but I am not able to determine what is causing it.

[...]
(/usr/share/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/share/texmf-dist/tex/generic/tex4ht/html4-math.4ht)) (./latex-Mz7Vfn.aux)
Preview: Fontsize 10pt
Preview: Tightpage 0 0 0 0
[1]
! Output loop---100 consecutive dead cycles.
\newpage ...prevdepth \fi \fi \vfil \penalty -\@M 

l.7 ...e{amsmath}\begin{document}bar\end{document}

? 
! Emergency stop.
\newpage ...prevdepth \fi \fi \vfil \penalty -\@M 

l.7 ...e{amsmath}\begin{document}bar\end{document}

Output written on latex-Mz7Vfn.dvi (1 page, 2384 bytes).
Transcript written on latex-Mz7Vfn.log.
[...]

Any idea on what am I doing wrong here?

  • Maybe I'm wrong, but my interpretation of the error message is that it doesn't like the idea of \end{document} inside amsmath environment. Maybe specifying :file also requires :results of some sort? So that LaTeX source for the file wouldn't be inserted verbatim into the generated LaTeX file? – wvxvw Jul 2 '18 at 5:56
  • @wvxvw There is no amsmath environment involved here. The last command of the LaTeX header is just \usepackage{amsmath}. – Tobias Jul 3 '18 at 22:00
  • @Tobias oh, I see, right. – wvxvw Jul 4 '18 at 5:24
1

Your latex body bar does not define a tikz-image that could be exported as svg.

Therefore you only get a html file. That is exactly what the error message

executing Latex code block (foo)...
org-babel-execute:latex: HTML file produced but SVG file requested

says.

Instead of your example org file with latex body bar try the following org file containing a tikz image (it is adapted from the accepted solution of the question "Using TikZ for a simple drawing" on tex.se).

#+name: foo
#+header: :file foo.svg :headers \usetikzlibrary{positioning}\usetikzlibrary{arrows}
#+begin_src latex
\begin{tikzpicture}[>=triangle 45,font=\sffamily]
    \node (X) at (0,0) {x};
    \node (Y) [below left=2cm and 1cm of X]  {y};% 2cm below, 1cm to the left (optional)
    \node (Z) [below right=2cm and 1cm of X] {z};
    \node (U) [below left=2cm and 1cm of Z]  {u};
    \draw [semithick,->] (X) -- (Y);
    \draw [semithick,->] (X) -- (Z);
    \draw [semithick,->] (Y) -- (U) node [midway,below,sloped] {*};
    \draw [semithick,->] (Z) -- (U) node [midway,below,sloped] {*};
\end{tikzpicture}
#+end_src

Note that I use pstricks instead of tikz in LaTeX documents. For that reason I had to resort to the example I found on tex.se and could not easily produce an example with the string bar as tikz image.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.