This is odd, my code was working just fine, then I literally just step out of the room and when I come back and compile I get the error undefined control sequence \subfloat.
Basically I am trying to arrange 3 images, cc.png, bb.png and tt.png in a document side by side rather than in a column as latex was trying to make it. This is the relevant section of my code:
\documentclass{article}
\usepackage[top=0.5in]{geometry}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{auto-pst-pdf}
\usepackage{epstopdf}
\usepackage{float}
\usepackage{subfloat}
\usepackage{caption}
\usepackage{axodraw4j}
\usepackage{pstricks}
\usepackage{color}
\DeclareMathSizes{10}{12}{10}{6}
\begin{document}
\title{Higgs Boson Deacay}
\author{name}
\maketitle
\begin{figure}[h!t]
\centering
\subfloat{\includegraphics[scale=0.7]{cc}}
\subfloat{\includegraphics[scale=0.7]{bb}}
\subfloat{\includegraphics[scale=0.7]{tt}}
\end{figure}
\end{document}
My output was fine and I'm sure I didn't change anything (although I concede I must have done otherwise there would be no problem) but this code now keeps giving me the error I have stated. I've looked at this for so long that the problem is probably staring me in the face but I can't see it. Any help would be greatly appreciated.
Best Answer
The
subfloat
package doesn't define\subfloat
(and has never defined it). Its purpose is different: you can group different captions under the same number with a letter attached, similarly to what the environmentsubequations
(fromamsmath
) does.For
\subfloat
you need to loadsubfig
or
if you don't want to load the
caption
package together withsubfig
(some classes, notablyIEEEtran
don't allow the loading ofcaption
.You should consider
subcaption
, though, if you don't have limitations on the packages you use: it's more recent and well maintained. Moreover it has not the small defectssubfig
shows whenhyperref
is used.By the way you should not say
(where you place
!
is immaterial), butbecause otherwise you could block the float queue.