1

I have a list of conditions in a definition like the following:

\begin{enumerate}
\item \( \recfnl{j}{X \Tplus 0^{\pair{n}{0} - 1}\concat[0]}{}\diverge \) 
\item \( \recfnl{j}{X \Tplus 0^{\pair{n}{0} - 1}\concat[1]}{}\diverge \) 
\item \( \recfnl{j}{X \Tplus 0^{\pair{n}{0} - 1}\concat[0]}{} \compat \recfnl{j}{X \Tplus 0^{\pair{n}{0} - 1}\concat[1]}{} \) 
\item \( \recfnl{j}{X \Tplus Z}{} \neq B \) 
\item \( B \Tplus \jump{X} \Tgeq Z \) \label{def:trackable:B-computes}
\end{enumerate}

And I'd like to say something like:

When conditions (1)-(\ref{def:trackable:B-computes} -1) fail then...

Where \ref{def:trackable:B-computes} -1 gives me the value of the previous item in the list. Obviously, I could just label the previous item in the list but I'd like this to work even if I end up changing/reordering/etc the prior items.

I'm using enumitem (in an amsart). I found this answer but I'm hoping this is going to be easier. If I'd need to define another external counter or other really complex stuff I'll just give up and do it manually.

1 Answers1

1

\ref is not expandable. However, the refcount package provides \getrefnumber which is expandable.

Because the method works by writing the information out to the aux file as \newlabel{def:trackable:B-computes}{{5}{1}{}{}{}}, two compilations are required to resolve the number.

\documentclass{article}
\usepackage{refcount}
\begin{document}
\begin{enumerate}
\item First 
\item Second 
\item Third 
\item Fourth
\item Fifth \label{def:trackable:B-computes}
\end{enumerate}

When conditions (1)-(\the\numexpr \getrefnumber{def:trackable:B-computes} -1\relax ) fail then... \end{document}

enter image description here