2

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.

3
  • This is the second time you've edited one of your questions with a comment pointing to the answer. Instead of adding such comments, it's more helpful to "accept" the answer that helped you by clicking on the checkmark icon beside the answer.
    – Alan Munn
    Commented Sep 17, 2023 at 20:24
  • Thanks for pointing out the checkmark. Is that in place of or in addition to the up arrow, which I already clicked?
    – shmuel
    Commented Sep 18, 2023 at 0:03
  • It's in addition. The up arrow lets you (and others) vote on the answer. The checkmark allows you as the person who asked the question to choose the answer that helped you the most. In cases like this, where there's one definitive answer there's not an obvious choice, but in cases where more than one good answer is given, you get to choose which one was best for you.
    – Alan Munn
    Commented Sep 18, 2023 at 3:06

1 Answer 1

4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .