Библиография ведет себя как раздел в оглавлении

Библиография ведет себя как раздел в оглавлении

Можно ли включить ссылки/библиографии в оглавление с соответствующим номером раздела?

На данный момент мой MWE ниже приводит к следующему изображению: введите описание изображения здесь

Мой МВЭ:

\documentclass{report}

\usepackage[resetlabels]{multibib}
% Implements functionality to "append" and "prepend" code to other commands
\usepackage{etoolbox}

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

\newcites{A}{References}
\newcites{B}{References}

\begin{document}

\tableofcontents

\chapter{First Chapter}
  \section{A section}
  this is a citation \citeA{aa}
  \bibliographystyleA{plain}
  \bibliographyA{lit}

 \chapter{Second Chapter}
  \section{A section}
  this is another citation \citeB{bb}
  \bibliographystyleB{plain}
  \bibliographyB{lit}   

\end{document}

и lit.bibфайл выглядит следующим образом:

@Article{aa,
  author =   {Author, A.},
  title =    {Title},
  journal =  {Journal},
  year =     2000
}

@Article{bb,
  author =   {Brother, B.},
  title =    {Titling},
  journal =  {Ann. J.},
  year =     2002
}

Для компиляции необходимо запустить:

pdflatex main.tex
bibtex A.aux
bibtex B.aux
pdflatex main.tex
pdflatex main.tex

решение1

Заменить следующие строки

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

с

\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

Результат:

введите описание изображения здесь

Связанный контент