I wish to add a line break to a caption, but I would wish to avoid adding of caption
package. Is it possible?
\documentclass{article}
\usepackage[format=plain,
justification=raggedright,singlelinecheck=false]{caption}
\begin{document}
\begin{figure}
\caption{This is the caption\\ This is the second line}
\end{figure}
\end{document}
Best Answer
The reason why
\\
does not work originally is that the caption is small enough to fit on one line. The default caption setting first sets the caption in an mbox and if that is less than the line width that box is centred. Otherwise that box is discarded and the caption is re-set in a parbox. On the first setting\\
does nothing as it is always a no-op in such a box, on the second setting (if it is used) then\\
starts a new line. So all you have to do is make sure that the first setting is not used, as the space at the start of a line is discarded, it doesn't really matter how big the space is, so long as the total natural width of the whole caption is bigger than\textwidth
.