I have no clue how to force a line break in the item label of an itemize / list / description environment or a proper workaround for getting the same result, hopefully somebody has. What I wanna do:
\begin{list}
\item[forcehere a \\ linebreak] Some text right of the label
\item[another label] Some other text
\end{list}
Latex just ignores all kind of unproper behaviour in a list environment like \\ or \linebreak.
Thanks a lot for help!
General ⇒ [Solved] Force a linebreak in label of item / list envir...
[Solved] Force a linebreak in label of item / list envir...
Last edited by Reset on Fri Jan 02, 2009 12:23 am, edited 1 time in total.
[Solved] Force a linebreak in label of item / list envir...
The optional argument of \item is typeset in horizontal mode, so ignoring line breaks. It happens the same thing, for example, inside \mbox or \makebox. Try: \mbox{force here a \\ linebreak}
Consequently, you have to put the argument of \item inside a \parbox, which admits line breaks:
Adapt the width of \parbox to your needs. Observe that, whenever you use the first optional argument of \parbox ([t] in this case), you have to enclose \parbox in braces. Remember that, inside an optional argument, brackets cannot directly appear, but "protected" by braces, that is, instead of \item[... [...]...], one has to write \item[{...[...]...}]
Consequently, you have to put the argument of \item inside a \parbox, which admits line breaks:
Code: Select all
\begin{description}
\item[{\parbox[t]{0.2\linewidth}{force here \\ a linebreak}}] Some text right of the label
\item[another label] Some other text
\end{description}
Adapt the width of \parbox to your needs. Observe that, whenever you use the first optional argument of \parbox ([t] in this case), you have to enclose \parbox in braces. Remember that, inside an optional argument, brackets cannot directly appear, but "protected" by braces, that is, instead of \item[... [...]...], one has to write \item[{...[...]...}]
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Re: Force a linebreak in label of item / list environment
Thanks dude,
your example works!
One addition: I have to write the item content also in a parbox, or the linebreak in the item-label affects also the item content.
For example:
\item[{\parbox[t]{0.2\linewidth}{force here \\ a linebreak}}] \parbox[t]{1\linewidth}{Some text right of the label}
your example works!
One addition: I have to write the item content also in a parbox, or the linebreak in the item-label affects also the item content.
For example:
\item[{\parbox[t]{0.2\linewidth}{force here \\ a linebreak}}] \parbox[t]{1\linewidth}{Some text right of the label}