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}
%%  instead of
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \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>/}}
%% For more information, please see info/svg-inkscape on CTAN:
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
    \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
    \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
      \setlength{\unitlength}{\unitlength * \real{\svgscale}}%


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
\usepackage{subfiles} % Should be loaded last in the preamble!

% subdir/sub.tex
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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