5

I'd like to tell to enumitem to customize the enumerate environment so that, with the following code, I'd get the result pictured below ('a' labels for 1.(a) and 2.(a) should be aligned). How can I do?

Update: The important point is that I'd like the text to be aligned with the previous paragraph (except for the first line) and that each new level of enumeration should add a leftmargin.

I produced the example below using \parshape and some dirty hacks with \hspace{\parindent}: this is why the first (a) label ["1.(a)"] is not properly aligned with the second (a) label ["2.(a)"].

enter image description here

\documentclass{article}
\usepackage{enumitem}
\begin{document}

Text text text text Text text text text Text text text text Text text
text text Text text text text Text text text text Text text text text
Text text text text Text text text text Text text text text Text text
text text Text text text text Text text text text 

\begin{enumerate}
\item Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text
\begin{enumerate}
\item Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text
\item Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text
\end{enumerate}
\item \begin{enumerate}
  \item Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text
\item Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text
\end{enumerate}
\item Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text Text text text
text Text text text text Text text text text Text text text text Text
text text text Text text text text Text text text text
\end{enumerate}
\end{document}
  • I can't see any “1. (a)”. – egreg Nov 25 '13 at 15:30
  • @egreg I meant the 'a' item under the '1' item. – cjorssen Nov 25 '13 at 20:26
6
+50

Here is a solution to your problem, I think. This is quite an awful looking format. The tricky part is getting the indent of the first item of an embedded second level list. This bit of hackery (appropriately called \trickindent) is due to egreg.

\documentclass{article}
\usepackage{enumitem}
\usepackage{kantlipsum}
\setlist[enumerate]{nosep,itemindent=3.5em}
\newcommand{\trickindent}{%
  \let\normalitem\item
  \def\item{%
    \itemindent=0pt
    \normalitem
    \itemindent=3.5em
    \let\item\normalitem}%
}
\begin{document}
\begin{enumerate}
\item\kant*[1]
\begin{enumerate}
\item\kant*[4]
\end{enumerate}
\item\begin{enumerate}[before=\trickindent]
  \item\kant*[2]
  \item\kant*[3]
\end{enumerate}
\end{enumerate}
\end{document}

output of code

  • Thanks, works like a charm. And thanks to @egreg. I guess there is no way to automate the [before=\trickindent] trick? – cjorssen Nov 29 '13 at 8:42
  • I don't think there is a way, since that part is required only for second level lists that are right after an \item. For example, you can't add it to all second level lists. – Alan Munn Nov 29 '13 at 13:30

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.