0

I'm using the enumitem package, and am having trouble setting the horizontal spacing parameters (leftmargin,itemindent,labelsep,labelindent,labelwidth) so as to get the following effect:

LabelGoesHere     The quick brown fox jumped over the lazy dog. The
                  quick brown fox jumped over the lazy dog. The quick
                  brown fox jumped over the lazy dog. The quick brown
                  fox jumped over the lazy dog.

that is, both the first line (not including the label) and the other lines start at the same point. For the lines other than the first, this works fine (for alignment at 2cm from the margin):

\begin{description}[
  leftmargin=2cm,
  itemindent=0cm
]

but the first line is giving me trouble. Am I supposed to use the label's width somehow? Should I use ! or * ?

PS - Bonus points if you could help me make the distance from the start of the line at which alignment happens be the maximum necessary to fit all of the item labels used in the list, plus some fixed amount of clearance.

  • to fit all the items then either you need to specify a "big enough" length or specify a "widest label" (as is done for the standard bibliography list) or use the aux file to record the widest label and fix up the width on a second run. Which do you want to do? – David Carlisle Jul 2 '17 at 19:19
  • 1
    Please include minimal working examples in your posts. These are far more helpful than the odd fragment of code. – cfr Jul 2 '17 at 19:48
  • @cfr: Were you really missing the \item[LabelGoesHere] The quick brown fox...\end{description}? – einpoklum Jul 2 '17 at 19:54
  • @einpoklum All posts should include a minimal working example (or non-working example, if the question is about an error), starting with \documentclass and ending with \end{document}. – cfr Jul 2 '17 at 20:01
  • @einpoklum it is much easier to answer questions if the OP provides a proper test file. – David Carlisle Jul 2 '17 at 22:05
4

Choose a left margin large enough, or use the multiline style:

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


%
\begin{description}[leftmargin=2.5cm, style=multiline]
  \item[Label Goes Here] The quick brown fox jumped over the lazy dog. The
        quick brown fox jumped over the lazy dog. The quick
        brown fox jumped over the lazy dog. The quick brown
        fox jumped over the lazy dog.
\end{description}}

\begin{description}[style=sameline, leftmargin=3.2cm]
  \item[Label Goes Here] The quick brown fox jumped over the lazy dog. The
        quick brown fox jumped over the lazy dog. The quick
        brown fox jumped over the lazy dog. The quick brown
        fox jumped over the lazy dog.
\end{description}
}
\end{document} 

enter image description here

0

Here's the best I got. This works but might not be the "right thing":

\begin{description}[
  leftmargin=2cm,
  itemindent=0cm,
  labelwidth=1.75cm,
  labelsep=0.25cm,
  labelindent=0cm
]

So, this ensures at least 0.25cm of clearance between then label and the item text, and the alignment is 2cm from the margin.

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.