5

I like to change the labeling of an enumeration to the following structure:

1 First Item 
  1.1 First Sub-Item 
    1.1.1 First Subsub-Item  
    1.1.2 Second Subsub-Item  
  1.2 Second Sub-Item   
2 Second Item   
3 Third Item 

Similiar questions have already been asked and the following code using label*=\arabic*. (and which is also part of the official enumitem documenation) is always the accepted answer:

\documentclass{article}
\usepackage{enumitem}
\usepackage{enumitem}
\newlist{legal}{enumerate}{10}
\setlist[legal]{label*=\arabic*.}

\begin{document}
\begin{legal}
  \item First Item 
  \begin{legal}
    \item First Sub-Item 
      \begin{legal}
        \item First Subsub-Item 
        \item Second Subsub-Item 
      \end{legal}
    \item Second Sub-Item 
  \end{legal}
  \item Second Item 
  \item Third Item 
\end{legal}
\end{document}

Unfortunately this solution puts an dot . after the last level of enumeration and therefore gives the following result:

1. First Item   
  1.1. First Sub-Item  
    1.1.1. First Subsub-Item  
    1.1.2. Second Subsub-Item   
  1.2. Second Sub-Item   
2. Second Item   
3. Third Item 

Is it possible to define the label in such a way that it is not [1.1., 1.1.1., etc.] but instead [1.1, 1.1.1, etc.]?

5

Implementing @moewe's comments, here's a solution that requires only two separate \setlist instructions. The first \setlist instructions pertains to all list levels; the second affects just the numeric labels of level-1 items.

enter image description here

In addition, if you would rather not have any extra vertical whitespace between any of the items, simply provide the instruction \setlist[legal]{nosep} after the \newlist directive.

\documentclass{article}
\usepackage{enumitem}
\newlist{legal}{enumerate}{10}
\setlist[legal]{label*=.\arabic*}
\setlist[legal,1]{label=\arabic*}

\begin{document}
\begin{legal}
  \item First Item 
  \begin{legal}
    \item First Sub-Item 
      \begin{legal}
        \item First Subsub-Item 
        \item Second Subsub-Item 
          \begin{legal}
            \item First Subsubsub-Item
            \item Second Subsubsub-Item
          \end{legal}
        \item Third Subsub-Item
      \end{legal}
    \item Second Sub-Item 
  \end{legal}
  \item Second Item 
\end{legal}
\end{document}
  • I'd suggest the starred label* for items further down than first level: \setlist[legal,2]{label*=.\arabic*} \setlist[legal,3]{label*=.\arabic*} \setlist[legal,4]{label*=.\arabic*} Or is there an advantage to hard-coding the counters using label? – moewe May 13 '18 at 16:28
  • 2
    Even better. Make only the first one special: \setlist[legal]{label*=.\arabic*} \setlist[legal,1]{label=\arabic*} – moewe May 13 '18 at 16:29
  • @moewe - Many thanks for these suggestions! I've edited my answer to implement the second suggestion. – Mico May 13 '18 at 16:34
  • Looks perfect! Thank you both for the quick answers! – banarni May 13 '18 at 16:41

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.