This should be a simple one, hopefully.
I like to align the label of the items in my enumerate
environment with the left margin. I can do this with the option [labelsep = *]
from the enumitem
package. See the MWE below.
But when I have >9 items in my list, the labels are still left aligned with the second digit of the numeral. What I want is to left align the labels of my items according to the widest label in my list, so that no label ever bleeds into the margin.
I have tried playing with the option labelwidth
, but it has no effect (presumably because I have set labelsep = *
?
\documentclass{article}
\usepackage{lipsum, showframe}
\usepackage{enumitem}
\setlist[enumerate, 1]% global settings for the first level in enumerate environments
{%
leftmargin = \parindent, % item text indentation
labelsep = * % item label at margin
}
\begin{document}
\lipsum[4]
\begin{enumerate}
\item \lipsum[4]
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\item
\end{enumerate}
\lipsum[4]
\end{document}
EDIT
The same question has been asked in How to make enumerate items align at left margin?, but all the answers are 13 years old, and don't reflect the current status of the enumitem
package.
In the documentation to the current version (3.9) of enumitem
, a solution to this problem seems to be presented at the bottom of page 11, where a command \EnumitemId
is explained, referencing the stackexchange question linked above. But the explanation in the documentation is incomplete, ending with "Then just use the key widestlabel
", without explaining how it should be used, and with no example.
labelwidth
based on widest label?