QUESTION
On this question a comment by Martin H says, that one should forget about the subfigure
and subfig
packages and use subcaption
. As subfig
replaces subfigure
, no argument there.
I am currently using subfig
for displaying my subfigures and quite content with it. So I am wondering, what the advantages of using subcaption
instead would be or if and why the use of subcaption
is generally preferable to subfig
.
ANSWER
Pro subcaption:
- subfig's hyperref support contains bugs (which is clearly a problem of subfig and not of hyperref) while the subcaption package (hopefully ;-)) works fine with hyperref.
- The subcaption package offers enhanced hyperref support,
\subref*
will behave like\ref*
(offered by the hyperref package),\autoref
will work out-of-the-box, and the caption optionshypcap=
andhypcapspace=
will work for sub-captions, too. - The subfig package breaks the starred version of
\ContinuedFloat
offered by the caption package while the subcaption package does not. - The subcaption package is more "in touch" with the caption package, supporting more common options like
list=on
etc., and offering similar commands to\caption
,\captionbox
, and thefigure
environment:\subcaption
,\subcaptionbox
, and thesubfigure
environment. (Please note that\captionbox
is not avail yet but will be offered by the very next version 3.2 of the caption package.) - Offers more ways to place and align sub-captions, e.g.
\subcaption
could be used to place a sub-caption (left or right) beside the figure. \subcaptionbox
offers more optional arguments than\subfloat
, e.g. for giving the box a specific width.- Offers
\phantomsubcaption
for referencing without having a caption. (since version 1.1 of the subcaption package) - Is supported by the bicaption package for typesetting bilingual sub-captions. (since version 1.1 of the subcaption package)
Pro subfig:
- The subcaption package needs the caption package while the usage of the caption package is optional in subfig. (The subfig package offers the option
caption=false
.) Because of that the subfig package could also be used with document classes which are incompatible to the caption package. - The subcaption package does not offer top and bottom margins (yet) while the subfig package does. So when using the subcaption package one have to do the vertical spacing between sub-figures manually by using the
\vspace
command,\smallskip
,\medskip
,\bigskip
, or similar.
Please note that I'm the author of the caption & subcaption package, so this list is far from being objective ;-)
But is the use of subcaption generally preferable to subfig? IMHO no, because the subfig package is a fine (and well documented) one, and if one is contented with the subfig package there is no need to switch.
Tweet