How to change the name for a clone of enumerate using enumitem and cleveref

cleverefcounterscross-referencingenumitemlists

I want to construct a numbered list of items for which reference have issue rather than item. I'm using cleveref and enumitem, defining issue as an alias of enumerate with \newlist, and defining the name with \crefname. My output for \cref has a question mark instead of issue and doesn't recognize its operands as being in the same list. What am I missing or doing wrong?

The source is

\documentclass[b4paper]{article}
\usepackage{enumitem}
\usepackage{eqparbox}
\usepackage{expl3}
\usepackage{fontspec}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{listings}         %Requires luatex engine to handle UTF-8
                              %Consider using minted, but ...
\usepackage{makeidx}
\usepackage{upquote}
\usepackage{cleveref}

\newlist{issue}{enumerate}{2} %% <- pick a larger number if you want to nest these
\crefname{issue1}{issue}{issues}
\Crefname{issue1}{Issue}{Issues}


\begin{document}
The namecref value of issue:MB is \namecref{isse:MB}. Expecting "issue".

Elaboration of this issue may be added to \cref{issue:MB,issue:UTF-8}. Expecting "issues 1 and  2" with boxes around the numbers.

\begin{issue}[label=\arabic*,ref=\fbox{\arabic*}]

\item{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730866}%
{Multi-Byte Representations}}.
\label{issue:MB}

\item{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730846}%
{UTF-8 Support}}
\label{issue:UTF-8}

\end{issue}


\begin{issue}[label=\arabic*,ref=\fbox{\arabic*}]

\item
{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730964}%
{Unicode Strings}}
\label{sec:US}

\item{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730903}%
{Unassigned \& Invalid Code Points}}
\label{sec:UICP}

\end{issue}

\end{document}

As Alan Munn spotted, I was using Arabic numerals in the counter name when roman numerals are required.

Best Answer

When you create a new list using enumitem, it creates a set of counters for that list depending on the number of levels you choose. So in your particular case, you defined the list using:

\newlist{issue}{enumerate}{2}

This means that enumitem creates two counters: issuei and issueii. These are the counters that you need to tell cleveref to use:

\crefname{issuei}{issue}{issues}
\Crefname{issuei}{Issue}{Issues}

And the same for issueii for your second level. Your other error was just a typo in the label.

I would recommend setting the formatting of the list label and reference for each level using \setlist* then you don't need to set it for each list in the document.

\documentclass[b4paper]{article}
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{hyperref}

\usepackage{cleveref}

\newlist{issue}{enumerate}{2} %% <- pick a larger number if you want to nest these
\setlist*[issue,1]{label=\arabic*,ref=\fbox{\arabic*}} % best set the defaults for the list here
\setlist*[issue,2]{label=(\alph*),ref=(\alph*)}
\crefname{issuei}{issue}{issues}
\Crefname{issuei}{Issue}{Issues}
\crefname{issueii}{subissue}{subissues}
\Crefname{issueii}{Subissue}{Subissues}


\begin{document}
The namecref value of issue:MB is \namecref{issue:MB}. Expecting ``issue".  The name of subissues: \namecref{subissue}.

Elaboration of this issue may be added to \cref{issue:MB,issue:UTF-8}. Expecting "issues 1 and  2" with boxes around the numbers.  A reference to \cref{subissue}.

\begin{issue}
\item{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730866}%
{Multi-Byte Representations}}.
\label{issue:MB}
\item{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730846}%
{UTF-8 Support}}
\label{issue:UTF-8}
\end{issue}


\begin{issue}
\item
{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730964}%
{Unicode Strings}}
\label{sec:US}
\begin{issue}
\item A sub issue
\label{subissue}
\end{issue}
\item{\href{https://github.com/users/RexxLA/projects/2/views/6?pane=issue&itemId=35730903}%
{Unassigned \& Invalid Code Points}}
\label{sec:UICP}
\end{issue}

\end{document}

output of code

Related Question