[Tex/LaTex] Alignment of Margin caption with floatrow and caption

captionsfloatrowhorizontal alignment

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.

enter image description here

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}

Best Answer

Use option singlelinecheck=false.

\captionsetup{
  format=plain,
  margin=0em,
  labelsep=newline,
  justification=raggedright,
  singlelinecheck=false
}

I quote from the caption manual:

The standard LATEX document classes (article, report, and book) automatically center a caption if it fits in one single line...

The caption package adapts this behavior and therefore usually ignores the justification & indention you have set with justification= & indention= in such case. But you can switch this special treatment of such short captions off with the option

singlelinecheck=<bool>

Using false, no, off or 0 for bool switches the extra centering off

Related Question