I know there are plenty of other topics related to this question, however none of the ones I read resolves the issue presented here. I made a minimum working example available here, if you want to reproduce the problem. This post is a revival of an older question of mine[1].
Desired Behaviour
I would like to have a custom build folder that will contain all the PDFLaTeX / LUALaTeX intermediate build (and eventually output) files. Having a project structure resembling something like:
root
┣━━ main.tex
┣━━ figures/
┣━━ bib/
┗━━ out/
With all build files in the out/
folder and not at project root. This would make giting more convenient as well, with a simple /out/*
line added to the .gitignore
file.
Issue
Using the information found in this topic (most complete topic on the subject, I believe), I came up running the following command[2]:
lualatex -synctex=1 --output-directory=./out -interaction=nonstopmode ./biblio_test.tex
which works well and creates a bunch of things in the out
folder, followed by:
bibtex ./out/biblio_test.aux
However bibtex fails with the following error:
I couldn't open database file biblio_test-blx.bib
---line 3 of file out/biblio_test.aux
: \bibdata{biblio_test-blx
: ,bib/my_bib}
Which is caused to the very content of the lualatex
-generated biblio_test.aux
file:
\bibdata{biblio_test-blx,bib/my_bib}
Which should instead be: \bibdata{out/biblio_test-blx,bib/my_bib}
.
Temporary fix
I can think of two ways to fix this issue for now (tested, working):
- move the
biblio_text-blx.bib
to theroot
folder. - manually add the
out/
relative path to thebiblio_test.aux
file.
However none of these are solutions since those files will change at each compilation.
Questions
- Is this a bug of the
lualatex
command? Am I doing something terribly wrong here? - How can I solve this ?
Additional Information
- I also tried with the
pdflatex
command (pdflatex -synctex=1 -output-directory=./out -interaction=nonstopmode ./"biblio_test".tex
, only one dash for the-output-directory
argument). - My LaTeX distribution is TeX Live 2020, running under Mac OS Catalina (10.15.6).
- I can also think of dirty-but-working solutions such as defining an alias for my
bibtex
command doing something like (bash draft)mv out/biblio_test.aux ./biblio_test.aux && bibtek ./biblio_test.aux && mv ./biblio_test.bbl out/biblio_test.bbl && rm ./biblio_test.aux
, but I would prefer not to.
[1]: The original question was unanswered and labelled as abandoned. Following the discussion posted on meta on this topic, I just re-asked an improved version of the original question, and answered it.
[2]: Important: be sure to create an out
folder first with mkdir out
or the like if using the proposed minimal working example.