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 have these images with their title beneath: enter image description here

I want to add some information below, like this: desc

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

1 Answer

up vote 7 down vote accepted

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 \subfloat Command):

enter image description here

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.

share|improve this answer
    
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
1  
@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
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.