When building LaTeX documentation on a VPATH build, if your .tex
file
includes other files in the same directory, LaTeX will complain that it cannot
find them. The reason is because in a VPATH build, latex
is invoked like
this:
latex ../../doc/manual.tex
What we need here is an equivalent to cc's -I
dir for latex.
latex --help doesn't mention of such an option, nor of useful environment variables.
Googling a bit seems to suggest --include-directory=dir
, but that gives me:
unrecognized option '--include-directory=../../doc'
The manpage doesn't list commandline options. It however says:
The complete documentation for this version of TeX can be found in the info file or manual Web2C: A TeX implementation.
Without saying where that manual is, if it's installed and where, or what package installs it, or if instead should I look it up on the web.
info latex
gives the manpage itself, of course.
Googling the title of that manual finds it, and it's a long one. Reading through, it points at the kpathsea manual, which then mentions you can set TEXINPUTS_latex, which however doesn't add but overrides, so your document will find the includes maybe, but not the LaTeX styles and other stuff.
But then later on it mentions that in the env variable you can use "default expansion", and it's another page of manual to read which tells you to put an extra colon in the end of the env var.
After half an hour of googling and trying things and cursing loud, here is the solution, which I hope will save others from this ugly search.
%.aux: %.tex
TEXINPUTS="$(srcdir):" latex $<
# Oh, yes, and bibtex requires BIBINPUTS instead
%.bbl: %.aux
BIBINPUTS="$(srcdir):" bibtex `basename $< .aux`