# LaTeX Centering newline in subfloat caption

I have these images with their title beneath:

I want to add some information below, like this:

The good news is, I'm able to do it. The last screenshot is from my pdf previewer.

\subfloat[Highway\\1700 frames\\800x600]{\includegraphics{highway.jpg}}
or
\subfloat[\shortstack{Office\\2050 frames\\800x600}]{\includegraphics{office.jpg}}


The simple slash \\ solution stop working (shift to the left) when there's too much text. The \shortstack solution always work, but there's not a lot of space between the lines.

The problem is, even when they work, both give me the following errors :

There were errors in your LaTeX source
test.tex:22: Argument of \sf@@@subfloat has an extra }. [...e=0.9]{highway.jpg}}]
test.tex:22: Paragraph ended before \sf@@@subfloat was complete. [...e=0.9]{highway.jpg}}]


Is there any way to do what I want?

Here's a working minimal exemple :

\documentclass[letterpaper, 12pt]{book}
\usepackage{color,graphicx}
\usepackage{subfig}
\captionsetup[subfigure]{labelformat=empty}

\begin{document}
\begin{figure}[!ht] \centering
\subfloat[Highway]{\includegraphics[scale=0.9]{highway.jpg}} ~
\subfloat[Office]{\includegraphics[scale=0.9]{office.jpg}} ~
\subfloat[Pedestrians]{\includegraphics[scale=0.9]{pedestrians.jpg}} ~

\caption{Some caption}
\end{figure}
\end{document}

-

The \subfloat macro of subfig provides two different optional arguments:

\subfloat[<LoF entry>][<caption entry>]{<stuff>}


The above stems from the subfig documentation (p 4, section 2.2.1 The \subﬂoat Command):

Since line breaking in the LoF (or any "List of" or "Table of" structure) is not wanted and problematic, use something like this:

\subfloat[Highway, 1700 frames, 800x600][Highway\\1700 frames\\800x600]{\includegraphics[scale=0.9]{highway.jpg}}


This separates the floatable (fragile) content (destined for the LoF) from the typesetting content.

-
Using the List.Entry optional argument removes the errors. Thanks. It doesn't work with \\ though. The text goes to the left when I have more than two lines, or if I remove a word ...? It appears to be random! But it works with \shortstack. Thanks. – Nil Nov 5 '12 at 21:00
@Nil: In my examples it works. Otherwise try \centering Highway\par 1700 frames\par 800x600. My version of subfig is 2005/06/28 ver: 1.3 (from TeX Live 2011). – Werner Nov 5 '12 at 21:29
Ah, perfect, thanks. – Nil Nov 5 '12 at 21:45
\centering ...\par worked for me :) – zelanix Dec 10 '15 at 12:19