2

In the following MWE, the reference to a nested item of the list is denoted by 2. (ii) but I would like 2. (b) (ii).

Could you help me to fix my code?

\documentclass{article}
\usepackage[shortlabels]{enumitem}

\setlist[enumerate, 1]
{1., 
leftmargin  = 2em,
itemindent  = 0pt,
labelwidth  = 2em,
labelsep    = 0pt,
font        = \bfseries,
align       = left,
itemsep     = 1.5mm,
ref         = \mbox{\textup{\textbf{\arabic*.}}}}

\setlist[enumerate, 2]
{(a),
itemindent = 0pt,
labelwidth = 1.3em,
labelsep = 4pt,
align = left,
itemsep = 0.5mm,
ref=\mbox{\textup{\textbf{\theenumi{}}\hspace{1pt}(\alph*)}}}

\setlist[enumerate, 3]
{(i),
itemindent = 0pt,
labelwidth = 1.5em,
labelsep = 4pt,
align = left,
itemsep = 0.25mm,
ref=\mbox{\textup{\textbf{\theenumi{}}\hspace{1pt}(\roman*)}}}


\begin{document}

\begin{enumerate}
\item test

\item test
\begin{enumerate}
\item tast

\item tast
\begin{enumerate}
\item tost
\item \label{my_label}My label is here.
\item tost
\end{enumerate}

\item tast
\end{enumerate}

\item test
\end{enumerate}

In \ref{my_label}, we saw.

\end{document}

enter image description here

EDIT

I tried replacing the last piece of code by

\setlist[enumerate, 3]
{(i),
itemindent = 0pt,
labelwidth = 1.5em,
labelsep = 4pt,
align = left,
itemsep = 0.25mm,
ref=\mbox{\textup{\textbf{\theenumii{}}\hspace{1pt}(\roman*)}}}

enter image description here

The result is better but the (b) is in bold font.

Is it possible to have it in normal font? From my reading of the documentation of enumitem, it seems to be impossible.

2
  • 1
    ref=\mbox{\theenumii\hspace{1pt}(\roman*)} should give you the desired result.
    – leandriis
    Jan 19 '20 at 9:51
  • Yes, it works! Thanks :-)
    – Colas
    Jan 19 '20 at 13:41
1

In the following example, I also tried to simplify the other ref options as well.

enter image description here

\documentclass{article}
\usepackage[shortlabels]{enumitem}

\setlist[enumerate, 1]
{1., 
leftmargin  = 2em,
itemindent  = 0pt,
labelwidth  = 2em,
labelsep    = 0pt,
font        = \bfseries,
align       = left,
itemsep     = 1.5mm,
ref         = \mbox{\textbf{\arabic*.}}}

\setlist[enumerate, 2]
{(a),
itemindent = 0pt,
labelwidth = 1.3em,
labelsep = 4pt,
align = left,
itemsep = 0.5mm,
ref=\mbox{\theenumi{}\hspace{1pt}(\alph*)}}

\setlist[enumerate, 3]
{(i),
itemindent = 0pt,
labelwidth = 1.5em,
labelsep = 4pt,
align = left,
itemsep = 0.25mm,
ref=\mbox{\theenumii\hspace{1pt}(\roman*)}}


\begin{document}

\begin{enumerate}
\item test \label{first-level}

\item test
\begin{enumerate}
\item tast \label{second-level}

\item tast
\begin{enumerate}
\item tost
\item \label{third-level}My label is here.
\item tost
\end{enumerate}

\item tast
\end{enumerate}

\item test
\end{enumerate}

In \ref{first-level}, we saw.

In \ref{second-level}, we saw.

In \ref{third-level}, we saw.



\end{document}
1
  • I have added a \textup{} because I don't like when the reference is in italics because the context is in italics.
    – Colas
    Jan 19 '20 at 18:23

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.