plk / biblatex

biblatex is a sophisticated bibliography system for LaTeX users. It has considerably more features than traditional bibtex and supports UTF-8
507 stars 115 forks source link

Spurious "empty citation" added to unresolved \textcite #1237

Closed amunn closed 1 year ago

amunn commented 2 years ago

Instead of just the bolded cite key, \textcite seems to append the string "empty citation" to the bolded key.

The effect is reproducible with both numeric and apa styles, but not with authoryear.

\documentclass{article}
\usepackage[style=apa]{biblatex} % also happens with numeric
\addbibresource{biblatex-examples.bib}
\begin{document}
\parencite{foo}

\textcite{foo}

\end{document}

Resultant output is foompty citation (foo)

moewew commented 2 years ago

That is due to https://github.com/plk/biblatex/issues/1216, but this particular problem only affects \...cites that are set up a two-pass commands. Those two-pass citation commands process the citation list twice (with different commands). The first pass does some preprocessing (mainly counting) and passes the entries on to the second command that does the actual printing. Entries that are not found are dropped by the first pass, so the second pass may end up getting an empty list and now warns about that.

If we want to keep the behaviour of warning for an empty list (#1216), I cannot see a general way to resolve this. It could be resolved on the style level by testing for an empty list in the two-pass implementation. We can do this for the standard styles, but contributed styles would have to be changed by their maintainers. The question is if this small nuisance is worth the hassle...

amunn commented 2 years ago

Given that running biber is relatively time consuming the ability to generate completely readable output without running biber is quite useful to me, at least, because my .bib file keys are generally of the form AuthorYear. The idea to replace the standard bibtex ? with the citation key is one of the things that makes biblatex great to work with when writing, but the output with empty citation added quickly makes the output unreadable. So it's not so small of a nuisance IMO. :)

hvoss49 commented 2 years ago

Given that running biber is relatively time consuming the ability to generate completely readable output without running

Only the first run of biber is time consuming, but not the following ones if you do not delete the temporary directory of the biber files.

amunn commented 2 years ago

@hvoss49 But that doesn't really help, the issue is that any time you add a new citation to the source and compile (without running biber) you get empty citation added to each unresolved citation. So to remove that you need to run {pdf|lua|xe}latex - biber - {pdf|lua|xe}latex to get clean output. Before the change implemented in #1216 the output was generally readable, with bold .bib keys, so multiple compilations were required much less frequently. At least in my usual workflow, I generally only run biber quite late in the process of writing.

amunn commented 2 years ago

A simple solution might be to make the text of empty citation that is added in #1216 be user definable (or simply make it ?). That would require no changes to contributed styles but would allow readable output for unresolved citations to be preserved.

plk commented 1 year ago

Fixed in 3.19 release