latexrun icon indicating copy to clipboard operation
latexrun copied to clipboard

Latexrun+biber works incorrectly with \nocite{*}

Open philip-bl opened this issue 6 years ago • 5 comments

Here goes minimal example.

blah.tex:

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{refs.bib}

\begin{document}

Hello world.

\nocite{*}
\printbibliography

\end{document}

refs.bib:

@inproceedings{ref01,
  author={M. Pie},
  title={A Bug in Latexrun},
  booktitle={Github},
  year={2018}
}

I do latexrun --bibtex-cmd biber blah and I get a pdf file with no references section. This is wrong.

If I do pdflatex blah; biber blah; pdflatex blah, the references section is there. This is how it's supposed to be.

philip-bl avatar Apr 18 '18 11:04 philip-bl

I also have this problem.

maddiemort avatar Oct 16 '18 16:10 maddiemort

Interestingly, just running latexrun again fixes the problem for me - even though it does not execute latex again (--verbose-cmds does not print anything)

xqms avatar May 24 '19 15:05 xqms

After running latexrun once, latex.out/xyz.pdf is correct, but xyz.pdf is some intermediate version, not the final one...

I uploaded a log here: https://gist.github.com/xqms/610a018e95251bcbc9b80c5927a900f5

The command I used was latexrun --debug --verbose-cmds --latex-cmd "xelatex" --bibtex-cmd "biber" talk.tex

Note that "commiting latex.out/talk.pdf to talk.pdf" occurs only once after the first latex run, which seems wrong to me...

xqms avatar May 24 '19 15:05 xqms

I also have this problem. Unlike @xqms running latexrun again does not cause biber to run, and hence does not fix the problem. From skimming the code I think the problem is that latexrun tries to parse the aux file in order to determine whether biber needs to be run. Use of \nocite{*} messes up this logic. In my opinion, just like parsing of tex files should be left to latex, parsing of biber files should be left to biber (even if that requires running biber "unnecessarily").

(Mind you, I see the attraction of trying to avoid running biber. A common pattern is to have all your latex files reference the same bib file. A minor tweak to that bib file will then result in biber needing to be run for all latex files in the repository. However I suspect avoiding this is hard.)

banbh avatar Oct 13 '19 19:10 banbh

I found a fix for this. When using \nocite{*}, an entry is generated in the .bcf file. If latexrun is extended to also look there before concluding that no biber run is needed, then it correctly identifies that it needs to run another pass of biber.

Ferdi265 avatar Oct 10 '23 10:10 Ferdi265