当参考书目为空时打印文本

当参考书目为空时打印文本

通过biblatex,我正在寻找一种方法来检查参考书目是否为空,如果是,则打印一些自定义文本。

类似于这个伪代码:

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

我找不到任何选项biblatex 文档控制空书目上的行为。我忽略了什么吗?这可能吗?

编辑:以下是实施了 Ulrike 建议的 MWE:

\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}

答案1

如果 bib 为空,biblatex 会发出警告。您可以重新定义用于该消息的命令\blx@warn@bibempty

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

相关内容