4

With biblatex, I'm looking for a way to check if the bibliography is empty, and if so, print some custom text.

Something along the lines of this pseudocode:

\ifempty\thebibliography
    [[ no references found ]]
\else
    \printbibliography
\fi

I could not find any options in the biblatex documentation controlling the behavior on empty bibliographies. Did I overlook something? Is this at all possible?

EDIT: Here's a MWE with Ulrike's suggestion implemented:

\documentclass[twoside,a4paper,11pt]{report}

\usepackage{biblatex}
\makeatletter
    \def\blx@warn@bibempty{[THIS TEXT PRINTS WHEN NO BIBLIOGRAPHY IS PRINTED]}
\makeatother


\begin{filecontents}{\jobname.bib}
@BOOK{hectic,
  AUTHOR    = {Henry Hectic},
  TITLE     = {How Horticulturalists Howl},
  PUBLISHER = {Honorary Books: Henage},
  YEAR      = {2000}
}
@BOOK{flutter,
  AUTHOR    = {Frederick Flutter},
  TITLE     = {Fraternising with Flowers},
  PUBLISHER = {Frippery Pamphlets: Folkestone},
  YEAR      = {1995}
}
\end{filecontents}

\addbibresource{\jobname.bib}


\begin{document}

    % Comment back in to see the normal bibliography
    %See also \cite{hectic}.

    \printbibliography


\end{document}
  • 3
    biblatex warns you if the bib is empty. You could redefine the command used for the message \blx@warn@bibempty. – Ulrike Fischer Jul 31 '14 at 10:31
  • @UlrikeFischer ... that's a bit beyond my abilities. Could you give a small example? – Rody Oldenhuis Jul 31 '14 at 10:34
  • \makeatletter\def\blx@arn@bibempty{Try it out}\makeatother (put is somewhere behind \usepackage{biblatex} naturally) (untested as you didn't provide a complete document for a test). – Ulrike Fischer Jul 31 '14 at 10:36
  • @UlrikeFischer: Thanks, works like a charm. Please copy-paste my MWE above into an answer so I can mark it as accepted. – Rody Oldenhuis Jul 31 '14 at 12:42
6

biblatex warns you if the bib is empty. You could redefine the command used for the message \blx@warn@bibempty:

 \usepackage{biblatex}
 \makeatletter
 \def\blx@arn@bibempty{Try it out}
 \makeatother 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.