0

I have a section whose title is "Proof of theorem 1" which I get by typing

\section{Proof of \cref{myTheorem}}

which works fine in the section title itself, however where the section title is reproduced in the page header, cleveref doesn't know what to do, and so produces "Proof of ??". Here is a working example.

\documentclass[twoside]{report}

\usepackage{cleveref}
\usepackage{amsthm}
    \newtheorem{theorem}{Theorem}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\rightmark}

\begin{document}
    
\chapter{Introduction}

\begin{theorem}\label{myTheorem}
    Something I want to prove.
\end{theorem}

Some filler text\dots

\newpage

\section{Proof of \cref{myTheorem}}

\begin{proof}
    Proof of the thing I want to prove.
\end{proof}

\end{document}

The result looks like this: enter image description here

I have tried recompiling my document several times, without success. This example uses fancyhdr, but the same problem happened when I had a header that didn't use this package. I haven't been able to find anywhere online discussing this, nor anything in the cleveref documentation (although I didn't read that cover to cover).

It is possible to bodge the problem by instead writing

\section{Proof of theorem \ref{myTheorem}}

but I would like to know if there is a way to fix this using \cref.

4
  • with a current latex you could use \NoCaseChange{\cref{myTheorem}} to avoid that the label is uppercased, but you would get a lowercase theorem in the header which looks odd. You could probably get around it with a special cref-format but using \ref is the much easier solution. Jul 9 at 12:36
  • @UlrikeFischer Adding textcase as a package, and writing \NoCaseChange{\cref{myTheorem}} instead of \cref{myTheorem} does not produce any change in the output for me Jul 9 at 12:41
  • well I wrote: "with a current latex". If you need the textcase package you don't have it. Jul 9 at 12:51
  • @UlrikeFischer Ah, I have now got your suggestion to work, thank you Jul 9 at 13:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.