I am trying to define a variant of \ref
that picks out only the item number of an in-theorem list item without the preceding theorem number. For example:
Theorem 1.1.
(i) Something important.
(ii) Something important that refers to (i).
However, I can only manage the following:
Theorem 1.1.
(i) Something important.
(ii) Something important that refers to 1.1(i).
Note that I do still want to be able to print the counter 1.1(i), since I may wish to use it later on in the document. That is, in addition to being able to print 1.1(i) and Theorem 1.1(i) using the commands \ref{theoremlabel}
and \Cref{theoremlabel}
respectively, I'd like a new command \itemref{itemlabel}
that prints just (i). I would like all three to be clickable too (using the hyperref
package).
Note that this is very similar to the question ref to subsection number only and I've tried to adapt the solution givien there by Marco Daniel but alas my TeX coding skills are lacking.
Here's my MWE:
\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{enumitem}
\newlist{thmlist}{enumerate}{1}
\setlist[thmlist]{label=(\roman{thmlisti}), ref=\thethm(\roman{thmlisti})}
\usepackage{hyperref}
\usepackage[nameinlink]{cleveref}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\Crefname{thm}{Theorem}{Theorems}
\addtotheorempostheadhook[thm]{\crefalias{thmlisti}{thm}}
\begin{document}
\section{A theorem}
\begin{thm}\label{theoremlabel}~
\begin{thmlist}
\item\label{itemlabel} Something important.
\item Something important about \ref{itemlabel}. [Here's where I'd like to use my proposed \verb+\itemref{itemlabel}+ command.]
\end{thmlist}
\end{thm}
Later on in my document... Isn't \Cref{theoremlabel} interesting? I particularly like its clickable counter \ref{theoremlabel}.
\end{document}
Notet: The clever trick using the \addtotheorempostheadhook
command is due to T. Verron in the question Reference to List Items in Theorem Environment with Label Type “Theorem”.
Many thanks in advance!
refcount
in my mind, in conjunction withxstring
. – user31729 Sep 9 '15 at 16:38