2

enter image description here

\documentclass{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\newcommand{\currentsection}{3.5}
\setlist[enumerate,1]{label=\currentsection.\arabic*.}
\setlist[enumerate,2]{align=left,widest=a,leftmargin=*}
\begin{document}
\begin{enumerate}
\item ohai
  \begin{enumerate}
  \item ok
  \item hi
  \end{enumerate}
\item ohai
\item ohai
\end{enumerate}
\end{document}

The above snippet somehow aligns the second level enumerate list at the left. I read http://tug.org/texinfohtml/latex2e.html#list and http://mirrors.ctan.org/macros/latex/contrib/enumitem/enumitem.pdf, but I still don't understand how it works. Is there a comprehensive document on the horizontal spacing of enumrate list?

  • texdoc enumitem? Page 5. If you've read that, it would help to know what you don't understand. What output would you expect? Also, please give us a complete, minimal document we can copy-paste-compile to see what you see. – cfr Dec 13 '15 at 03:58
  • I asked the question after I read page 5 on enumitem.pdf and fiddled with relevant variables. The model described on page 5 provides an incomplete picture of the horizontal spacing. –  Dec 13 '15 at 03:59
  • Very like your incomplete code and incomplete question. What, exactly, do you want to know? – cfr Dec 13 '15 at 04:01
  • I want to understand how align, leftmargin, itemindent, labelsep, labelwidth, and labelindent affect the horizontal spacing of the enumerate list at the second level and beyond. I can't predict how changing one variable affects the others, yet. –  Dec 13 '15 at 04:04
  • 1
    The left margin is shifted so that the starting point aligns with the start of an item at level 1. leftmargin is then measured right from that point. itemindent is then measured rightwards again, from the rightmost point of leftmargin. leftmargin contains labelindent and labelwidth and part of labelsep. itemindent includes the rest of labelsep. – cfr Dec 13 '15 at 04:11
  • Why do I still see some gaps between label and text with \setlist[enumerate,2]{align=left,labelsep=0pt,leftmargin=*}? –  Dec 13 '15 at 04:13
  • 2
  • Ah, '(m)' is significantly wider than '(a)', and widest=m sets minimum label width to that of '(m)'. Thus, widest=a,labelsep=0,leftmargin=* removes the gap between label and text. @PeterGrill The picture helped.... I think I now get the picture. –  Dec 13 '15 at 04:28
  • Try setting align=right and you'll see the label shifted to the right of the label width, so the gap disappears. (Pic below.) – cfr Dec 13 '15 at 04:32

1 Answers1

2

Does this help? I've used leftmargin=! since leftmargin=* calculates things using the label width of the widest item, so labelwidth has no effect, for example.

enumerations

\documentclass{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\newcommand{\currentsection}{3.5}
\setlist[enumerate,1]{label=\currentsection.\arabic*.}
\begin{document}
\begin{enumerate}
  \item ohai
  \begin{enumerate}[align=left,widest=a,leftmargin=!]
    \item the leftmost point of the left margin is aligned with the rightmost point of the left margin of the enclosing list
  \end{enumerate}
  \item ohai
  \begin{enumerate}[align=left,widest=a,labelindent=5mm,leftmargin=!]
    \item the leftmost point of the left margin is aligned with the rightmost point of the left margin of the enclosing list
    \item the label begins 5mm to the right of the left margin
  \end{enumerate}
  \item ohai
  \begin{enumerate}[align=left,widest=a,labelindent=5mm,labelwidth=15mm,leftmargin=!]
    \item the leftmost point of the left margin is aligned with the rightmost point of the left margin of the enclosing list
    \item the label begins 5mm to the right of the left margin
    \item 15mm is allowed for the label
  \end{enumerate}
  \item ohai
  \begin{enumerate}[align=left,widest=a,labelwidth=15mm,leftmargin=!]
    \item the leftmost point of the left margin is aligned with the rightmost point of the left margin of the enclosing list
    \item 15mm is allowed for the label
  \end{enumerate}
  \item ohai
  \begin{enumerate}[align=left,widest=a,labelsep=5mm,leftmargin=!]
    \item the leftmost point of the left margin is aligned with the rightmost point of the left margin of the enclosing list
    \item 5mm is left between the rightmost side of the label and the start of the item body
  \end{enumerate}
  \item ohai
  \begin{enumerate}[align=left,widest=a,itemindent=35mm,leftmargin=!]
    \item the indentation of the item body, relative to the left margin is 135mm, so the left margin is now further left than in the other cases
  \end{enumerate}
\end{enumerate}
\end{document}

If you set

\setlist[enumerate,2]{align=left,labelsep=0pt,leftmargin=*}

Then the label is aligned left within the width of the label. So there will be some space to the right of the label. If you use

[align=right,labelsep=0pt,leftmargin=!]

then you see the space disappear:

no space

cfr
  • 198,882