I want an indent for my figure captions of 1 cm (left and right). In a related question it was shown how \captionsetup{format=hang}
can be used to indent the text, but not the initial "Figure 1: ".
I would like to have a figure caption, where the whole caption including the initial "Figure 1:" is indented. If possible, i would also like to size of the indent (in pixels or centimeter). How would that be possible?
Best Answer
Here are some explanations on how to do that.
The simplest is to use the
caption
package and either set the keywidth=\dimexpr\textwidth-2cm\relax
(sets the indent to 1cm) or set the keymargin=1cm
with\captionsetup
. Note that if you want different left and right indent, you have to set, say,margin={2cm,0cm}
(2cm indent on the left side, noindent on the right side).Another possibility is the
\ffigbox{caption}{figure}
command fromfloatrow
. It accepts as an optional argument the width of the float box. An interesting length is\FBwidth
, which is the natural width of the object. This allows for adjusting the caption width as a relative value. Also, the same construction can be done for tables with the command `\ttabbox{caption}{table}.Last possibility: load
threeparttable
. It defines ameasuredfigure
environment which sets the caption width to the figurewidth, exactly as thethreepartable
environment does for tables. Note that unfortunately, this mechanism is broken if you also load `floatrow.Here is a code with
measuredfigure
: