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:
2 Answers
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.
-
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.– MokedNov 21, 2011 at 12:12
-
6It 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.– MarcoNov 21, 2011 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.– MicoNov 21, 2011 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.– egregNov 21, 2011 at 12:26
-
2Thanks for you comments. I thought my verbal descripton was clear enough ... which it obviously was not. So I included a sketch to illustrate things.– MokedNov 21, 2011 at 13:03
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:
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).