# Put image in subfig's subfloat caption

I need to put an image "tinyimage" inside the caption of a subfloat of the subfig package.

Minimal not working example:

\documentclass{scrbook}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf}
\usepackage{subfig}

\begin{document}
\begin{figure}
\subfloat[\includegraphics{tinyimage}]{\includegraphics{bigimage}}
\end{figure}
\end{document}


So far I tried the following:

• put a \protect{} around the \includegraphics{} in the caption.
• store the \includegraphics{} in a \savebox and put \usebox in the caption.

The error I get is:

Argument of \sf@@@subfloat has an extra }. ...phics{tinyimage}]{\includegraphics{big image}}


Try to add all tree arguments of \subfloat[][]{} command:

\documentclass{scrbook}
\usepackage[demo]{graphicx}
\DeclareGraphicsExtensions{.pdf}
\usepackage{subfig}

\begin{document}
\begin{figure}
\subfloat[][{\includegraphics{tinyimage}}]{\includegraphics{bigimage}}
\end{figure}
\end{document}


Note that the second optional argument is {\includegraphics{tinyimage}}: extra {...} are necessary for optional argument of \includegraphics{...} command.

• It is perhaps worth mentioning that the first optional argument (if present) defines the entry in the list of figures. – Torbjørn T. Aug 27 '14 at 12:08