Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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