[Tex/LaTex] Figure with multi-line Caption Indent (not “hang”)

captions

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 key width=\dimexpr\textwidth-2cm\relax(sets the indent to 1cm) or set the key margin=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 from floatrow. 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 a measuredfigure environment which sets the caption width to the figurewidth, exactly as the threepartable environment does for tables. Note that unfortunately, this mechanism is broken if you also load `floatrow.

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}

\usepackage{graphicx}
\usepackage{floatrow, caption}%
\captionsetup{labelfont=sc}

\begin{document}

\begin{figure}[!h]
  \centering\captionsetup{width =\dimexpr\textwidth-2cm}
  \includegraphics[scale=0.7]{SanRomano}
  \caption{Paolo Uccello (1397–1475). \emph{The Counterattack of Michelotto da Cotignola at the battle of San Romano} (c. 1455), wood panel, 182 $ × $317, Musée du Louvre, Paris}
  \label{fig:label1}
\end{figure}

\begin{figure}[!h]
  \centering\captionsetup{margin=2cm}
  \includegraphics[scale=0.7]{SanRomano}
  \caption{Paolo Uccello (1397–1475). \emph{The Counterattack of Michelotto da Cotignola at the battle of San Romano} (c. 1455), wood panel, 182 $ × $317, Musée du Louvre, Paris}
  \label{fig:label2}
\end{figure}

\clearpage

\begin{figure}[!h]
  \centering
  \ffigbox[1.1\FBwidth]{\caption{Paolo Uccello (1397–1475). \emph{The Counterattack of Michelotto da Cotignola at the battle of San Romano} (c. 1455), wood panel, 182 $ × $317, Musée du Louvre, Paris}\label{fig:label3}}%
  {\includegraphics[scale=0.8]{SanRomano}}
\end{figure}

\end{document}

enter image description here enter image description here

Here is a code with measuredfigure:

\begin{figure}[!h]
  \centering
  \begin{measuredfigure}
    \includegraphics[scale=0.8]{SanRomano}
    \caption{Paolo Uccello (1397–1475). \emph{The Counterattack of Michelotto da Cotignola at the battle of San Romano} (c. 1455), wood panel, 182 $ × $317, Musée du Louvre, Paris}
  \end{measuredfigure}
  \label{fig:label4}
\end{figure}

enter image description here