1

I've modified my enumerate environment using the following sentences:

\renewcommand{\labelenumi}{\textbf{\arabic{enumi}.}}
\renewcommand{\labelenumii}{\textbf{(\alph{enumii})}}
\renewcommand{\labelenumiii}{\textbf{(\roman{enumiii})}}

However, if I write something as

\begin{enumerate}
  \item
  \begin{enumerate}
    \item \label{refme}
  \end{enumerate}
\end{enumerate}

and then refer it using according to \cref{refme}, I'm getting "according to 1a" instead of "according to 1.(a)".

Is it possible to do something so that it respects my modified format?

4

Instead of manipulating the low-level macros \labelenumi, \labelenumii, and \labelenumiii directly, I suggest you (a) load the enumitem package, (b) create a custom enumerated list called myenum and define the label and ref properties of levels 1 thru 3 of such list items.

enter image description here

Speaking for myself, I can't help but remark that the citation call-outs look both ugly and distracting. At the very least, do consider not using a bold typeface for the cross-references.

\documentclass{article}
\usepackage{enumitem,cleveref}

\newlist{myenum}{enumerate}{3}
\setlist[myenum,1]{label=\textbf{\arabic*.},
                   ref  =\textbf{\arabic*.}}
\setlist[myenum,2]{label=\textbf{(\alph*)},
                   ref  =\themyenumi\textbf{(\alph*)}}
\setlist[myenum,3]{label=\bfseries(\roman*),
                   ref  =\themyenumii\textbf{.(\roman*)}}

\crefname{myenumi}{item}{items}
\crefname{myenumii}{item}{items}
\crefname{myenumiii}{item}{items}

\begin{document}

\begin{myenum}
\item \label{refone}
  \begin{myenum}
    \item \label{reftwo} bla bla
    \begin{myenum}
      \item \label{refthree} bleep bleep
    \end{myenum}
  \end{myenum}
\item \label{reffour}
  \begin{myenum}
    \item xxx
    \item \label{reffive} bli bli
    \begin{myenum}
      \item yyy
      \item \label{refsix} bloop bloop
    \end{myenum}
  \end{myenum}
\end{myenum}

\noindent
Cross-references to \cref{refone,reffour}, \cref{reftwo,reffive}, and \cref{refthree,refsix}.  
\end{document}

Addendum: If you insist on using the low-level macros \labelenumi, \labelenumii, and \labelenumiii, I think you should use the following code in the preamble. Note that this code also modifies \theenumi, \theenumii, and \theenumiiii as well as the "prefix macros" \p@enumi and \p@enumiii. (Observe that this code will not use bold-face while typesetting the cross-referencing call-outs. This is because I think it's really ugly to create bold-faced cross-referencing call-outs.)

\renewcommand{\theenumi}{\arabic{enumi}}
\renewcommand{\theenumii}{(\alph{enumii})}
\renewcommand{\theenumiii}{(\roman{enumiii})}
\renewcommand{\labelenumi}{\textbf{\theenumi.}}
\renewcommand{\labelenumii}{\textbf{\theenumii}}
\renewcommand{\labelenumiii}{\textbf{\theenumiii}}
\makeatletter
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi\theenumii}
\makeatother
  • Thanks for your answer. Worked great except for one thing: when referring, the `enumi' part applied corresponds to the actual value of the counter and not the one I'm referring to. – mflopezabu Jan 16 '18 at 3:08
  • @mflopeza - Please see my revised answer. – Mico Jan 16 '18 at 3:46
  • 2
    Went with the new environment and worked like a charm! Also followed your advice of omitting the boldface in the cross-reference. Thanks! – mflopezabu Jan 16 '18 at 14:35

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.