I'm trying to put some text in a subfloat using the subfig package. (It's supposed to be part of the figure, not the caption.) I can't figure out how to add a line break. When I try this code:
\documentclass{article}
\usepackage{subfig}
\begin{document}
\begin{figure}[h]
\centering
\subfloat[a]{A\\\texttt{This is a test}}
\subfloat[b]{B}
\end{figure}
\end{document}
I get the error: Something's wrong--perhaps a missing \item.
I tried changing the \\
to \linebreak
, \newline
, and \par
. They all either do nothing or give an error. I also tried wrapping the text in an mbox
, and I tried putting the line break inside the texttt
. Nothing works. How do I do this?