I have three files, the files main.tex
and package.sty
located in the same folder and a standalone
file fig.tex
located in a subfolder sub
, using a command from package.sty
. The problem is that standalone
says it cannot build fig.pdf
. I use standalone v1.1b
. I give the option --shell-escape
.
- Am I doing something wrong?
- If not, is there a way to still use the
buildnew
option, with a setup where astandalone
-file in a
subdirectory uses a file in a parent-directory?
The file main.tex
\documentclass{article}
\usepackage[mode=buildnew]{standalone}
\usepackage{tikz,package}
\begin{document}
\includestandalone{sub/fig}
\end{document}
The file package.sty
\newcommand{\foo}{b}
The file test.tex
\documentclass[tikz]{standalone}
\usepackage{../package}
\begin{document}
\begin{tikzpicture}
\node {$\foo$};
\end{tikzpicture}
\end{document}
Edit: One option seems to be to place a symbolic link to the package in the subfolder and then use the link. But this is not platform independent, and makes compilation more involved.
Best Answer
The following approach seems natural in
latex
and also works on a per project way, i.e. when each project requires different packages or is in a different repository.texmf/tex/latex/
directoryTEXMFHOME
point totexmf
, e.g. viaexport TEXMFHOME=<path-to-the-new-texmf-dir>
. This putstexmf
into the compilers search path. The subdirectoriestex/latex
are needed because the compiler expects files with different file endings in different placespackage.sty
totexmf/tex/latex/
\usepackage{package}
insub/fig.tex
and inmain.tex
and the file is found