# Indenting the first line of figure captions

I want to create a small indentation in the first line of figure captions, similar to the way LaTeX indents the first line of paragraphs.

The caption package does not seem to support this.

Is it doable?

-
Welcome to TeX.SX! Yes, it's doable, but I'm not sure it's typographically sound. The keyword "Figure" or "Table" provides the visual clue for identifying the caption. – egreg Oct 4 '12 at 22:00
Thank you for your answers. – The Third Man Oct 5 '12 at 10:25

Using caption package:

\documentclass{article}
\usepackage{caption}
\newlength\myindention
\DeclareCaptionFormat{myformat}%
{\hspace*{\myindention}#1#2#3}
\setlength\myindention{1cm}
\captionsetup{format=myformat}

\begin{document}
\begin{figure}
\caption{White sand beaches. The pink smoothness of the conch shell. A sea abundant
with possibilities. Duty-free shops filled with Europe’s finest gifts and perfumes. Play
your favorite game of golf amidst the tropical greens on one of the many championship
courses.}
\end{figure}
\end{document}​


The above method is applicable to tables also.

As noted by Gonzalo, this can be also done by using the available options of caption package as:

\documentclass{article}
\usepackage{caption}
\captionsetup[figure]{format=hang,indention=-60pt,margin=20pt}

\begin{document}
\begin{figure}
\caption{White sand beaches. The pink smoothness of the conch shell. A sea abundant
with possibilities. Duty-free shops filled with Europe’s finest gifts and perfumes. Play
your favorite game of golf amidst the tropical greens on one of the many championship
courses.}
\end{figure}
\end{document}​

-
You can also do this without declaring a new format, and using the predefined options with something like \captionsetup[figure]{format=hang,indention=-60pt,margin=20pt}. – Gonzalo Medina Oct 5 '12 at 1:56
@GonzaloMedina: True. But I wanted to avoid that and introduce a custom style. Anyway, I feel that it is a welcome addition. I will add it to the answer. – Harish Kumar Oct 5 '12 at 2:12
After seeing the result I'm even more convinced that this should not be done. ;-) – egreg Oct 5 '12 at 6:41
@egreg: I believe it is a very common convention in scientific journals and in articles therein. It may, however, not be an ideal format for larger works such as books and theses. – The Third Man Oct 6 '12 at 7:06

In the standard document classes, you can redefine the macro that prints the caption, called \@makecaption.

I've defined \captionindent to be the same as the default \parindent. The reason for storing it in a different length is because captions are usually set with no \parindent.

\documentclass{article}
\makeatletter
\newlength{\captionindent}\setlength{\captionindent}{\parindent}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1: #2}%
\ifdim \wd\@tempboxa >\hsize
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother
\begin{document}
\begin{figure}
\caption{White sand beaches. The pink smoothness of the conch shell. A sea abundant
with possibilities. Duty-free shops filled with Europe’s finest gifts and perfumes. Play
your favorite game of golf amidst the tropical greens on one of the many championship
courses.}
\end{figure}
\end{document}​


This will hold for all captions. An alternative solution may be provided if you're using the caption package.

-