# siunitx with svg graphics

I am using pdfLaTeX (TeX Live 2011) to compile a document. Unfortunately it does not compile. Again, my example compiles flawlessly with TeX Live 2009. I include an SVG/PDF graphics following this guide. To do so I first create a drawing in an SVG file, then I export it to PDF and pdf_tex files.

In the SVG file I added a line of text like this:

\SI{6}{\arcsecond}


The figure is included by:

\begin{figure}[htbp]
\centering
\def \svgwidth{\columnwidth}
\includesvg{path-to-figure}
\caption{\SI{6}{\metre}}
\label{fig:label-of-figure}
\end{figure}


The \includesvg command is defined as:

\newcommand{\executeiffilenewer}[3]{%
\ifnum\pdfstrcmp{\pdffilemoddate{#1}}%
{\pdffilemoddate{#2}}>0%
{\immediate\write18{#3}}\fi%
}
\newcommand{\includesvg}[1]{%
inkscape -z -D --file=#1.svg %
--export-pdf=#1.pdf --export-latex}%
\input{#1.pdf_tex}%
}


Parts of the generated pdf_tex file.

\begin{picture}(1,0.44809873)%
\put(0,0){\includegraphics[width=\unitlength]{snifs_fov.pdf}}%
\put(0.47868192,0.06651686){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{c) foo + bar + baz }}}%
\put(0.47868192,0.17904892){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{b) bar + baz }}}%
\put(0.47868192,0.33397134){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{a) baz}}}%
\put(0.01018567,0.21107977){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{\SI{6}{\arcsecond}}}}%
\end{picture}%
\endgroup%


This is the resulting error.

(./figs/graphics/snifs_fov.pdf_tex
<./figs/graphics/snifs_fov.pdf, id=104, 376.15532pt x 168.55472pt>
<use ./figs/graphics/snifs_fov.pdf>)
! Undefined control sequence.
\arcsecond ->\ERROR


UPDATE: I have mistakenly considered the SVG file to be the root of the error. In fact the same text, which is in the SVG file, follows in a paragraph after the figure. I debugged this by changing the text in the SVG file. The error message after compilation did not change. And also JosephWright's confirmation, that it is possible to compile the file in an MWE, helped me to find out.

-
Exactly which siunitx version do you have: check in your log file. I can test against any version: you may be seeing a bug in an old version. (This is a more general point: TeX Live versions don't really tell us much about individual package versions, which are almost always more informative.) – Joseph Wright Jan 17 '13 at 20:42
siunitx.sty 2012/05/03 v2.5c A comprehensive (SI) units package – user24537 Jan 17 '13 at 20:44
The file depositfiles.com/files/86r22v83r – user24537 Jan 17 '13 at 20:48
No problems here with a minimal .tex file, the linked SVG converted using Inkscape and the version of siunitx you cite. – Joseph Wright Jan 17 '13 at 21:18
I must have mistakenly suspected the svg file to be the root of the problem. – user24537 Jan 17 '13 at 21:25

(More of a comment, but too long.) For me, using

\documentclass{article}
\listfiles
\usepackage{siunitx,graphicx}
\ifnum\pdfstrcmp{\pdffilemoddate{#1}}%
{\pdffilemoddate{#2}}>0%
{\immediate\write18{#3}}\fi%
}
\newcommand{\includesvg}[1]{%
%inkscape -z -D --file=#1.svg %
%--export-pdf=#1.pdf --export-latex}%
\input{#1.pdf_tex}%
}
\begin{document}
\begin{figure}
\includesvg{snifs_fov}
\end{figure}
\end{document}


and a .pdf_tex file created using Inkscape works fine (I don't have it on my path, so did the conversion in the GUI). Works with both siunitx v2.5c and latest release.

-