3

I want to absolutely position nested enumerate labels based on the following scheme:

1. Top level - flush with left page margin and all text is
wrapped to the left margin.

  a. Second level - label starts .25in from left page margin
and text is wrapped to the left margin.

    (1) Third level - label starts .5in from left page margin
and text is wrapped to the left margin.

    (a) Fourth level - label starts .5in from left page margin
and text is wrapped to the left margin.

I want the labels to line up at 0in, .25in and .5in and all text wrapped to the left margin of the document. I've struggled through getting the first list to work, but I don't understand which values to use for subsequent lists.

One constraint: all customization must be completed in the preamble. I'm using Pandoc to generate LaTeX from markdown, so I can't edit the LaTeX directly.

\documentclass{article}

\usepackage[showframe,margin=1in]{geometry}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{tikz}
\newcommand{\Gridlines}{
  \begin{tikzpicture}[remember picture, overlay]
    \node[anchor=south west,inner sep=0pt] at (current page.south west)
    {\tikz \draw[line width=0.2pt,color=gray!10,step=0.125in] (0,0) grid ++(8.5in,11in);};
    \node[anchor=south west,inner sep=0pt] at (current page.south west)
    {\tikz \draw[line width=0.3pt,color=gray!20,step=0.25in] (0,0) grid ++(8.5in,11in);};
    \node[anchor=south west,inner sep=0pt] at (current page.south west)
    {\tikz \draw[line width=0.4pt,color=gray!30,step=1in] (0,0) grid ++(8.5in,11in);};
  \end{tikzpicture}
}
\usepackage{enumitem}

% 1st level: 1. 2. 3. flush with left margin
% 2nd level: a. b. c. indent 0.25 in
% 3rd level: (1) (2) (3) indent 0.5 in
% 4th level: (a) (b) (c) indent 0.5 in, same as 3rd level
% Don't subdivide beyond 4 levels

\setlist{
  itemindent=.5\leftmargin,
}

\setlist[1]{
  labelindent=0in,
  leftmargin=*,
  align=left,
  % itemindent=\labelwidth+\labelsep,
  % after=\setlength{\itemindent}{\leftmargin}
}

% The tricky part is that each new list starts at the enclosing lists
% leftmargin.
\setlist[2]{
  label=\alph*.,
  % The additional amount we want to indent minus the labelsep and
  % labelwidth of the enclosing enum. The 12.7778pt comes from the
  % enclosing enumerate.
  labelindent=.25in,
  leftmargin=*,
  align=left
}

\setlist[3]{
  label=(\arabic*),
  labelindent=.25in,
  leftmargin=*,
  align=left
}
\setlist[4]{
  label=(\alph*),
  labelindent=0in,
  leftmargin=0pt,
  align=left
}

\begin{document}
\Gridlines
\begin{enumerate} \item \lipsum[1]
\item labelindent: \the\labelindent,  labelwidth: \the\labelwidth,  labelsep: \the\labelsep,  leftmargin: \the\leftmargin,  itemindent: \the\itemindent
  \begin{enumerate}
  \item \lipsum[3]
  \item labelindent: \the\labelindent,  labelwidth: \the\labelwidth,  labelsep: \the\labelsep,  leftmargin: \the\leftmargin,  itemindent: \the\itemindent
    \begin{enumerate}
    \item labelindent: \the\labelindent,  labelwidth: \the\labelwidth,  labelsep: \the\labelsep,  leftmargin: \the\leftmargin,  itemindent: \the\itemindent
      \begin{enumerate}
      \item labelindent: \the\labelindent,  labelwidth: \the\labelwidth,  labelsep: \the\labelsep,  leftmargin: \the\leftmargin,  itemindent: \the\itemindent
      \end{enumerate}
    \end{enumerate}
  \end{enumerate}
\end{enumerate}

\end{document}

Example output

  • See section 3.9 of enumitem's manual. There's a new key for 'wide' lists which you can use for this. (It was a surprise to me to discover this - this was not what I expected when I skimmed this section - but it works.) Use something like wide=\parindent, align=left for the top level and work from there. – cfr Jul 14 '14 at 3:14
  • Scratch the bit about \parindent and you don't need align=left but wide is still your friend, I think! – cfr Jul 14 '14 at 3:28
4

Perhaps something like this:

\documentclass{article}
\usepackage{enumitem, kantlipsum}
\setlist[enumerate]{wide, labelwidth=\parindent}
\setlist[enumerate,1]{labelindent=0pt, labelwidth=\parindent, label=\arabic*.}
\setlist[enumerate,2]{wide=.825cm, label=\alph*.}
\setlist[enumerate,3]{wide=1.25cm, label=(\arabic*)}

\begin{document}
\kant[6]
\begin{enumerate}
  \item \kant[1]
  \item \kant[2]
  \begin{enumerate}
     \item \kant[3]
     \item \kant[4]
     \begin{enumerate}
        \item \kant[5]
      \end{enumerate}
  \end{enumerate}
\end{enumerate}
\end{document}

paragraph like lists

  • Works like a dream. I did add wide=0in to the first list because it seems to fix the excessive spacing. – Joe Jul 14 '14 at 3:48
  • 1
    @JoeS I only discovered this key the other day when somebody pointed out that my answer was basically equivalent to just saying wide=.... So much easier! – cfr Jul 14 '14 at 16:04

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.