I want to insert a manual line break in the subfigures captions. I have achieved this with either \protect\\
or \newline
. However, the second lines do not align properly. I want them to start at the same horizontal position as the text (not the number) of the first line.
Here is an MWE:
\documentclass[a4paper,12pt,openright,oneside,bibliography=totoc,headsepline]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[config=altsf]{subfig}
\usepackage{graphicx}
\usepackage{mwe}
\begin{document}
\begin{figure}
\captionsetup[subfloat]{format=hang,singlelinecheck=false,justification=RaggedRight}
\centering
\subfloat[line break should \protect\\ be here]{\includegraphics[scale=0.5]{example-image-a}}
\newline
\subfloat[newline \newline there]{\includegraphics[scale=0.5]{example-image-a}}
\caption{Test figure.}
\end{figure}
\end{document}
First, the second line is not aligned like the first one (seems to be centered) and second, why are the two images not aligned? How can I achieve a line break and a hanging alignment of the second line? So, for subfigure (a) the "b" of the second line should be (horizontally) where the "l" is from the first line.
An ugly workaround would be to set \hspace
to an appropriate value instead of using a line break command. But I hope there is a better solution.
Best Answer
It seems that the problem is that
singlelinecheck=false
doesn't work if thesubfig
package is loaded with the option[config=altsf]
. So I didn't use it: