Subfigures in a columnwide figure in a two-column document

I am trying to put two figures next to each other in the top of a two-column document. I found the following code on the internet and it works:

\documentclass[10pt,prl,aps,showpacs,twocolumn,unsortedaddress]{revtex4-1}
\usepackage{subfigure}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{commath}
\usepackage{graphicx,bm}
\usepackage{verbatim}

\begin{document}

\begin{figure*}[t]
\setlength{\abovecaptionskip}{17.5 pt plus 4pt minus 2pt}
\mbox{
\subfigure{\includegraphics[scale=.95]{}}\,
\subfigure{\includegraphics[scale=.95]{}}
}
\vspace{-0.6 cm}
\caption{}
\label{}
\end{figure*}

\end{document}


However, I would also like to add captions a) and b) to the two subfigures. Simply inserting \caption into the subfigure environments does not work. Does anyone know how to solve this problem?

• Subfigure is not compatible with caption package, use subcaption package as an alternative to subfig – Rick de Groot Mar 6 '14 at 15:51
• I was to late to edit my comment they are not incompatible; the subfigure and subfig packages are deprecated and shouldn't be used any more, it is advice to use the sub caption package instead – Rick de Groot Mar 6 '14 at 15:59
• @RickdeGroot subfig is not deprecated. – Gonzalo Medina Mar 6 '14 at 16:00

subfigure is an obsolete package which shouldn't be used anynore. In its stead you can use subfig or subcaption. Below, I used the former, since subcaption will produce a warning about revtex4-1 being unsupported by caption (this might not be an issue, but I am not sure):

Notice the line

\captionsetup[subfigure]{labelformat=brace}


so the caption number will have only one parenthesis (instead of the default formatting enclosing the number inside parentheses).

\documentclass[10pt,prl,aps,showpacs,twocolumn,unsortedaddress]{revtex4-1}
\usepackage[caption=false]{subfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{commath}
\usepackage{graphicx,bm}
\usepackage{verbatim}

\captionsetup[subfigure]{labelformat=brace}

\begin{document}

\begin{figure*}
\subfloat[text for the first subfigure\label{sfig:testa}]{%
\includegraphics[height=3cm,width=.49\linewidth]{example-image-a}%
}\hfill
\subfloat[text for the second subfigure\label{sfig:testa}]{%
\includegraphics[height=3cm,width=.49\linewidth]{example-image-b}%
}
\caption{}
\label{}
\end{figure*}

\end{document}


With subcaption, the code would be:

\documentclass[10pt,prl,aps,showpacs,twocolumn,unsortedaddress]{revtex4-1}
\usepackage{subcaption}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{commath}
\usepackage{graphicx,bm}
\usepackage{verbatim}

\captionsetup[subfigure]{labelformat=brace}

\begin{document}

\begin{figure*}
\begin{subfigure}{0.49\linewidth}
\centering
\includegraphics[height=3cm,width=\linewidth]{example-image-a}
\caption{text for the first subfigure}
\label{sfig:testa}
\end{subfigure}\hfill
\begin{subfigure}{0.49\linewidth}
\centering
\includegraphics[height=3cm,width=\linewidth]{example-image-b}
\caption{test for the second subfigure}
\label{sfig:testb}
\end{subfigure}\hfill
\caption{}
\label{}
\end{figure*}

\end{document}


But, as I mentioned before, you'll receive a warning:

Package caption Warning: Unsupported document class (or package) detected, usage of the caption package is not recommended.See the caption package documentation for explanation.

• Thanks for the very thorough answer. I have but one small question remaining: I would like to add some text to the captions of the subfigures, how to do this? – Funzies Mar 6 '14 at 16:16
• @Funzies please see my updated answer. – Gonzalo Medina Mar 6 '14 at 16:22