# Multibib bibliographies as subsections

The reason why I need this modification is that I want to have a general 'Bibliography' section in which all the bibliographies created with multibib are included. At the moment my code (narrowed down to a minimal working example) looks like this:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{Doe2013,
title = {The concept of anonymity},
author = {Doe, John},
publisher = {Void},
year = {2013}
}
\end{filecontents*}

\documentclass{article}
\usepackage{multibib}

\begin{document}
\tableofcontents
\nocite{Doe2013}
\clearpage
\section*{Bibliography}
\renewcommand{\refname}{Books and Articles}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}


This (obviously) will create three sections in the end, which is not what I intended for I wish to have one section ("References") with two subsections ("Advertisements" and "Books and Articles"). How can I obtain that the \bibliography'ish macros call \subsection* instead of \section*?

Here is a sample ads.bib:

@BOOK{Doe2014,
title = {The concept of anonymity 2},
author = {Doe, John},
publisher = {Void},
year = {2014}
}


## Edit

I forgot to mention that I want the bibliographies both automatically added to the TOC.

\usepackage{etoolbox}

\ifdefined\chapter
\newcommand{\refname}{References}
\patchcmd{\thebibliography}{\chapter*{\bibname}}{%
\section*{\refname}
}{}{}
\newcommand{\bibliographies}{%
\chapter*{\bibname}
}
\else
\newcommand{\bibname}{Bibliography}
\patchcmd{\thebibliography}{\section*{\refname}}{%
\subsection*{\refname}
}{}{}
\newcommand{\bibliographies}{%
\section*{\bibname}
}
\fi


and \bibliographies (which is defined in my code snippet) right before the bibliographies start.

As you can see I expanded the functionality to classes with \chapters.

## Edit

You can't use the above solution with natbib because it redefines the thebibliography environment so that the etoolbox patch won't be able to find what he is looking for. This code should do the job:

\usepackage{etoolbox}

\makeatletter
\providecommand{\bibname}{Bibliography}
\providecommand{\refname}{References}
{\renewcommand{\bibsection}{%
\@ifundefined{chapter}
{\subsection*{\refname \markboth{\refname}{\bibname}%
}
{\section*{\refname \markboth{\refname}{\bibname}%
}
}}
{\@ifundefined{chapter}
{\patchcmd{\thebibliography}{\section*{\refname}}{%
\subsection*{\refname}
}{}{}
}
{\patchcmd{\thebibliography}{\chapter*{\bibname}}{%
\section*{\refname}
}{}{}
}
}
\@ifundefined{chapter}
{\newcommand{\bibliographies}{%
\section*{\bibname}
{\newcommand{\bibliographies}{%
\chapter*{\bibname}
\makeatother

• Little additional request: What if I want to use this with natbib? (LaTeX yields some error messages if I add it...) – Krb Nov 30 '13 at 0:26

Here an alternativ suggestion:

load the package tocbibind and redefine section local:

\bgroup
\let\section\subsection
\renewcommand{\refname}{Books and Articles}
\bibliographystyle{plain}
\bibliography{\jobname}
\egroup


Here the complete code:

% arara: pdflatex
% arara: bibtex
% arara: bibtex: {  files:[ads.aux] }
% arara: pdflatex
% arara: pdflatex
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{Doe2013,
title = {The concept of anonymity},
author = {Doe, John},
publisher = {Void},
year = {2013}
}
\end{filecontents*}
@BOOK{Doe2014,
title = {The concept of anonymity 2},
author = {Doe, John},
publisher = {Void},
year = {2014}
}
\end{filecontents*}

\documentclass{article}
\usepackage[]{tocbibind}
\usepackage{multibib}

\begin{document}
\tableofcontents
\nocite{Doe2013}

• \let\section\subsection alone did the trick for me – Tom Mar 12 at 8:55