2

Previous questions (chapterbib as section not chapter et al.) have considered how to include bibliographies at the end chapters. This question concerns bibliographies at the end of chapters when natbib is used as a citation package.

In the preamble, I wrote

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

with

\bibliographystyle{unsrtnat}
\bibliography{biblio}

in each \include(d) file. I ran LaTeX on the main file (test2.tex) and bibtex on each auxillary file (chap1.aux and chap2.aux), and then LaTeX again, twice, on test2.tex. This gave:

  • The correct style (from \bibliographystyle{unsrtnat})
  • The references inserted as a numbered section (from \usepackage{chapterbib) and using \patchcmd)
  • BUT, the section that includes the references is excluded from the Table of Contents

What is the correct way to use natbib to have references placed as a section within a chapter and included in the Table of Contents? If \usepackage{natbib} is excluded, the code generates references that are included as a numbered section as well as being included in the Table of Contents, but (of course) the natbib style is not applied.

I have read the chapterbib (Arseneau 2010) and natbib (Daly 2010) reference material entirely.

Here is my minimum non-working example:

\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}
  • check out addcontentsline – Mark Jan 19 '16 at 5:01
0

Solved using solution given here: How can I add the bibliography in a report with its own section, including number.

\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}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.