I want to use the \crefname
macro from the cleveref
package to set the label names on several layers of an enumerate
environment. The following code works very well:
\documentclass{article}
\usepackage{forloop}
\usepackage{cleveref}
\newcounter{ct}\forloop{ct}{1}%
{\value{ct}<10}
{\crefname{enum\roman{ct}}{case}{cases}}
\begin{document}
\begin{enumerate}
\item \label{l} test
\begin{enumerate}
\item test
\item \label{k} test
\end{enumerate}
\end{enumerate}
\cref{l,k}
\end{document}
However, it stops working when I use the enumitem
package:
\documentclass{article}
\usepackage{forloop}
\usepackage{enumitem}
\usepackage{cleveref}
\newlist{test}{enumerate}{10}
\setlist[test]{label=\arabic*}
\newcounter{ct}\forloop{ct}{1}%
{\value{ct}<10}
{\crefname{test\roman{ct}}{case}{cases}}
\begin{document}
\begin{test}
\item \label{l} test
\begin{test}
\item test
\item \label{k} test
\end{test}
\end{test}
\cref{l,k}
\end{document}
You can check that adding \crefname{testi}{case}{cases}
will indeed make the first reference label correctly, so I have no idea why this is not working. It'd be great if someone could tell me what is going wrong and how to fix it.