Latex: How can I create nested lists which look this 1.1, 1.1.1, 1.1.2, 1.2
Categories:
Creating Custom Nested Lists in LaTeX (1.1, 1.1.1, 1.2 Format)

Learn how to customize LaTeX's list environments to achieve complex numbering schemes like 1.1, 1.1.1, and 1.2 for deeply nested lists.
LaTeX provides powerful tools for document formatting, including robust list environments. However, achieving highly specific numbering styles for nested lists, such as 1.1
, 1.1.1
, and 1.2
, often requires customization beyond the default enumerate
environment. This article will guide you through the process of creating such custom nested lists using the enumitem
package, which offers unparalleled control over list appearance.
Understanding LaTeX's Default List Behavior
By default, LaTeX's enumerate
environment uses different numbering styles for each nesting level. The first level typically uses Arabic numerals (1, 2, 3), the second uses lowercase letters (a, b, c), the third uses Roman numerals (i, ii, iii), and so on. While this is suitable for many documents, academic papers, technical reports, or legal documents often demand a continuous, hierarchical numbering system where each sub-item's number reflects its parent's number.
flowchart TD A[Start with enumerate] --> B{Default Numbering?} B -- Yes --> C[1., a., i.] B -- No --> D[Need Custom Numbering] D --> E[Use enumitem package] E --> F[Define custom list styles] F --> G[Achieve 1.1, 1.1.1, 1.2] G --> H[End]
Decision flow for custom LaTeX list numbering
Introducing the enumitem
Package
The enumitem
package is the de facto standard for customizing lists in LaTeX. It allows you to redefine the appearance of enumerate
and itemize
environments globally or locally, providing fine-grained control over labels, spacing, and numbering styles. To achieve the 1.1
, 1.1.1
format, we will leverage its ability to define custom label formats for each level of enumeration.
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=\arabic*.]
\item First top-level item.
\begin{enumerate}[label=\arabic{enumi}.\arabic*.]
\item First sub-item of 1.
\begin{enumerate}[label=\arabic{enumi}.\arabic{enumii}.\arabic*.]
\item First sub-sub-item of 1.1.
\item Second sub-sub-item of 1.1.
\end{enumerate}
\item Second sub-item of 1.
\end{enumerate}
\item Second top-level item.
\begin{enumerate}[label=\arabic{enumi}.\arabic*.]
\item First sub-item of 2.
\end{enumerate}
\end{enumerate}
\end{document}
Basic LaTeX code for custom nested lists using enumitem
\arabic{enumi}
command refers to the counter of the current first-level enumerate
environment. Similarly, \arabic{enumii}
refers to the second level, and so on. This is crucial for building hierarchical labels.Global Customization with enumitem
Instead of defining the label format for each enumerate
environment manually, you can set global styles for all levels using \setlist
. This approach is cleaner and ensures consistency throughout your document. You can define up to four levels of enumeration globally.
\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{label=\arabic*.} % First level: 1.
\setlist[enumerate,2]{label=\arabic{enumi}.\arabic*.} % Second level: 1.1.
\setlist[enumerate,3]{label=\arabic{enumi}.\arabic{enumii}.\arabic*.} % Third level: 1.1.1.
\setlist[enumerate,4]{label=\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.\arabic*.} % Fourth level: 1.1.1.1.
\begin{document}
\begin{enumerate}
\item Top-level item one.
\begin{enumerate}
\item Sub-item one-one.
\begin{enumerate}
\item Sub-sub-item one-one-one.
\item Sub-sub-item one-one-two.
\end{enumerate}
\item Sub-item one-two.
\end{enumerate}
\item Top-level item two.
\begin{enumerate}
\item Sub-item two-one.
\end{enumerate}
\end{enumerate}
\end{document}
Global definition of custom nested list styles using \setlist
\setlist
command should be placed in your document's preamble (before \begin{document}
) to apply globally. If you need different styles for specific lists, you can still use the local [label=...]
option within that particular enumerate
environment.Resetting Counters and Advanced Options
Sometimes you might want to reset the counter of a sub-list or customize other aspects like indentation or spacing. enumitem
offers extensive options for this. For instance, to reset the counter of a sub-list every time its parent counter increments, the default behavior of enumerate
with enumitem
already handles this correctly for the hierarchical numbering we've set up.
\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{label=\arabic*.} % First level: 1.
\setlist[enumerate,2]{label=\arabic{enumi}.\arabic*.} % Second level: 1.1.
\setlist[enumerate,3]{label=\arabic{enumi}.\arabic{enumii}.\arabic*.} % Third level: 1.1.1.
\begin{document}
\begin{enumerate}
\item First main point.
\begin{enumerate}
\item Detail A.
\item Detail B.
\end{enumerate}
\item Second main point.
\begin{enumerate}
\item Sub-point X.
\begin{enumerate}
\item Further elaboration.
\end{enumerate}
\item Sub-point Y.
\end{enumerate}
\end{enumerate}
\end{document}
Example demonstrating counter resetting with global enumitem
settings
This setup ensures that when the first-level counter increments (e.g., from 1 to 2), the second-level counter automatically resets to 1 (e.g., from 1.2 to 2.1). This is the desired behavior for the 1.1, 1.1.1, 1.2
style of numbering.