General ⇒ [Solved] Force a linebreak in label of item / list envir...
[Solved] Force a linebreak in label of item / list envir...
\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!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
[Solved] Force a linebreak in label of item / list envir...
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[{...[...]...}]
Re: Force a linebreak in label of item / list environment
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}