# svg from inkscape — doesn't work in xelatex?

I want to make use of "svg in tex" technology.

Here's a tex:

\documentclass{article}
\usepackage{color}
\usepackage{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}
\centering
%\def\svgwidth{\columnwidth}
\includesvg{svgfig}
\caption{My SVG Image}
\end{figure}
\end{document}


One can take any svg image.

Then:

pdflatex -shell-escape tex-file


works, but

xelatex -shell-escape tex-file


and

xelatex -shell-escape -8bit tex-file


both give error:

! Undefined control sequence.
{\pdffilemoddate {#1}}{\pdffil...
l.19     \includesvg{svgfig}


Edit:

Currently I prepare pdfs from svg before compiling then doc, so I do have "svgs in xetex". I even automated the thing in bash, so I'm pretty happy. Nevertheless, all problems should be solved, and all issues cleared -- so if someone aware of XeTeX internals thinks something is wrong -- it sould be reported and fixed.

-
XeTeX’s equivalent primitive is \strcmp not \pdfstrcmp, so it is a bug in the relevant package. –  Khaled Hosny Nov 30 '12 at 14:37
@KhaledHosny: Now it gives: \executeiffilenewer ...m \strcmp {\pdffilemoddate. –  Adobe Nov 30 '12 at 19:28
XeTeX does not have an equivalent primitive, I’m afraid. Unless you have hundreds of SVG images, may be you can just remove the \executeiffilenewer command and do the conversion on each run. –  Khaled Hosny Nov 30 '12 at 19:42

There are two issues; the XeTeX string comparing primitive is called \strcmp not \pdfstrcmp, so that is easy to fix (a more portable way is to use \pdf@strcmp from pdftexcmds package, which handle engine differences).
The other problem is the lack of a XeTeX implementation of \pdffilemoddate. I opened a XeTeX ticket, for when I have time to look into it, but patches are welcomed of course.