Please be warned, despite this sounding very similar to Where do I place my own .sty or .cls files, to make them available to all my .tex files? it is a different problem.
I need to generate PDF as one step of a complicated build process (during documentation generation). I have extra STY and CLS files which are created by a third-party software (Sphinx, Python documentation generator), and these files are placed by the program in the directory specific to the project (./_build/latex to be more concrete).
Directory structure
$ tree
.
├── _build
│ ├── doctrees
│ │ ├── environment.pickle
│ │ └── index.doctree
│ └── latex
│ ├── included.tex
│ ├── fncychap.sty
│ ├── Makefile
│ ├── python.ist
│ ├── sphinxhowto.cls
│ ├── sphinxmanual.cls
│ ├── sphinx.sty
│ └── tabulary.sty
├── conf.py
├── index.rst
├── Makefile
├── index.tex
├── _static
└── _templates
Later, if I launch the latexmk tool to build the files in this directory, the tool has no problems locating STYs and CLSs. The problems begin when I need to invoke latexmk from the parent directory: the STYs can no longer be located.
I've tried:
TEXINPUTS="$TEXINPUTS:./_build/latex:" latexmk \
-pdflatex='pdflatex -shell-escape -interaction \
nonstopmode' -pdf -f ./index.tex
but this had no effect.
I'm using TexLive LaTeX distribution. I could solve the problem by symlinking this directory to my ~/texmf directory, but I need the build to be independent of my particular setup.
bash -c 'echo "$TEXINPUTS"', theTEXINPUTSprints out as expected. It has double colons though, i.e. where the bits of the path are concatenated I get something like:.:/home/wvxvw/.emacs.d/elpa/auctex-11.88.7/latex::./_build/latex:– wvxvw Oct 16 '15 at 08:11