[Tex/LaTex] amsmath bibliography conflict

bibliographieserrors

Edit: I found a solution. I used the tocbibind package and replaced the line in the template with

\settocbibname{Bibliography}

I'm working on my thesis and my university has a LaTeX template package which renames the bibliography chapter from References to Bibliography and adds it to the table of contents like so

\renewcommand{\bibname}{Bibliography \addcontentsline{toc}{chapter}{Bibliography}}

But this causes a conflict between bibtex and amsmath and I get an error if I have both of the following lines in my file

 \usepackage{amsmath}
 \bibliography{bib}

where bib is the name of my bibliography file.

If I comment either one of those out it works fine but I get an error if I leave both of them in.

These are the errors I get

! Use of \reserved@a doesn't match its definition.\protected@write ...le@protect \edef \reserved@a {\write #1{#3}}\reserved@a ... \begin{thebibliography}{1}
! Use of \reserved@a doesn't match its definition.\protected@write ... #1{#3}}\reserved@a \endgroup\if@nobreak \ifvmode \nobr... \begin{thebibliography}{1}
! Extra }, or forgotten \endgroup.\markboth ...d@protected@xdef \@themark {{#1}{#2}}\@temptokena \expandafter ... \begin{thebibliography}{1}

I would very much appreciate suggestions for a workaround or an alternative to the renaming line.

Thanks.

Edit: It seems that the error is more complicated than I thought as I'm not able to reproduce it without using my university's template.

Here is the complete .sty file: http://pastie.org/8505568

And here is the minimum code to get the error:

\documentclass{report}
\usepackage{amsmath}
\usepackage{packages/RUMSC}

\begin{document}
\SSE{}
\MScwhen{Date in English}
\MScdags{Date in Icelandic}
\MSctitle{Thesis title in English}
\MScheiti{Thesis title in Icelandic}
\MScauthor{Author}

\makeMSc
\MSctableofcontents
\startMSc

text\cite{holman_heat_2010}.

\bibliographystyle{plain}
\bibliography{bibliography/bib}
\end{document}

The cited reference doesn't matter but the one I'm using is

@book{holman_heat_2010,
    address = {Boston, [Mass.]},
    title = {Heat transfer},
    isbn = {9780073529363  0073529362  9780071267694  0071267697},
abstract = {One of the most popular heat transfer texts of its time, Holman's book is noted for its clarity, accessible approach, and inclusion of many examples and problem sets. This new edition features design-oriented problems, and improved pedagogy.},
language = {English},
publisher = {{McGraw} Hill Higher Education},
author = {Holman, J. P},
year = {2010}
}

Best Answer

As you have discovered, the error is caused by the line:

\renewcommand{\bibname}{Bibliography \addcontentsline{toc}{chapter}{Bibliography}}

This is a terrible place to put the \addcontentsline command, and that's the source of the problem. The simplest solution (without modifying the package itself) is simply to undo this command and put the two parts separately into your document:

\bibliographystyle{plain}
\renewcommand{\bibname}{Bibliography}
\addcontentsline{toc}{chapter}{Bibliography}

Also, I should note that neither the \usepackage command nor the \bibliography commands really accept pathnames as arguments, so using \usepackage{packages/RUMSC} and \bibliography{bibliography/bib} is not correct, and not guaranteed to work. If you want things to be found properly, either put them in the same directory as your document, or put them into the appropriate directory in your local texmf directory. See the following question for more information.

Related Question