参考书目作为 \section 并包含在目录中

参考书目作为 \section 并包含在目录中

先前的问题 (chapterbib 作为节而不是章节等人考虑过如何在章节末尾添加参考书目。这个问题涉及使用 natbib 作为引文包时章节末尾的参考书目。

在序言中我写道

\usepackage{chapterbib}
\usepackage[sectionbib]{natbib}
\usepackage{etoolbox}
\patchcmd{\thebibliography}{\chapter*}{\section}{}{}

\bibliographystyle{unsrtnat}
\bibliography{biblio}

在每个\include(d) 文件中。我LaTeX在主文件 ( test2.tex) 和bibtex每个辅助文件 (chap1.auxchap2.aux) 上运行,然后LaTeX在 上运行两次test2.tex。结果如下:

  • 正确的风格(来自\bibliographystyle{unsrtnat}
  • 作为编号部分插入的参考资料(来自\usepackage{chapterbib)和使用\patchcmd
  • 但是,包含参考文献的部分被排除在目录之外

natbib将参考文献作为章节中的一个部分并包含在目录中的正确使用方法是什么?如果\usepackage{natbib}排除,代码会生成作为编号部分包含的参考文献,并将其包含在目录中,但(当然)natbib不会应用样式。

我已经完整阅读了chapterbib(Arseneau 2010)和natbib(Daly 2010)参考资料。

这是我的最小非工作示例:

\documentclass{report}
\usepackage{filecontents}
\usepackage{chapterbib}
\usepackage[sectionbib]{natbib}
%\usepackage{natbib}
\usepackage{etoolbox}
%patchcmd from https://tex.stackexchange.com/questions/158871/bibliography-as-section-instead-of-section
\patchcmd{\thebibliography}{\chapter*}{\section}{}{}
\begin{filecontents*}{chap1.tex}
\chapter{First Chapter}
\section{First chapter, first section}
Watson and Crick \citeyearpar{watson53} proposed the structure of DNA.
\bibliographystyle{unsrtnat}
\bibliography{biblio}
\end{filecontents*}
\begin{filecontents*}{chap2.tex}
\chapter{Second Chapter}
\section{Second chapter, first section}
This is Einstein's famous paper \citep{einstein05}.
\bibliographystyle{unsrtnat}
\bibliography{biblio}
\end{filecontents*}
\begin{filecontents*}{biblio.bib}
@article{
watson53,
Author = {Watson, J. D. and Crick, F. H. C.},
Title = {Molecular Structure of Nucleic Acids: A Structure for Deoxyribose Nucleic Acid},
Journal = {Nature},
Volume = {171},
Number = {4356},
Pages = {737-738},
Year = {1953} }
@article
{einstein05,
Title   = {{Zur Elektrodynamik bewegter K{\"o}rper}.        ({German})
    [{On} the electrodynamics of moving bodies]},
Author  = {Albert Einstein},
Journal = {Annalen der Physik},
Year    = {1905},
Number  = {10},
Pages   = {891--921},
Volume  = {322}}
\end{filecontents*}
\begin{document}
\tableofcontents
\include{chap1}
\include{chap2}
\end{document}

答案1

使用此处给出的解决方案解决:如何在报告中添加参考书目及其章节,包括编号

\documentclass{report}
\usepackage{filecontents}
\usepackage{chapterbib}
\usepackage[sectionbib]{natbib}
\usepackage{etoolbox}
%Don't use this
%https://tex.stackexchange.com/questions/158871/bibliography-as-section-instead-of-section
%\patchcmd{\thebibliography}{\chapter*}{\section}{}{} 
%Use the following patch and \renewcommand inside \begin{document}
%From https://tex.stackexchange.com/questions/4874/how-can-i-add-the-bibliography-in-a-report-with-its-own-section-including-numbe
\makeatletter
\patchcmd{\thebibliography}{%
\chapter*{\bibname}\@mkboth{\MakeUppercase\bibname}    {\MakeUppercase\bibname}}{%
\section{References}}{}{}
\makeatother
\begin{filecontents*}{chap1.tex}
\chapter{First Chapter}
\section{First chapter, first section}
Watson and Crick \citeyearpar{watson53} proposed the structure of DNA.
\bibliographystyle{unsrtnat}
\bibliography{biblio}
\end{filecontents*}
\begin{filecontents*}{chap2.tex}
\chapter{Second Chapter}
\section{Second chapter, first section}
This is Einstein's famous paper \citep{einstein05}.
\bibliographystyle{unsrtnat}
\bibliography{biblio}
\end{filecontents*}
\begin{filecontents*}{biblio.bib}
@article{
watson53,
Author = {Watson, J. D. and Crick, F. H. C.},
Title = {Molecular Structure of Nucleic Acids: A Structure for Deoxyribose Nucleic Acid},
Journal = {Nature},
Volume = {171},
Number = {4356},
Pages = {737-738},
Year = {1953} }
@article
{einstein05,
Title   = {{Zur Elektrodynamik bewegter K{\"o}rper}.        ({German})
    [{On} the electrodynamics of moving bodies]},
Author  = {Albert Einstein},
Journal = {Annalen der Physik},
Year    = {1905},
Number  = {10},
Pages   = {891--921},
Volume  = {322}}
\end{filecontents*}
\begin{document}
\renewcommand{\bibsection}{\section{\bibname}}
\tableofcontents
\include{chap1}
\include{chap2}
\end{document}

相关内容