[Tex/LaTex] How to add the bibliography in a report with its own section, including number

bibliographiesnumberingsectioningtable of contents

I'm writing my thesis as a report document using TeXShop (pdflatex and bibtex) and want the bibliography to get its own section number and appear in the table of contents. Here's what I've tried so far and the problems arising:

\addcontentsline{toc}{section}{References}

Does not add the section number, not in the toc and naturally not in the section title.

\cleardoublepage
\renewcommand*{\bibname}{\section{References}}
\bibliographystyle{plain}
\bibliography{bibliography}

Error: ! Incomplete \iffalse; all text was ignored after line 1.

\cleardoublepage
\section{References}
\renewcommand*{\bibname}{}
\bibliographystyle{plain}
\bibliography{bibliography}

The only problem this leaves is that this starts the actual bibliography on the next page after it inserts 2.5 References. Otherwise I would be happy with this solution. How can I solve this issue?

Best Answer

Preliminary remark: In the report class, the bibliography will by default be typeset as an unnumbered chapter. If I understand correctly, you do not only want the bibliography to be numbered, but also "downgraded" to a section.

One solution is to selectively change the definition of \thebibliography. Add the following to your preamble:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\thebibliography}{%
  \chapter*{\bibname}\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}{%
  \section{References}}{}{}
\makeatother

In the main document body, just use

\bibliographystyle{plain}
\bibliography{bibliography}

I left out \cleardoublepage for the sake of consistency (sections do not automatically start a new page).

Related Question