5

I'm having problems with indenting the label of a description. Tried to define a new environment, and set leftmargin to whatever, but the label stays put. How can I achieve what I want?

This is what Ive done:

\newenvironment{owndesc}
{\begin{description}
\setlength{\leftmargin}{3cm}
\setlength{\labelsep}{5cm}}
{\end{description}}

I'm quite new to LaTeX, and any help is appreciated, thanks!

2
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Commented Mar 16, 2014 at 8:32
  • 2
    I recommend the package enumitem. Commented Mar 16, 2014 at 8:33

2 Answers 2

5

In cases such as this one, I believe it's easiest to load the enumitem package and use that package's \newlist and \setlist commands to (i) "clone" one of the basic list types (here: description) and create a new list type (here: owndesc) and (ii) set the parameters of the new list type.

In the following example, the horizontal line at the top is there just to illustrate the width of the text block. Lipsum is used for filler text.

enter image description here

\documentclass{article}
\usepackage{enumitem,lipsum} % lipsum for filler text
\newlist{owndesc}{description}{1}  % clone an existing list type
\setlist[owndesc]{leftmargin=3cm,labelsep=4cm} % set parameters of cloned list

\begin{document}
\hrule % demonstrate width of text block 
\begin{owndesc}
\item[firstlabel]  \lipsum*[1]
\item[secondlabel] \lipsum*[2]
\end{owndesc}
\end{document}
3

Another solution, always using enumitem, lets the body of an item always begin at the same place. First, show what your parameters give with enumitem:

    \documentclass[11pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{enumitem}
    \usepackage[showframe, nomarginpar]{geometry}

    \newenvironment{owndesc}%
    {\begin{description}[leftmargin = 3cm, labelsep = 5cm]}
    {\end{description}}

    \newenvironment{mydesc}%
    {\begin{description}[ style =sameline, leftmargin = 3cm,  itemindent = 2cm]}%,
    {\end{description}}

    \begin{document}

    \begin{owndesc}
        \item[Title of the first item] Anything will do. \\New line for this item
        \item[Title of the second  item] Second item. \\ Another line for this one.
    \end{owndesc}
    \vspace{2ex}

    \begin{mydesc}
        \item[Title of the first item] Anything will do. \\New line for this item
        \item[Title of the second  item] Second item. \\ Another line for this one.
        \item[A third item with a longer title] Third item. \\ Another line for this one.
    \end{mydesc}

    \end{document} 

enter image description here

2
  • You may want to explain explicitly what the "style=sameline" option does: Have "labelsep" be measured from the left-hand margin of the text block instead of the end of the label.
    – Mico
    Commented Mar 16, 2014 at 11:34
  • @Mico: That's right. I added some explanations – only hope I made no errors, as I don't really master everything. I took the opportunity to add a longer label, to show what happens "in action".
    – Bernard
    Commented Mar 16, 2014 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .