I would like an automatic solution to referencing theorem environments containing lists using cleveref
. In other words, if Corollary 1.2 contains parts (a) and (b), I want \cref
to output “Corollary 1.2(a)” when referring to that theorem part. Horever, in proofs and similar situations, I want to be able to refer to, say, “part (a)” without having “1.2” in front.
Much of the solution is already available in this excellent answer, which contains the following example. However, as you see, I cannot write simply “(a)” without having the “1.2” part attached to it. How can this solution be modified to allow references to individual theorem parts without also getting the theorem number?
EDIT: I might add that I am actually going to use the ntheorem
package to produce theorems, but I assume that it does not really change anything in the solution. And I think it is better to build upon the existing example.
\documentclass[english]{amsart}
\usepackage{babel}
\usepackage{enumitem} % for '\newlist' and '\setlist' macros
\usepackage[colorlinks=true]{hyperref}
%%\usepackage{amsthm} % is loaded automatically by amsart document class
\usepackage[nameinlink]{cleveref}
\newtheorem{thm}{Theorem}[section]
\crefname{thm}{Thm.}{Thms.} % singular and plural forms of label
\newtheorem{cor}[thm]{Corollary}
\crefname{cor}{Cor.}{Cors.} % singular and plural forms of label
\newlist{enumthm}{enumerate}{1} % set up a dedicated enumeration env.
\setlist[enumthm]{label=\upshape(\alph*),ref=\upshape\thethm(\alph*)}
\crefalias{enumthmi}{thm} % alias 'enumthmi' counter to 'thm'
\newlist{enumcor}{enumerate}{1} % set up a second dedicated enumeration env.
\setlist[enumcor]{label=\upshape(\alph*),ref=\upshape\thecor(\alph*)}
\crefalias{enumcori}{cor} % alias 'enumcori' counter to 'cor'
\begin{document}
\setcounter{section}{1} % just for this example
\begin{thm}\label{Thm:One}
The following properties hold:
\begin{enumthm}
\item\label{Thm:One:1} \(1>0\)
\item\label{Thm:One:2} \(0<1\)
\end{enumthm}
\end{thm}
\begin{cor}\label{Thm:Two}
The following properties hold as well:
\begin{enumcor}
\item\label{Thm:Two:1} \(2>1\)
\item\label{Thm:Two:2} \(1<2\)
\end{enumcor}
\begin{proof}
\ref{Thm:Two:1} follows from \ref{Thm:One:1} by adding 1 on both sides. Similarly, \cref{Thm:Two:2} follows from \cref{Thm:One:2}.
\end{proof}
\end{cor}
\end{document}
\cref
? – Mico Oct 27 '16 at 11:57\localref
to output simply “(a)”. – Gaussler Oct 27 '16 at 12:11ntheorem
to set your theorems. just a caution --amsthm
is incorporated directly intoamsart
; it's not a loaded package, so it can't easily be excluded. and there are some slight differences between the code in the class vs. the package, not in any way that materially affects the output, but it certainly isn't going to make usingntheorem
at all easy, if you intend to continue usingamsart
. – barbara beeton Oct 30 '16 at 21:45