嘗試使用 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 不會使用 a\section
作為標題:
\documentclass{letter}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{knuth:ct}
\textbf{\Large References}
\printbibliography[heading=none]
\end{document}