\printbibliography Documentclass 字母中未定义控制序列错误

\printbibliography Documentclass 字母中未定义控制序列错误

尝试使用 PDFLaTeX 或 XeLaTeX 编译下面的最小工作示例,会导致编译器以退出代码 1 结束,并报告undefined control sequence\printbibliography 之后发生的任何事情,这是示例代码中的空白行:

\documentclass[12pt]{letter} % 12pt font size, 10pt and 11pt are also possible

\usepackage{geometry} % Required for adjusting page dimensions

\geometry{
    paper=letterpaper, % Change to letterpaper for US letter
    top=1.00in, % Top margin
    bottom=1.00in, % Bottom margin
    left=1.00in, % Left margin
    right=1.00in, % Right margin
    %showframe, % Uncomment to show how the type block is set on the page
}

\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage{url}
\usepackage{hyperref}

\begin{filecontents}{DummyBibliography.bib}
@book{sandarsEpicGilgamesh1977,
  title = {The Epic of {{Gilgamesh}}},
  editor = {Sandars, Nancy K.},
  date = {1977},
  series = {Penguin Classics},
  edition = {Rev. ed. inc. new material},
  publisher = {{Penguin Books}},
  location = {{Harmondsworth, Middlesex, Engl}},
  isbn = {978-0-14-044100-0},
  langid = {english},
  language = {eng},
  pagetotal = {127}
}
\end{filecontents}

\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber,hyperref=true,alldates=comp,url=true]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{DummyBibliography.bib}

\usepackage{ebgaramond} % Use the EBGaramond font by default
\usepackage{microtype} % Improve justification

\usepackage{lipsum}

\signature{James Adams} % Your name for the signature at the bottom

\address{1001 Main Street \\ Anywhere, AZ 99999} % Your address and phone number

\begin{document}

\begin{letter}{John Doe \\ 100 Broadway \\ Somewhere, AZ 11111} % Name/title of the addressee

\opening{John,}
\vspace{\parskip}

\lipsum [1]

As an anonymous author wrote long ago:
\blockquote[\cite{sandarsEpicGilgamesh1977}]
    {
    \lipsum[2]
    }

\lipsum[3]

\vspace{2\parskip} % Extra whitespace for aesthetics
\closing{Sincerely,}
\vspace{2\parskip} % Extra whitespace for aesthetics

\end{letter}

\clearpage
\printbibliography[title = References]

\end{document}

我相信我第一次在信件中这样做时没有收到错误,但过去几周我一直收到错误(我在 ArchLinux 上使用 Kile,因此 TeXLive 在我的系统上经常更新)。奇怪的是,虽然 PDFLaTeX 和 XeLaTeX 都以退出代码 1 结束,但它们也会生成包含正确格式的信件和预期参考书目的 PDF,因此这更像是一种麻烦而不是问题。

答案1

针对您的问题的一个最小的非工作示例是

\documentclass{letter}
\begin{document}
\section{References}
\end{document}

您可以使用 来避免此问题\printbibliography[heading=none]。这将确保 biblatex 不会将 用作\section标题:

\documentclass{letter}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

\cite{knuth:ct}

\textbf{\Large References}

\printbibliography[heading=none]

\end{document}

相关内容