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
subfilespackage. Each lecture gets its own "individual file", and I compile all of them in one big "master file" via thesubfilecommand. 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_texfile, 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 filedrawing.pdf_texlocated at/Users/admin/Desktop/generated by Inkscape filedrawing.svg, I would like my file to automatically say/Users/admin/Desktop/drawing.pdf_texrather 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
%%
\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%