You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. The package documentation contains an interesting example that uses \EnumitemId to implement reverse counting. I implemented the proposed solution and the labels are correctly produced. However, cross-refs are not working (produce wrong values). Am I doing anything wrong? Please see the MWE below.
\documentclass{article}
\usepackage{enumitem}
\usepackage{calc,cleveref,crossreftools}
\crtrefundefinedtext{0}
\newcounter{revcount}
\newcommand\revcounter[1]{%\setcounter{revcount}{1+\crtcrefnumber{enum-\EnumitemId}-\value{#1}}}
\AddEnumerateCounter\revcounter\revcounter{} % the 2nd is dummy\SetEnumitemKey{revarabic}
{label = \revcounter*(\arabic{revcount}),
ref = (\arabic{revcount}),
after = \label{enum-\EnumitemId}}
\begin{document}
A reverse counting enumerate:
\begin{enumerate}[revarabic]
\item\label{item4} A
\item\label{item3} B
\item\label{item2} C
\item\label{item1} D
\end{enumerate}
The items \ref{item4} \ref{item3} \ref{item2} \ref{item1}
\end{document}
The output I'm getting is as follows:
Reverse counting enumerate:
(4) A
(3) B
(2) C
(1) D
The items (0) (4) (3) (2)
Any idea of what's going on? Thanks!
The text was updated successfully, but these errors were encountered:
Thank you @muzimuzhi, and sorry for the late answer. Although I always test all examples, for some reason this one doesn’t work. Either I didn’t do the tests well, or I’ve changed something in enumitem. As I explain in the manual, the solution is not the best (an fancy way of saying it’s actually poor), and I’ll try to find an alternative.
Hi. The package documentation contains an interesting example that uses \EnumitemId to implement reverse counting. I implemented the proposed solution and the labels are correctly produced. However, cross-refs are not working (produce wrong values). Am I doing anything wrong? Please see the MWE below.
The output I'm getting is as follows:
Any idea of what's going on? Thanks!
The text was updated successfully, but these errors were encountered: