I am using inkscape 0.91 on kubuntu. In a script (that I created some time ago) I use the following command line:

inkscape -z -D --file=input.svg --export-pdf="output.pdf" --export-latex

It generates two files: output.pdf and output.pdf_tex (then I can add the image in a tex file with \input{output.pdf_tex}).

Unfortunately, it does not work anymore. The .pdf_tex file now contains several lines mentioning other pages (page=1, page=2, ...). Example:


Here is a picture of the corresponding svg file (and a link):

enter image description here

The second \includegraphics mention a second page and if I remove its line, it works fine.

Do you know why the command line behave like this with inkscape 0.91? I can remove the additional lines manually, but there can be many of them and I often use the command (each time I modify the .svg file and want to see how it looks in my pdf file) so it is quite time consuming...

Thanks in advance.

  • Welcome to Graphic Design SE. It looks as your problem is indeed a bug and specific to your version of Inkscape (as I do not experience it). I assume that you looked at the header of the TEX file generated by Inkscape and followed the instructions (just checking)?
    – Wrzlprmft
    Commented Jan 8, 2016 at 19:30

1 Answer 1


Removing the extra \includegraphics in output.pdf_tex does not solve the problem since each page in output.pdf contains parts of the drawing. I found a solution (proposed by Biber on launchpad.net) which uses a new definition of the "\includesvg" command:

  1. Your drawings must be in the folder "./Figures/";
  2. Your temporary files (".pdf", ".pdf_tex") will be added in the folder "./tmp/" (you don't need to create the "./tmp" folder it will be done automatically);
  3. The 3 following commands must be placed before '\begin{document}':

% 1 - Set the graphic paths

\graphicspath{ {./Figures/} {./.tmp/} }

% 2 - Command used to test if the compilation of the svg file is necessary (i.e., if the .svg file is more recent than the corresponding pdf file)

\newcommand{\executeiffilenewer}[3]{\ifnum\pdfstrcmp{\pdffilemoddate{#1}}{\pdffilemoddate{#2}}>0{\immediate\write18{ [ -d ./.tmp/ ] || mkdir ./.tmp; #3}}\fi}

% 3 - Command that creates the ".pdf" and ".pdf_tex" from the ".svg". The workaround is in this command

\newcommand{\includesvg}[2][\textwidth]{\def\svgwidth{#1}\executeiffilenewer{./Figures/#2.svg}{./.tmp/#2.pdf}{\unexpanded{PDF_FILE="./.tmp/#2.pdf"; inkscape -z --file=./Figures/#2.svg --export-pdf=$PDF_FILE --export-latex; sed -i 's/\\\\/\n/g' ${PDF_FILE}_tex; MAXPAGE=$(pdfinfo $PDF_FILE | grep -oP "(?<=Pages:)\s*[0-9]+" | tr -d " ") ; sed -i "/page=$(($MAXPAGE+1))/,\${/page=/d}" ${PDF_FILE}_tex; } } \input{./.tmp/#2.pdf_tex}}

With these three commands an svg file can be displayed using "\includesvg" (like we would use "\includegraphics"):

   \includesvg[0.5\textwidth]{My_Nice_SVG_File} %Where the file is located at: ./Figures/My_Nice_SVG_File.svg
  • I tried to clean it. Hope it is more readable now.
    – Zach
    Commented Feb 18, 2016 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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