# Converting images from TikZ to SVG

The route from TikZ to SVG helps to programmatically draw images which can then be given to the boss for further perusal.

• generate an image, an small example (balls.tex) is shown below

\documentclass{minimal}

\usepackage{tikz}
\begin{document}
\centering
\begin{tikzpicture}
\foreach \x/\y/\color in {1/2/red,3/4/green,5/6/blue}
\shade [ball color=\color] (\x,\y) circle (\x/\y);
\end{tikzpicture}
\end{document}

The hard way actually looks much easier, but in my experience doesn't always work, expecially for complicated figures. One advantage is that the resulting .svg-files are much nicer (e.g. shading fully works…)

\documentclass{minimal}
\def\pgfsysdriver{pgfsys-tex4ht.def}
\usepackage{tikz}
\begin{document}
\centering
\begin{tikzpicture}
\foreach \x/\y/\color in {1/2/red,3/4/green,5/6/blue}
\shade [ball color=\color] (\x,\y) circle (\x/\y);
\end{tikzpicture}
\end{document}
• if you're using graphics with TikZ (for example for scale bars, then also declare the graphics-extension.
\usepackage{graphicx}
\DeclareGraphicsExtensions{.png} % I prefer .png to .eps...
• use htlatex to compile this document to html. this generates .svg-files from all included tikz-pictures.
• open resulting balls-htlatex.svg with coreldraw (which sadly does not always work…)
1)
taken from here, which was linked from the PGF-mailing list [if I remember correctly…]