# Different indentation styles at two nested levels of enumerate

I want my document to incorporate numbered lists that are indented the same as the main unlisted paragraphs - that is, the number of the item is indented, but if the item requires more than one line of text, the additional lines should not be indented.

However, a few of these list items will require alphabetic sublists. I would like these to be indented differently - the items should be indented (with the parenthesized item letter lining up to the text of the main list item), and any additional lines should remain indented.

Here is an example:

    Here is a paragraph. Blabbity blah blah blabbity blah blah, blah blah blah
blabbity blah blah blah.
1.  Here is my first main list item. If I write a lot of text here, it should
carry over to the next line without indentation, like this.
2.  Here is my second main list item.
(a) Here is my first sublist item. If I write a lot of text here, it should
remain indented, like this.
(b) Here is my second sublist item.
(c) Here is my third sublist item.
3.  Here is my third main list item.


From this TeX SE question, I found the following solution:

\usepackage{enumitem}
\setlist[enumerate,1]{wide=\parindent}
\setlist[enumerate,2]{leftmargin=5em}


This pretty much gets me what I want, but is there a way where I can set the left margin of the sublist with a value relative to the text in the main list? I would like the parenthesized letters in the sublist to line up with the text of a main list item (rather than the number). With my current solution, it's not quite lined up - is there a better way than just testing 5.1em, 5.2em, 5.25em &etc.? I'm still a total novice, but I can foresee fiddling with the spacing of the main list later on, and it'd be nice to define the spacing of the sublist so as to adjust automatically to any future fiddling.

• in enumerated lists, the labels are typically set flush right in the area assigned for that purpose, with a fixed separation from the item text. so in the case of numeric labels, the left edge will be uniform for all numbers with the same number of digits. there will be a discontinuity between the labels for "9" and "10". but letters in most fonts are not the same width. the distinction is most obvious between "i" and "m", but there can even be width differences among the first few letters, so an uneven left edge is usual. that needs to be accounted for. – barbara beeton Jul 30 '16 at 11:25
• Is it worth adding the enumitem tag to this? – cmhughes Jul 30 '16 at 14:19

Here it is, I think:

\documentclass{article}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{enumitem}

\begin{document}

Here is a paragraph. Blabbity blah blah blabbity blah blah, blah blah blah
blabbity blah blah blah. Booh booh booh.

\begin{enumerate}[wide, labelwidth=1em]
\item Here is my first main list item. If I write a lot of text here, it should
carry over to the next line without indentation, like this.
\item Here is my second main list item.
\begin{enumerate}[wide=\dimexpr\parindent+1em+\labelsep\relax, leftmargin=* ]%
\item Here is my first sublist item. If I write a lot of text here, it should
remain indented, like this.
\item Here is my second sublist item.
\item Here is my third sublist item.
\end{enumerate}
\item . Here is my third main list item.
\end{enumerate}

\end{document}


• This works great. I don't quite understand the expression used as a value for wide, but I'll look into it. Thanks! – Devon LePage Jul 30 '16 at 23:40
• However, if I try and use this code in the header of my document, like this: \setlist[enumerate,2][wide=\dimexpr\parindent+\itemindent+\labelwdi\relax, leftmargin=*], it doesn't work. How can I make this work for all sublists without pasting it in each time? – Devon LePage Jul 30 '16 at 23:41
• It's rather simple: wide= xx gives the value of the label indentation w.r.t. the text margin (in this case, the label is left aligned in its box). So the first indentation is normal paragraph, indentation. The second value calculates the position of the beginning of text at the superior level, and leftmargin=* makes all lines of the second level begin at the same point, including the first one. – Bernard Jul 30 '16 at 23:47
• Could you post an example of how it doesn't work? It's rather vague for now… I suppose you mean you paste this code in the preamble of your document? – Bernard Jul 30 '16 at 23:50
• I did. But it didn't work because I put the \setlist arguments in brackets instead of curly braces. Changed that and now it works fine. Well, sort of. When I compile your MWE with the \setlist command, it is exactly what I want, but when I add it to my document preamble the sublist letters don't line up with the list text. Aack! – Devon LePage Jul 31 '16 at 0:23