# Tikz snippet preview in orgmode

For some reason, in my installation, both dvipng, and imagemgick don't work when using tikz, with errors such as the following when using a latex src block,

org-compile-file: File "/tmp/babel-aqvAMK/latex-Ehm75V.pdf" wasn’t produced. See "Org PDF LaTeX Output" for details

Or the image was simply not showing up.

My solution was to set use dvisvgm

(setq org-preview-latex-default-process 'dvisvgm)


This allows me to simply insert tikz code in my file, and the latex fragment will display it, as long as I have added the necessary header.

#+latex_header: \usepackage{tikz}

\begin{tikzpicture}
\draw[->] (-3,0) -- (-2,0) arc[radius=0.5cm,start angle=-180,end angle=0] (-1,0) -- (1,0) arc[radius=0.5cm,start angle=180,end angle=0] (2,0) -- (3,0);
\end{tikzpicture}


It is also considerably faster than using dvipng, at least on my machine.

If you want to use the image in your html export, instead of your pdf export, you can create a .svg folder, and then run the following:

#+HEADER: :file ./svg/example.svg