# Using Inkscape-generated figures in LaTeX document: How to make process more efficient?

I use LaTeX to type up lecture notes for math and physics, and I use Inkscape whenever I need to generate graphics for them. I want to find a faster method for doing this. Currently, I do the following:

• My files are organized using the subfiles package. Each lecture gets its own "individual file", and I compile all of them in one big "master file" via the subfile command. This makes the files easier to organize since each TeX file is very short. I organize the "individual files" in a different file than my "master file".

• When I need to generate diagrams, I generate a TikZ file using Inkscape (as discussed for instance in Ethan Bolker's answer in Exporting from Inkscape to LaTeX - via TikZ) and then include this in my "individual file."

The above method works fine, but there are some aspects that need improvement.

My question:

• When I generate my .pdf_tex file, the TikZ command always gives the filename by not the location of the file. (See example below.) I want Inkscape to automatically fill these in with the location of my file. So, for a file drawing.pdf_tex located at /Users/admin/Desktop/ generated by Inkscape file drawing.svg, I would like my file to automatically say /Users/admin/Desktop/drawing.pdf_tex rather than <filename>.pdf.

The reason I need to specify the location of my files in the above manner is because my "individual file" is in a different folder than my "master file," so even if the TikZ compiles in the "individual file," it does not compile in the "master file" unless I specify the location.

Here is a sample of what I get when I compile drawing.svg as as a TikZ file:

%% Creator: Inkscape inkscape 0.92.2, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'drawing.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%%   \input{<filename>.pdf_tex}
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%   \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the import' package (which may need to be
%% installed) using
%%   \usepackage{import}
%% in the preamble, and then including the image with
%%   \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%%   \graphicspath{{<path to file>/}}
%%
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{618.84102366bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.43735005)%
\put(0,0){\includegraphics[width=\unitlength,page=1]{drawing.pdf}}%
\end{picture}%
\endgroup%



As of version v1.4 2019/10/25 of the subfiles package, there should be no need anymore to specify an extra path. If the subfile finds all files, then the main file loading it via \subfile will also find them. This is at least true for files included via \input or \includegraphics. In the following setup both files, main.tex and sub.tex, compile.

% Structure:
% main.tex
% personalstyle.sty
% subdir/sub.tex
% subdir/image.pdf
% subdir/tikzimage.tex

% main.tex
\documentclass{article}
\usepackage{personalstyle}
\usepackage{subfiles} % Should be loaded last in the preamble!
\begin{document}
\subfile{subdir/sub}
\end{document}

% subdir/sub.tex
\documentclass[../main]{subfiles}
\begin{document}
\includegraphics{image.pdf}
\input{tikzimage}
\end{document}
`