0

When using itemize and enumerate and setting the same labelindent, there are different results. The number doesn't line up with the paragraph indentation. This issue is exaggerated when reaching ten items.

enter image description here

MWE:

\documentclass[10pt,a4paper]{article}
\usepackage[left=32.5mm, right=25mm, top=25mm, bottom=20mm]{geometry}
    \setlength{\parindent}{1.5em}
\usepackage{enumitem}
    \setlist[itemize]{labelindent=\parindent, label={--}}
    \setlist[enumerate]{labelindent=\parindent}
\usepackage{lipsum}

\begin{document}
    \lipsum[1][1-3]
    \begin{enumerate}
        \item Test
    \end{enumerate}

    \lipsum[1][1-3]
    \begin{itemize}
        \item Test
    \end{itemize}
\end{document}

2 Answers 2

2

In the place of labelindent=, you should use wide= which adds the left-alignment of the labels. There remains a tiny difference in alignment (< 0.2pt), which can be seen only using a large zoom, and is due to the slightly different side-bearings of glyphs.

Demonstration, adding an \fbox around the labels:

\documentclass[10pt,a4paper]{article}
\usepackage[left=32.5mm, right=25mm, top=25mm, bottom=20mm]{geometry}
\setlength{\parindent}{1.5em}
\setlength{\fboxrule}{0.1pt}
\setlength{\fboxsep}{0.pt}
\usepackage{enumitem}
    \setlist[itemize]{wide=\parindent, label=\fbox{--}}
    \setlist[enumerate]{wide=\parindent, label = \fbox{\arabic*}}

\begin{document}

   \fbox{L}orem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
    \begin{enumerate}
        \item Test
\item Another test 
    \end{enumerate}

    \fbox{L}orem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
    \begin{itemize}
        \item A compulsive test
    \end{itemize}

\end{document} 

enter image description here

4

First, the label is by default typeset flush right in a box of width \labelwidth that starts at \labelindent from the left margin (as shown below, this can be changed with, for instance, align=left). But this assumes that you give enumitem a way to satisfy the various constraints.

As the enumitem manual explains, there are five horizontal length parameters linked by one linear relation:

\leftmargin + \itemindent = \labelindent + \labelwidth + \labelsep

By default, enumitem does labelindent=! which means that it computes \labelindent from the other parameters; however, in both of your examples, you explicitly set \labelindent, so enumitem must be able to compute another parameter from the others, and you need to specify which one. For instance, you can use leftmargin=*:

\documentclass{article}
\setlength{\parindent}{1.5em}

\usepackage{enumitem}
\usepackage{lipsum}

\setlist[itemize]{labelindent=\parindent, align=left, leftmargin=*,
                  label={--}}
\setlist[enumerate]{labelindent=\parindent, align=left, leftmargin=*}

\begin{document}
    \lipsum[1][1-3]
    \begin{enumerate}
        \item Test
    \end{enumerate}

    \lipsum[1][1-3]
    \begin{itemize}
        \item Test
    \end{itemize}
\end{document}

enter image description here

Zoom with vertical rule:

enter image description here

Note that this is explained in the documentation of the labelindent option (and \labelindent length parameter):

labelindent=〈length〉
\labelindent
This parameter is added in enumitem for the blank space from the margin of the enclosing list/text to the left edge of the label box. This means there is a redundancy because one of the parameters depends on the others, i.e., it has to be computed from the other values, as described below. By default, the computed value is labelindent, even if explicitly set with some value (it defaults to 0pt). So, if you are setting it to some value, very likely you want to set some other parameter to ! or *, because otherwise it is ignored.

1
  • @Johannes Your question doesn't mention at all that you wanted line wrapping in the items to use the outer margin on the left. Moreover, the red line from your picture could quite easily be interpreted as meaning that wrapped lines from items should not cross it. Unaccepting an answer based on requirements completely absent from the question is... questionable.
    – frougon
    Apr 20, 2020 at 8:42

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.