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



   \caption{First line of caption\\second line of caption\\third line of caption\\fourth line of caption}


producing enter image description here, with the line-breaks correctly observed.

Attempting something comparable with KOMA-script:




   \caption{First line of caption\\second line of caption\\third line of caption\\fourth line of caption}


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

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

| improve this question | | | | |

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.

Added in your example:


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}
| improve this answer | | | | |
  • Thank you. The use of the optional argument is especially useful. – brannerchinese Aug 6 '12 at 20:44

Thanks for all the tips, hints, and hacks I "exploited" so far and let me give this back. It cost me a lot of time to figure out the neat pitfalls and circumvent them:

I actually wanted to have exactly what OP asked but in addition the caption text should be aligned like this: enter image description here

Unfortunately the nooneline-argument spoils it.

In the end I use this in my preamble:

% nooneline was necessary for linebreaks:
% cf.http://tex.stackexchange.com/questions/66111/linebreaks-in-koma-script-captions
% --- following two change a lot, try
% cf. here: http://tex.stackexchange.com/questions/66116/puzzled-as-to-centering-of-koma-script-captions
% cf. for multiline solution --> avoiding nooneline (because it uncenters the caption)
% last answer here:
% http://tex.stackexchange.com/questions/101595/how-to-add-line-break-to-caption-without-using-caption-package

and then in the document:

   \caption[Some caption short]{\tabular[t]{@{}l@{}}Some caption foobarbuz \\ source: Here and There\endtabular}

Have fun :)

| improve this answer | | | | |
  • This doesn't answer direct question, but rather a way to provide an alternative layout/horizontal alignment of the caption. – Werner Feb 15 '16 at 19:15
  • I guess both lie close to one another and as I couldn't find an answer to my not that far-fetched question I wanted to share it. – MaK Feb 16 '16 at 0:09
  • @MaK Since this answers a slightly different question, it will probably be hard to find for other people with this problem. How about you ask it as a new question and provide this as an self answer to the new question? – samcarter_is_at_topanswers.xyz Feb 16 '16 at 17:49
  • @samcarter done :) thanks for your kind advice – MaK Feb 16 '16 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.