引用(带超链接)在章节标题中不起作用(仅显示问号)

引用(带超链接)在章节标题中不起作用(仅显示问号)

在此处输入图片描述我遇到了以下奇怪的问题。我认为下面的最小工作示例是不言自明的。您可以找到 imsart 样式文件这里

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

在此处输入图片描述

相关内容