参考书目作为LaTeX/BibTeX中的一部分 [英] Bibliography as section in LaTeX / BibTeX
问题描述
我正在写一个简短的文档,其中使用章节而不是章节作为顶层(文档类报告).但是,
I'm writing a short document using sections rather than chapters as the top-level (documentclass report). However,
\bibliographystyle{amsplain}
\bibliography{general}
使参考书目作为章节而不是章节插入.有什么办法可以改变这一点?
causes the bibliography to be inserted as a chapter rather than a section. Is there any way to change this?
推荐答案
默认情况下,report
文档类使用\chapter
作为书目标题级别.相反,article
文档类使用\section
作为书目标题级别.如果您不在文档的任何地方使用\chapter
,则可能需要使用article
类.
By default, the report
document class uses \chapter
as the bibliography heading level. In contrast, the article
document class uses \section
as the bibliography heading level. If you're not using \chapter
anywhere in your document, you might want to use the article
class instead.
如果您确实要使用report
类,则需要重新定义thebibliography
环境以使用\section
而不是\chapter
.在文档的序言中(在\documentclass
行之后但在\begin{document}
行之前,插入以下内容:
If you really want to use the report
class, you'll need to redefine the thebibliography
environment to use \section
instead of \chapter
. In the preamble of your document (after the \documentclass
line but before the \begin{document}
line, insert the following:
\makeatletter
\renewenvironment{thebibliography}[1]
{\section*{\bibname}% <-- this line was changed from \chapter* to \section*
\@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
现在您的参考书目将具有\section
标题,而不是\chapter
标题.
Now your bibliography will have a \section
heading instead of a \chapter
heading.
请注意,如果您加载任何特殊的书目包,则可能要在加载这些包之前 放置此代码(这样就不会覆盖它们的工作).
Note that if you load any special bibliography packages, you might want to put this code before those packages are loaded (so you don't overwrite their work).
这篇关于参考书目作为LaTeX/BibTeX中的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!