[Tex/LaTex] linebreak in description title

descriptionline-breakinglists

In my document I have a description environment. One of the titles in the description is too long to fit in one line and I want to break it. I know this is a bad styling but I can't think of any way to shorten it. I tried \\ and \newline and they didn't work. What else can I do?

I tried to use the mdwlist package. I added the following in the begining of my document:

\renewenvironment{description}{
  \begin{basedescript}{%
    \renewcommand{\makelabel}[1]{\bfseries##1}%
  }
}{%
  \desclabelstyle{\multilinelabel}

  \end{basedescript}%

}

but all I got is the same result.

I also tried this without any effect:

\renewenvironment{description}{
  \desclabelstyle{\multilinelabel}
  \begin{basedescript}{%
    \renewcommand{\makelabel}[1]{\bfseries##1}%
  }
}{%
  \end{basedescript}%
}

I can't use the \multilinelabel since the words in the label are too long, thus, I want to use \pushlabel. However, this doesn't work even in the example you given (probably, it doesn't know how to break lines). Is there any way to force break lines?

Best Answer

If your description items may be longer than a line I would suggest to use a paragraph or subparagraph instead:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}

\newcommand*{\mtol}{This is some more text than fit at ony line but only some
  and not a lot}

\begin{document}
\subparagraph{\mtol} \blindtext
\subparagraph{Or with less text} \blindtext
\subparagraph{\mtol} \blindtext
\subparagraph{\mtol} \blindtext

\end{document}

This may result in

result of the example

This may or may not be what you want. If you don't like the par indent before the label, simply replace \subparagraph by \paragraph.

Or you may define your own multi line description environment, e.g. using addmargin environment of KOMA-Script package scrextend:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{scrextend}

\newcommand*{\mtol}{This is some more text than fit at ony line but only some
  and not a lot}

\newenvironment{mldescription}{%
  \begin{addmargin}[2em]{1em}
    \setlength{\parindent}{-1em}%
    \newcommand*{\mlitem}[1]{\par\textbf{##1}\quad}\indent
}{%
  \end{addmargin}
  \medskip
}

\begin{document}
\blindtext
\begin{mldescription}
\mlitem{\mtol} \blindtext
\mlitem{Or with less text} \blindtext
\mlitem{\mtol} \blindtext
\mlitem{\mtol} \blindtext
\end{mldescription}
\blindtext

\end{document}

This would result in

result of mldescription list

That should almost be, what you want. If you want more or less indention or more or less hanging text, simply change the values of the addmargin environment or the \parindent.

And if you want additional vertical space between the items you may add this to the definition of the new environment too:

\newenvironment{mldescription}{%
  \begin{addmargin}[2em]{1em}
    \setlength{\parindent}{-1em}%
    \newcommand*{\mlitem}[1]{\par\medskip% vertical space
      \textbf{##1}\quad}\indent
}{%
  \end{addmargin}
  \bigskip% changed to have more vertical space than between items
}

same with vertical space

If you're already using a KOMA-Script class, you don't need to load package scrextend.

Related Question