[Tex/LaTex] Reference undefined in \section with amsbook

amsbookcross-referencingheader-footersectioning

I have a section that is devoted to the proof of a theorem, and hence I used

\section{Proof of Theorem~\ref{thm}}

Of course, because of the headers that are capitalized, it asks for \ref{THM} when producing the header, and I get an obvious error. What is the proper way to handle such a case? Below is a MWE:

\documentclass{amsbook}
\usepackage{lipsum}
\newtheorem{thm}{Theorem}
\begin{document}
\chapter{First Chapter}
\section{The Theorem}
\begin{thm}[Lipsum Theorem]
\label{thm}
\lipsum[1]
\end{thm}
\section{Proof of Theorem~\ref{thm}}
\lipsum[1-23]
\end{document}

When compiling I get:

LaTeX Warning: Reference `THM' on page 3 undefined on input line 14.

(each time it produces a header), and the header shows

`2. PROOF OF THEOREM ??'

Best Answer

If you don't feel like hacking around and don't mind just circumventing your problem: a theorem can have multiple labels, so give it \label{THM} as well.

Related Question