Text Formattinglinebreak in a label of a description item

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
silentboom
Posts: 11
Joined: Thu Sep 03, 2009 11:02 am

linebreak in a label of a description item

Post by silentboom »

Hello everybody.

Is there any way to insert a linebreak within the label of an item of the description enviroment?

Thanks, for you support.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

linebreak in a label of a description item

Post by gmedina »

Hi,

one possible quick solution is to use a \parbox command:

Code: Select all

\documentclass{article}

\begin{document}

\begin{description}
 \item[{\parbox[t]{3cm}{first line\\second line}}] first item 
\end{description}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Re: linebreak in a label of a description item

Post by fatra2 »

Hi there,

As far as I know, the description option is a paragraph environment. I normally break the lines by just adding second carriage return, or by adding \\ or by adding \newline.

Cheers
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

linebreak in a label of a description item

Post by gmedina »

fatra2 wrote:Hi there,

As far as I know, the description option is a paragraph environment. I normally break the lines by just adding second carriage return, or by adding \\ or by adding \newline.

Cheers
Hi fatra2,

please notice that the original request is for a line break inside the label; in this case, your suggestions won't apply:

Code: Select all

\documentclass{book}

\begin{document}

\begin{description}
  % won't work
  \item[first line\\second line]
  % won't work
  \item[first line\newline second line]
  % will work
  \item[{\parbox[t]{3cm}{first line\\second line}}]
\end{description}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
silentboom
Posts: 11
Joined: Thu Sep 03, 2009 11:02 am

Re: linebreak in a label of a description item

Post by silentboom »

Thanks a lot!
Post Reply