我想用超链接引用命名的(但未编号的)定理。我有一个解决方案,我认为它至少是半破解的:
\documentclass{amsart}
\usepackage[colorlinks=true]{hyperref}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem*{Zorn}{Zorn's lemma}
\begin{document}
\begin{Zorn}
\hypertarget{lem:Zorn}{}
This is Zorn's lemma
\end{Zorn}
That was \hyperlink{lem:Zorn}{Zorn's lemma}.
\end{document}
不过,我想知道是否存在一个更简洁的解决方案(可能使用thmtools
或cleveref
)可以引用\label
无编号定理的?
答案1
使用假计数器来保持hyperref
快乐:
\documentclass{amsart}
\usepackage{amsthm,lipsum}
\usepackage[colorlinks=true]{hyperref}
\theoremstyle{plain}
\newtheorem*{namedthm}{\namedthmname}
\newcounter{namedthm}
\makeatletter
\newenvironment{named}[1]
{\def\namedthmname{#1}%
\refstepcounter{namedthm}%
\namedthm\def\@currentlabel{#1}}
{\endnamedthm}
\makeatother
\begin{document}
\begin{named}{Zorn's lemma}\label{lem:Zorn}
This is Zorn's lemma
\end{named}
\lipsum[1-6]
That was \ref{lem:Zorn}.
\end{document}
你可以拥有任意数量的未编号定理。