4

I would like to be able to use long labels in a nested enumerate environments without having them overlap with the previous level. I don't really know how to properly explain this, so here is a MWE illustrating what I would like.

\documentclass{article}
\usepackage[shortlabels]{enumitem}


\begin{document}
\begin{enumerate}
\item
Hello
\begin{enumerate}
\item
Here is a normal enunerate with short labels.
\item
It looks pretty.
\item
I would like to have all of my labels ``start'' at the same place.
\item
That is to say, after the first label.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
Stuff
\begin{enumerate}[{Long Label} a)]
\item
Here is an enumerate with long lables.
\item
Notice that the labels start before the label of the containing enumerate environment.
\item
I find this undesirable.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
\begin{enumerate}[{Long Label} a)]
\item
As you can see, the issue becomes even more obvious when there is no content after the first label, so the labels actually overlap.
\end{enumerate}
\end{enumerate}
\end{document}

Anyone know how to do this?

enter image description here

3
  • On a side note, how to I show what the code outputs, in addition to just the code itself, so people can quickly see what I would like? Oct 31, 2013 at 1:55
  • 1
    You can take a screen shot of your pdf and upload it.
    – user11232
    Oct 31, 2013 at 2:14
  • Oh is that really it? I thought there was some more fancy means lol. Oct 31, 2013 at 2:20

3 Answers 3

5

With enumerate

You said in your previous question that you would have preferred not to switch to enumitem but to stay with enumerate package.

Using the latter and adding

\setlength{\labelsep}{1em}

to the preamble (as I said in your previous question) solves the issue.

MWE

\documentclass{article}
\usepackage{enumerate}

\setlength{\labelsep}{1em}

\begin{document}
\begin{enumerate}
\item
Hello
\begin{enumerate}
\item
Here is a normal enunerate with short labels.
\item
It looks pretty.
\item
I would like to have all of my labels ``start'' at the same place.
\item
That is to say, after the first label.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
Stuff
\begin{enumerate}[{Long Label} a)]
\item
Here is an enumerate with long lables.
\item
Notice that the labels start before the label of the containing enumerate environment.
\item
I find this undesirable.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
\begin{enumerate}[{Long Label} a)]
\item
As you can see, the issue becomes even more obvious when there is no content after the first label, so the labels actually overlap.
\end{enumerate}
\end{enumerate}
\end{document} 

Output:

enter image description here


With enumitem

Instead, if you have already switched to enumitem, you can solve your issue by adding the following lines to your preamble:

\setlist[enumerate]{
  leftmargin=*
}

so that your modified MWE

\documentclass{article}
\usepackage[shortlabels]{enumitem}

\setlist[enumerate]{
  leftmargin=*
}

\begin{document}
\begin{enumerate}
\item
Hello
\begin{enumerate}
\item
Here is a normal enunerate with short labels.
\item
It looks pretty.
\item
I would like to have all of my labels ``start'' at the same place.
\item
That is to say, after the first label.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
Stuff
\begin{enumerate}[{Long Label} a)]
\item
Here is an enumerate with long lables.
\item
Notice that the labels start before the label of the containing enumerate environment.
\item
I find this undesirable.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
\begin{enumerate}[{Long Label} a)]
\item
As you can see, the issue becomes even more obvious when there is no content after the first label, so the labels actually overlap.
\end{enumerate}
\end{enumerate}
\end{document} 

yields

enter image description here

1

If it is accidental usage and and hoc changes are remaining:

\documentclass{article}
\usepackage[shortlabels]{enumitem}

\newlength{\LLwidth}
\settowidth{\LLwidth}{Long Label a)}


\begin{document}
\begin{enumerate}
\item
Hello
\begin{enumerate}
\item
Here is a normal enunerate with short labels.
\item
It looks pretty.
\item
I would like to have all of my labels ``start'' at the same place.
\item
That is to say, after the first label.
\end{enumerate}
\end{enumerate}


\begin{enumerate}
\item
Stuff
\leftmarginii\LLwidth
\begin{enumerate}[{Long Label} a)]
\item
Here is an enumerate with long lables.
\item
Notice that the labels start before the label of the containing enumerate environment.
\item
I find this undesirable.
\end{enumerate}
\end{enumerate}

\begin{enumerate}
\item
\leftmarginii\LLwidth
\begin{enumerate}[{Long Label} a)]
\item
As you can see, the issue becomes even more obvious when there is no content after the first label, so the labels actually overlap.
\end{enumerate}
\end{enumerate}
\end{document}

enter image description here

1
  • What exactly is the length '\LLwidth'? And looking at the nestings, it still looks like the long labels are shifted far more to the left than the standard labels are :/ Oct 31, 2013 at 2:43
0

I'm not entirely sure what you want, but if it is simply that nested enumerated environments are always 'smaller' than their parents, this does the trick:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{showframe}% <-- just to give some perspective
\usepackage{enumitem}
  \setlist{labelindent=0pt, align=left}

\newlength\LLwidth
\settowidth{\LLwidth}{Long Label a}% <-- this is not good for consistency
\setlength{\LLwidth}{3cm}%           <-- this is better; but maybe pick a font-based value

\begin{document}

\noindent lksjdf

\begin{enumerate}
\item Hello
  \begin{enumerate}
  \item Here is a normal enunerate with short labels.
  \item It looks pretty.
  \item I would like to have all of my labels ``start'' at the same
    place.
  \item That is to say, after the first label.
  \end{enumerate}
\end{enumerate}


\begin{enumerate}
\item Stuff

  \begin{enumerate}[leftmargin=*, labelwidth={\LLwidth}, label={Long Label
      \alph*)}]

  \item Here is an enumerate with long lables.

  \item Notice that the labels start before the label of the containing
    enumerate environment.

  \setcounter{enumii}{12}%  <-- just to see a wider label in effect
  \item I find this undesirable.

  \end{enumerate}
\end{enumerate}

\begin{enumerate}
\item ~ % <-- prevent the overlap

  \begin{enumerate}[leftmargin=*, labelwidth={\LLwidth}, label={Long Label
      \alph*)}]

  \item As you can see, the issue becomes even more obvious when there
    is no content after the first label, so the labels actually overlap.
  \end{enumerate}

\end{enumerate}

\end{document}

If you are doing a bunch of weird things with long labels, I recommend you use the \setlist capabilities of enumitem to maintain consistency across list environments.

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.