1

I am trying to create a customised list, but keep on getting an error message. I feel it's best if I post a MWE and a screenshot of the output.

\documentclass[]{article}

\usepackage{enumitem}

\newlist{mylist}{enumerate}{4}
\setlist[mylist,1]{
    label=(\Roman*)}
\setlist[mylist,2]{
    label=(\roman*),
    ref=(\Roman{mylisti}.\roman*)   }
\setlist[mylist,3]{
    label=(\textit{\alph*}),
    ref=(\Roman{mylisti},\roman{mylistii}.\textit{\alph*})  }
\setlist[mylist,4]{
    label=(\arabic*),
    ref=(\Roman{mylisti},\roman{mylistii}.\textit{\alph{mylistiii}}.\arabic*)   }

\begin{document}

\begin{mylist}
    \item level one, I
    \begin{mylist}
        \item level two, i
        \begin{mylist}
            \item level three, a
            \begin{mylist}
                \item level four, 1
            \end{mylist}
        \end{mylist}
    \end{mylist}
\end{mylist}

\end{document}

enter image description here

I've made custom lists before with enumitem with no issues, for example the following runs with no errors.

\newlist{my_list}{enumerate}{3}
\setlist[my_list,1]{
    label=(\roman*) }
\setlist[my_list,2]{
    label=(\textit{\alph*}),
    ref=(\roman{my_listi}.\textit{\alph*})  }
\setlist[my_list,3]{
    label=\arabic*.,
    ref=(\roman{my_listi}.\textit{\alph{my_listii}}.\arabic*)   }

I have played around for ages with the first one, but can't get it to work. I'd be very appreciative of help! Thanks :)

2

You simply have to add braces to commas in ref=:

\documentclass[]{article}

\usepackage{enumitem}

\newlist{mylist}{enumerate}{4}
\setlist[mylist,1]{
    label=(\Roman*)}
\setlist[mylist,2]{
    label=(\roman*),
    ref=(\Roman{mylisti}.\roman*) }
\setlist[mylist,3]{
    label=(\textit{\alph*}),
    ref=(\Roman{mylisti}{,}\roman{mylistii}.\textit{\alph*}) }
\setlist[mylist,4]{
    label=(\arabic*),
    ref=(\Roman{mylisti}{,}\roman{mylistii}.\textit{\alph{mylistiii}}.\arabic*)}

\begin{document}

\begin{mylist}
    \item level one, I\label{test-level-i}
    \begin{mylist}
        \item level two, i\label{test-level-ii}
        \begin{mylist}
            \item level three, a\label{test-level-iii}
            \begin{mylist}
                \item level four, 1 \label{test-level-iv}
            \end{mylist}
        \end{mylist}
    \end{mylist}
\end{mylist}
We see in \ref{test-level-iv}…

\end{document} 

enter image description here

  • Thanks very much. They weren't even supposed to be commas, but fullstops! Can't believe I wasted so long on that =P – Sam T Apr 6 '18 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.