4

Instead of having the citation key showing up in the document for missing references, I want to only have [?], as it is the case when using the default bibtex without biblatex. This behavior is driving me crazy, as it messes up all the formatting (especially in tables). I want to focus on writing and only later on deal with the erroneous citations.

This question is related to

How do I stop biblatex printing the bibtex key?

and its MWE can be used. However, as pointed out beforehand, I want the question mark in the text instead of the citation key to not mess up the formatting (for missing citations).

1 Answer 1

6

Since version 3.12 biblatex has had the semi-internal macro \abx@missing@entry which can be redefined as follows

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\def\abx@missing@entry#1{\abx@missing{??}}
\makeatother

\begin{document}
\cite{sigfridsson,appleby}
\printbibliography
\end{document}

Missing entry key is shown as <code>??</code> and not as <code>appleby</code>

The default definition of \abx@missing@entry is

\def\abx@missing@entry#1{%
  \abx@missing{#1}}

where #1 is the unknown entrykey. See https://github.com/plk/biblatex/commit/8df18a8725f8ba150c142443f64024c7ad8966c6


With older versions of biblatex you could use

\makeatletter
\def\blx@citeadd#1{%
  \ifcsdef{blx@keyalias@\the\c@refsection @#1}
    {\edef\blx@realkey{\csuse{blx@keyalias@\the\c@refsection @#1}}}
    {\def\blx@realkey{#1}}%
  \expandafter\blx@getrefcontext\expandafter{\blx@realkey}% needed for \ifdata
  \expandafter\blx@citation\expandafter{\blx@realkey}\blx@msg@cundefon
  \expandafter\blx@ifdata\expandafter{\blx@realkey}
    {\advance\blx@tempcnta\@ne
     \listeadd\blx@tempa{\blx@realkey}}
    {\ifnum\blx@tempcntb>\z@\multicitedelim\fi
     \expandafter\abx@missing\expandafter{??}%<- the change is here
     \advance\blx@tempcntb\@ne}}
\makeatother
2
  • perfect, nice! thank you so much. this is exactly what I have been searching for. there should be an option for the package to have that kind of behavior.
    – user26372
    Commented May 28, 2018 at 12:58
  • @user26372 I agree. See the edit.
    – moewe
    Commented May 28, 2018 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .