1

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.

wvxvw
  • 769
  • Where are the cls and the sty relative to index.tex? – Ulrike Fischer Oct 15 '15 at 17:49
  • @UlrikeFischer I've updated the question with the printout of the directory structure (with some irrelevant files omitted). – wvxvw Oct 15 '15 at 18:06
  • Are the quotes around the texinputs settings correct? (I can't test as I have windows) – Ulrike Fischer Oct 16 '15 at 07:31
  • @UlrikeFischer yup, if I do the same thing but with bash -c 'echo "$TEXINPUTS"', the TEXINPUTS prints 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

1 Answers1

2

You can always add a .cls file locally when initializing it. Lets say we need to add the IEEEtran that is a kind of latex article.

If the sentence

\documentclass[10pt,journal,compsoc]{IEEEtran}

gives you an error since the IEEEtran.cls file is not found, you can always add the local path in the declaration:

\documentclass[10pt,journal,compsoc]{./libs/IEEEtran}

If you need the same cls file, you can add it locally to your latex home. But this local static notation is good when you need to keep the cls for instance in a github project. In this way, anyone would have access to the non native libs