2

enter image description hereI have the following strange problem. I think the minimal working example below is self-explanatory. You can find the imsart-style file here.

\documentclass[aop,preprint]{imsart}
\RequirePackage{amsthm,amsmath,amsfonts,amssymb}
\RequirePackage[numbers]{natbib}
\RequirePackage{mathtools}
\RequirePackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}

\startlocaldefs

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]

\endlocaldefs

\begin{document}

\tableofcontents

\section{Introduction}
\begin{theorem} \label{theo} This is the first theorem.
\end{theorem}

\section{Proof of \texorpdfstring{\hyperref[theo]{Theorem \ref*{theo}}}{Theorem 1.1}} 

In this section heading the reference does work.

\begin{appendix}

\section{Proof of \texorpdfstring{\hyperref[theo]{Theorem \ref*{theo}}}{Theorem 1.1}} 

In this section heading the reference does not work. Surprisingly, in the table of contents both references work.

\end{appendix}

\end{document}

1
5

The class does \MakeUppercase, which also transforms the argument to \ref.

Use textcase with the overload option.

Note that I removed the unnecessary \texorpdfstring. Also appendix is not an environment, use \appendix.

Also \RequirePackage should be \usepackage.

\documentclass[aop,preprint]{imsart}
\usepackage{amsthm,amsmath,amsfonts,amssymb}
\usepackage[numbers]{natbib}
\usepackage{mathtools}
\usepackage[overload]{textcase}
\usepackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}

\startlocaldefs

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]

\endlocaldefs

\begin{document}

\tableofcontents

\section{Introduction}
\begin{theorem} \label{theo} This is the first theorem.
\end{theorem}

\section{Proof of Theorem \ref{theo}} 

In this section heading the reference does work.

\appendix

\section{Proof of Theorem \ref{theo}}

In this section heading the reference does not work. Surprisingly, in the table of contents both references work.

\end{document}

enter image description here

You can make the whole “Theorem 1.1” a link by using \autoref, but you need to supplement textcase list of commands exempt from uppercasing their argument and to change the autoref name.

\documentclass[aop,preprint]{imsart}
\usepackage{amsthm,amsmath,amsfonts,amssymb}
\usepackage[numbers]{natbib}
\usepackage{mathtools}
\usepackage[overload]{textcase}
\usepackage{etoolbox}
\usepackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}

\startlocaldefs

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\makeatletter
\patchcmd{\@uclcnotmath}
  {\ref}
  {\ref\@nonchangecase\autoref}
  {}{}
\makeatother

\endlocaldefs

\begin{document}

\tableofcontents

\section{Introduction}
\begin{theorem} \label{theo} This is the first theorem.
\end{theorem}

\section{Proof of \autoref{theo}}

In this section heading the reference does work.

\appendix
\renewcommand{\theoremautorefname}{THEOREM}

\section{Proof of \autoref{theo}}

In this section heading the reference does not work. Surprisingly, 
in the table of contents both references work.

\end{document}

enter image description here

7
  • Your solution works, but I would like to keep the hyperref command because I would like that the whole expression "Theorem 1.1" is a blue clickable link, and not only the number. I tried to adapt your answer to the hyperref command, but this does not work. Any ideas how to solve this?
    – user144921
    Mar 22 '20 at 18:31
  • @user144921 - To get a larger clickable target in section 2, just replace Theorem \ref{theo} with \autoref{theo}.
    – Mico
    Mar 22 '20 at 18:35
  • I need the \texorpdfstring command because I use \hyperref.
    – user144921
    Mar 22 '20 at 18:35
  • \autoref{theo} works fine in the second section. But in the appendix again the question marks appear. This is so strange.
    – user144921
    Mar 22 '20 at 18:38
  • Where exactly appendix environment has been defined in this files?
    – user108724
    Mar 22 '20 at 18:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.