I want my captions in marginpar to be left aligned. I am using raggedright
option in caption
package along with floatrow
package. The captions are left aligned only for long captions.
MWE
\documentclass{report}
\usepackage{geometry,caption,floatrow}
\geometry{showframe=true, includemp,marginparwidth=5cm, marginparsep=1em}
%
\newlength{\figWidthForMarginCap}%
\setlength{\figWidthForMarginCap}{\textwidth}%
\addtolength{\figWidthForMarginCap}{-1em}%
\addtolength{\figWidthForMarginCap}{\marginparsep}%
%
\captionsetup{
format=plain,
margin=0em,
labelsep=newline,
justification=raggedright
}
%
\begin{document}
\thisfloatsetup{%
capposition=beside,
capbesidewidth=\marginparwidth,
capbesideposition={bottom,right},
floatwidth=\figWidthForMarginCap
}
\begin{figure}
\centering
\rule{3cm}{2cm}
\caption{Small Caption}
%\caption{This is a needlessly long caption to which runs at least two lines.}
\end{figure}
\end{document}