[Tex/LaTex] Undefined control sequence \subfloat


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:




\title{Higgs Boson Deacay} 



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 environment subequations (from amsmath) does.

For \subfloat you need to load subfig




if you don't want to load the caption package together with subfig (some classes, notably IEEEtran don't allow the loading of caption.

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 defects subfig shows when hyperref is used.

By the way you should not say


(where you place ! is immaterial), but


because otherwise you could block the float queue.