I am writing a manuscript and I am using the subfloat
package to include in a figure several figures, if I don't include a caption it compiles nicely, but when including the caption I get the error
! Improper \prevdepth
.
I have tried using the caption package too but doesn't seem to work.
What I have looks like:
\documentclass[aps,preprint,pra]{revtex4-1}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat{
\begin{tabular}{cc}
\hline \hline
First Column & Second column \\[1ex]
\hline
\includegraphics[width=0.45\textwidth]{figure1} &\includegraphics[width=0.45\textwidth]{figure2} \\[0.5ex]
\hline \hline
\end{tabular}
}\caption{Caption for figures 1 and 2}\label{fig1and2}
\end{figure}
\end{document}
If someone can comment on this I will really appreciate it.
Thanks,
Best Answer
Always call
with the
revtex4-1
document class, which is not compatible withcaption
. The option is indeed meant not to load thecaption
package along withsubfig
(it will emulate the needed features).Note that it's better avoiding blank lines inside
\subfloat
(not required, though). More importantly, you're missing some%
and getting unwanted spaces: