6

How can I specify explicitly both the indentation of the label and the actual item's text from the left margin in a list environment. I would like to achieve the following:

lockstep
  • 250,273
Moked
  • 1,530

2 Answers2

9

Your specifications are not very clear; the following could be what you need:

\usepackage{enumitem,lipsum} % in your preamble


\begin{description}[leftmargin=2cm,itemindent=0cm,
  labelindent=1cm,labelwidth=\dimexpr1cm-.5em\relax,
  labelsep=!,align=left]
\item[X] \lipsum*[4]
\item[First] \lipsum*[2]
\item[Second] \lipsum*[3]
\end{description}

(As always, lipsum is used only to provide dummy text.)

If you want to be able to set the dimensions at usage time, you can define a personal environment, such as

\newenvironment{xdesc}[2]
  {\begin{description}[leftmargin=#2,
     labelindent=#1,labelwidth=#1,
     labelsep=0pt,align=left,style=multiline]}
  {\end{description}}

to be called as

\begin{xdesc}{1cm}{3cm}
\item[X] \lipsum*[4]
\item[First] \lipsum*[2]
\item[Second and more] \lipsum*[3]
\end{xdesc}

where the first argument is, in your notation, sep1 and the second argument is sep2.

egreg
  • 1,121,712
  • It is actually pretty clear, but once again: I want to be able to define the space from the left margin to the position where 1) the item label begins and 2) the item text begins. This should be set explicitly and independently. – Moked Nov 21 '11 at 12:12
  • 6
    It is clear to you, because you know what you want. If people tell you it's unclear, it's best to believe them, since you want an answer that addresses your problem. If it's hard to describe in text, it is totally fine if you draw a sketch (hand drawing is also fine) to illustrate your problem. – Marco Nov 21 '11 at 12:18
  • 4
    @SebastianKrause: A general comment: When a person providing an answer to your question expresses honest uncertainty as to what exactly it is you're trying to achieve (and hence what the appropriate LaTeX commands should be), it's neither helpful nor polite to reply that your question was "actually pretty clear" -- and then proceed to simply restate the question. If you're interested in getting a good answer, you may want to edit your original question to include a real clarification. – Mico Nov 21 '11 at 12:24
  • @SebastianKrause I should add that it's not clear what should be done to lines after the first one in the same item. – egreg Nov 21 '11 at 12:26
  • You should probably listen to these guys. After all, if you develop a reputation for being unhelpful/ungrateful then people are less likely to help you in the future. I suggest you up vote these answers to provide incentive, even if they don't help you (an up vote isn't an acceptance after all) and clarify your question. – qubyte Nov 21 '11 at 12:59
  • 2
    Thanks for you comments. I thought my verbal descripton was clear enough ... which it obviously was not. So I included a sketch to illustrate things. – Moked Nov 21 '11 at 13:03
  • @SebastianKrause Did you try my solution? – egreg Nov 21 '11 at 13:30
3

If I might throw in a ConTeXt solution again:

\definedescription [list]
    [
      location=serried,
     headstyle=\hskip1cm\bold, % sep1
      distance=2cm,            % sep2
         width=0cm,
    ]

\starttext

% only for illustration
\blackrule [height=1ex, width=2cm]
\blackrule [height=1ex, width=1cm]

\startlist{First}
    \input knuth
\stoplist

\startlist{Second}
    \input tufte
\stoplist

\stoptext

The result looks like this:

result

In my example I misused the headstyle to insert the first space. Your contraint 1cm measured from the beginning of the label has the drawback, that all labels wider than 1cm print into the list text (see label of second list).

Marco
  • 26,055