Ссылка (с гиперссылкой) не работает в заголовке раздела (отображаются только вопросительные знаки)

Ссылка (с гиперссылкой) не работает в заголовке раздела (отображаются только вопросительные знаки)

введите описание изображения здесьУ меня возникла следующая странная проблема. Я думаю, что минимальный рабочий пример ниже говорит сам за себя. Вы можете найти файл imsart-styleздесь.

\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

Класс делает это \MakeUppercase, что также преобразует аргумент в \ref.

Используйте textcaseс overloadопцией.

Обратите внимание, что я удалил ненужное \texorpdfstring. Также appendixне является средой, используйте \appendix.

Также \RequirePackageдолжно быть \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}

введите описание изображения здесь

Вы можете сделать всю «Теорему 1.1» ссылкой, используя \autoref, но вам нужно дополнить textcaseсписок команд, освобожденных от необходимости преобразования аргументов в верхний регистриизменить autorefимя.

\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}

введите описание изображения здесь

Связанный контент