# hyperref, smfbook, and bibliographies

I am writing a paper/book for a French journal, which requires use of the package "smfbook." Everything seems to work fine, except that hyperref, smfbook, and the bibliography do not seem to work well together (although each of the three pairs by themselves seems to work fine). As an example, consider the following file:

\documentclass[english]{smfbook}
\usepackage{hyperref}
\begin{document}

By~\cite{Wiles}.

\bibliographystyle{smfplain}
\bibliography{mybibliography}
\end{document}


Assume that mybibliography.bib is perfectly formatted. If I don't use hyperref, everything compiles perfectly. If I change "smfbook" to "amsbook", everything compiles perfectly. However, if I use smfbook and hyperref together, I get the following errors when I have a bibliography:

! Use of \H@old@schapter doesn't match its definition.
\NR@schapter #1->\H@old@schapter {
#1}\begingroup \let \@mkboth \@gobbletwo \...
l.10 \begin{thebibliography}{1}

?
! Extra }, or forgotten \endgroup.
\NR@schapter #1->\H@old@schapter {#1}
\begingroup \let \@mkboth \@gobbletwo \...
l.10 \begin{thebibliography}{1}


Unfortunately, this is gobbledygook to me (and presumably points to some conflicts between the smfbook style and whatever hyperref does, rather than something I did). Given I am forced to work with smfbook, are there any suggestions?

-
Dear lockstep, thanks for editing the TeX into a readable form. – Gobbledygook Jul 26 '11 at 22:49

The problem seems to be in the fact that smfbook defines \chapter* with an optional argument and hyperref doesn't expect this.

\documentclass[english]{smfbook}
\usepackage{etoolbox}
\patchcmd{\thebibliography}{*}{}{}{}
\pretocmd\thebibliography{\csname c@secnumdepth\endcsname=-2 }{}{}

\usepackage{hyperref}
\begin{document}

By~\cite{Wiles}.

\bibliographystyle{smfplain}
\bibliography{mybibliography}
\end{document}


I patch thebibliography so that it issues \chapter instead of \chapter*, but also locally sets secnumdepth to -2, so the chapter still won't be numbered. This has the consequence that the bibliography will go in the table of contents, which it should do anyway.

-
Thankyou, it worked – Gobbledygook Jul 27 '11 at 19:00
In case other people run into the same problem: it is absolutely essential that the patch be done before hyperref is loaded, otherwise the document will compile, but there will be no bibliography. – Daniel Miller Dec 24 '13 at 2:31