我有以下代码:
\documentclass[oneside]{book}
\usepackage[utf8]{inputenc}
\begin{document}
\bibliographystyle{apalike}
\chapter{Bibliography}
\begin{thebibliography}{}
\bibitem[Xyz 2010]{xyz-2010}
Xyz. et. al. (2010). Blabla.
\end{thebibliography}
\end{document}
这将打印一页带有章节标题(“参考书目”)的页面和另一页带有第二个标题“参考书目”的页面。
我想删除第二个标题并将所有内容放在一页上。“参考书目”一词应仅出现在章节标题中。此章节也应显示在目录中。
修改
\begingroup
\renewcommand{\chapter}[2]{}
\chapter{Bibliography}
\begin{thebibliography}{}
\bibitem[Xyz 2010]{xyz-2010}
Xyz. et. al. (2010). Blabla.
\end{thebibliography}
\endgroup
按照建议这里,将章节标题全部删除,而添加
\renewcommand\bibname{ }
按照建议这里,根本没有任何效果。我发现的大多数其他解决方案都是使用单独的 .bib 文件为参考书目设计的,因此它们不适合我。
答案1
以下是书目环境的重新定义:
\begin{filecontents*}{lib.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
\end{filecontents*}
\documentclass[oneside]{book}
% Renew bibliography environement
\makeatletter
\renewenvironment{thebibliography}[1]
{\chapter{\bibname}% <-- this line was changed from \chapter* to \chapter so the number appear
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{document}
\chapter{My Chapter}
Here is a citation \cite{goossens93}.
\bibliographystyle{apalike}
\bibliography{lib}
\end{document}
因此参考书目使用章节编号系统显示为正常章节。在章节后添加 * 将使参考书目恢复正常(无编号)。
没有 bibfile 而仅使用 bibitems 的变体是:
\documentclass[oneside]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
% Renew bibliography environement
\makeatletter
\renewenvironment{thebibliography}[1]
{\chapter{\bibname}% <-- this line was changed from \chapter* to \chapter so the number appear
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother
\begin{document}
\chapter{My first chapter}
blablabla
\bibliographystyle{apalike}
\begin{thebibliography}{}
\bibitem[Xyz 2010]{xyz-2010}
Xyz. et. al. (2010). Blabla.
\bibitem{Simpson} Homer J. Simpson. \textsl{Mmmmm...donuts}.
Evergreen Terrace Printing Co., Springfield, SomewhereUSA, 1998
\end{thebibliography}
\end{document}
希望能帮助到你。
罗曼