我正在编写一个类似书籍的文档,为此我需要使用 LaTeX 文档类书籍(我使用章节等)。在文档的末尾,我想要一个独特的参考书目,分为几个主题,就像这样:
我制作了以下最小工作示例:
\documentclass{article}
\usepackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{Biblio-test.bib}
\begin{document}
\section{Introduction}
Notes for logic and the theory of computation.
\nocite{Ben12}\nocite{GJ79}\nocite{Gor16}\nocite{HMU06}
\nocite{HR04}\nocite{Sip12}
\section*{Bibliography}
\vspace{5mm}
\printbibliography[keyword=Logic, title={\normalsize\normalfont Logic:}]
\printbibliography[keyword=Computation,
title={\normalsize\normalfont Theory of Computation:}]
\end{document}
当 documentclass 为 article 时,它正好满足我的要求。.bib 文件的条目如下:
@BOOK{Ben12,
AUTHOR="M. Ben-Ari",
TITLE="Mathematical Logic for Computer Science",
PUBLISHER="Springer",
EDITION="3rd edition",
keywords="Logic",
YEAR={2012} }
@BOOK{GJ79,
AUTHOR="M. R. Garey and D. S. Johnson",
TITLE="Computers and Intractability: a Guide to the Theory of {NP}-Completeness",
PUBLISHER="W. H. Freeman \& Co.",
keywords="Computation",
YEAR={1979} }
@BOOK{Gor16,
AUTHOR="V. Goranko",
TITLE="Logic as a Tool: A Guide to Formal Logical Reasoning",
PUBLISHER="Wiley",
keywords="Logic",
YEAR={2016} }
@BOOK{HMU06,
AUTHOR="J. E. Hopcroft and R. Motwani and J. D. Ullman",
TITLE="Introduction to Automata Theory, Languages, and Computation",
PUBLISHER="Addison-Wesley",
EDITION="3rd edition",
keywords="Computation",
YEAR={2006} }
@BOOK{HR04,
AUTHOR="M. Huth and M. Ryan",
TITLE="Logic in Computer Science: Modelling and Reasoning about Systems",
PUBLISHER="Cambridge University Press",
EDITION="2nd edition",
keywords="Logic",
YEAR={2004} }
@BOOK{Sip12,
AUTHOR="M. Sipser",
TITLE="Introduction to the Theory of Computation",
PUBLISHER="Cengage Learning",
keywords="Computation",
EDITION="3rd edition",
YEAR={2012} }
但是,当我将文档类更改为 book 并将 \section 命令更改为 \chapter 时,我遇到了麻烦:标题“参考书目”单独出现在一页中,后面跟着一个空白页,后面跟着一页只有“逻辑”条目,然后是另一个空白页,后面跟着一页只有“计算理论”条目。
我怎样才能在文档类书中获得与文档类为文章时类似的参考书目格式?
答案1
不要将格式化命令放入title
键中。它应该只包含标题文本。任何额外的格式化都应通过参考书目标题执行。您可以使用选项使用特定的标题样式,heading
并使用 定义新的样式\defbibheading
。
对于你的设置
\documentclass{book}
\usepackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{aristotle:anima,aristotle:physics,nussbaum}
\printbibheading
\printbibliography[heading=subbibliography, keyword=primary, title={Logic}]
\printbibliography[heading=subbibliography, keyword=secondary, title={Theory of Computation}]
\end{document}
看起来很自然,其中subbibliography
是一个预定义标题,它使用比正常标题低一级的分段命令bibliography
(对于book
类bibliography
用途\chapter*
和subbibliography
用途\section*
)。
您还可以采用自己的标题样式,例如
\documentclass{book}
\usepackage[backend=biber,style=alphabetic]{biblatex}
\defbibheading{topicbib}{\paragraph{#1}}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{aristotle:anima,aristotle:physics,nussbaum}
\printbibheading
\printbibliography[heading=topicbib, keyword=primary, title={Logic}]
\printbibliography[heading=topicbib, keyword=secondary, title={Theory of Computation}]
\end{document}