I have seen here how roman numerals can be used in enumerate lists. How could I create nested lists with roman numerals, to get something like this?
(i) ...
(i.i) ...
(i.ii) ...
(ii) ...
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI have seen here how roman numerals can be used in enumerate lists. How could I create nested lists with roman numerals, to get something like this?
(i) ...
(i.i) ...
(i.ii) ...
(ii) ...
Since you mention that the roman-lowercase enumeration style is a one-off requirement for your document, I suggest you (a) load the enumitem
package and (b) use its machinery to provide the formatting requirements as optional arguments to the respective instances of \begin{enumerate}
.
When creating cross-references to items in roman-enumerated lists, I suggest you omit the round parentheses. As the following example shows, the setup recommended in the preceding paragraph is sufficiently general/robust to allow the use of \cref
directives to create cross-references.
\documentclass{article}
\usepackage{enumitem}
\usepackage[colorlinks,allcolors=blue]{hyperref} % optional
\usepackage[nameinlink]{cleveref} % optional, for \cref macro
\begin{document}
\begin{enumerate}[label=(\roman*),ref=\roman*]
\item \dots \label{list:1}
\begin{enumerate}[label=(\theenumi.\roman*),ref=\theenumi.\roman*]
\item \dots
\item \dots \label{list:2.b}
\end{enumerate}
\item \dots
\end{enumerate}
Cross-references to items \ref{list:1} and \ref{list:2.b}.
Cross-references to \cref{list:1,list:2.b}.
\end{document}
\begin{enumerate}[ ref=\roman* , label=(\noexpand\theenumi) ]
. This is likely highly dependent on the exact implementation of the package though, so do not recommend (that noexpand is even necessary)
Apr 22, 2022 at 15:08
Like this.
%! TEX program = pdflatex
\documentclass{article}
\usepackage[shortlabels]{enumitem}
\begin{document}
\setlist[enumerate,1]{label=(\roman*)}
\setlist[enumerate,2]{label=(\roman{enumi}.\roman*)}
\begin{enumerate}
\item
\begin{enumerate}
\item 1
\item 2
\end{enumerate}
\item
\begin{enumerate}
\item 1
\item 2
\end{enumerate}
\end{enumerate}
\end{document}
Turns out the documentation is a bit lacking, for more complex operations it presupposes knowledge of the enumerate
environment in LaTeX.
Read "printing counters" and "enumerate [environment]" chapter in LaTeX unofficial reference manual for details on \roman
and enumi
.
There's a similar example from the manual
enumi
from the second level though.