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.

Replay

Here it is, I think:

\documentclass{article}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{enumitem}
\newlength\labelwdi
\settowidth{\labelwdi}{99.}

\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=\parindent]
  \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+\itemindent+\labelwdi\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}

Different indentation styles at two nested levels of enumerate

Category: lists Time: 2016-07-30 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.127 (s). 12 q(s)