Does someone have a minimal Makefile, that compiles a latex document using
- pdflatex
- bibtex
- pdflatex
- pdflatex
while putting all ouput files in a special output-directory to avoid cluttering the root-directory?
There's another question like this here:
Here's my (slightly edited) answer:
Now, running something like
mkdir OUT
TEXMFOUTPUT="OUT"
pdflatex --output-directory OUT myfile
bibtex OUT/myfile
pdflatex --output-directory OUT myfile
pdflatex --output-directory OUT myfile
produces the expected results, and is fully scriptable.
If you are getting the message:
bibtex: Not writing to $TEXMFOUTPUT/src.blg (openout_any = p).
then you need the following little hack. The issue is that bibtex ability to write to $TEXMFOUTPUT is restricted to avoid file overwriting and the bibtex command returns an error message.
Open the file texmf.cnf
, dunno about windows, but on linux:
/usr/share/texlive/texmf/web2c/texmf.cnf (UBUNTU TEXLIVE)
/usr/share/texmf-dist/web2c/texmf.cnf (ARCH LINUX TEXLIVE)
find the openout_any = p
line and change it either to a
for always or r
for restricted (p stands for paranoid fyi).
arara
orlatexmk
?rm *.aux
and remove them all but mostly I don't bother and they do no harm. If you move the output from tex to another directory, you need to configure everything else to be able to find them and read them back, it's possible but tricky to get right and serves no great purpose.