[Tex/LaTex] How to convert inkscape pdf_tex to pdf

graphicsinkscapepdftex

I recently made all my figures for pdflatex by using Inkscape’s pdf_tex-feature, which makes the figure fonts become nice etc.

But, afterwards, it turned out that the journal compiler did not handle these correctly.. 🙁 How to convert?

Best Answer

So I solved it myself, and want to store it here for archival purposes should this happen to anyone else searching for the solution.

On mac (or linux) create this bash-script and run it with the filename (without extension), eg: bash scriptfile imagefile if the imagefiles are named imagefile.pdf and imagefile.pdf_tex. This will create a nice file called imagefile_converted.pdf which will work in any journal.

Here follows the content of scriptfile above:

#!/bin/bash
cat > $1_converted.tex << EOF
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{color}
\begin{document}
\def\svgwidth{8cm}
\input{changeme.pdf_tex}
\end{document}
EOF

sed -i -e "s/changeme/$1/g" $1_converted.tex
pdflatex $1_converted.tex
rm $1_converted.aux $1_converted.log $1_converted.tex $1_converted.tex-e $1_converted.tex
open $1_converted.pdf