# Linebreaks in KOMA-script captions

Using the captions package, linebreaks can be incorporated into figure-captions easily:

\documentclass[12pt]{book}

\usepackage{graphicx}
\usepackage{caption}

\begin{document}
\begin{figure}[htbp]
\begin{center}
\includegraphics{sampleImage.png}
\caption{First line of caption\\second line of caption\\third line of caption\\fourth line of caption}
\end{center}
\end{figure}

\end{document}


producing , with the line-breaks correctly observed.

Attempting something comparable with KOMA-script:

\documentclass[12pt]{scrbook}

\usepackage{graphicx}
\KOMAoption{captions}{belowfigure}

\begin{document}

\begin{figure}[htbp]
\begin{center}
\includegraphics{"sampleImage.png"}
\caption{First line of caption\\second line of caption\\third line of caption\\fourth line of caption}
\end{center}
\end{figure}

\end{document}


generates an error: Argument of \@caption has an extra }.

Is there another way to get line-breaks in a figure caption using KOMA-script?

-

The reason is, that by default KOMA-Script captions are put into horizontal boxes, to measure if they are longer than one line or not. That's why line breaks by \\ or \newline don't have effect. You can disable this default behavior, for example, by using the KOMA-Script option for captions nooneline, so "one-line" captions are treated like multi-line captions.

\KOMAoption{captions}{belowfigure,nooneline}


Then, you can get line breaks by \\ if you insert \protect before:

\caption{First line of caption\protect\\second line of caption}


However, it's not necessary if you specify an optional argument. It may be recommendable for such long captions, which might not be the optimum for the list of figures. So, this works too:

\caption[short caption]{First line of caption\\second line of caption}

-
Thank you. The use of the optional argument is especially useful. – brannerchinese Aug 6 '12 at 20:44