Figures: What is the difference between using subfig or subfigure [duplicate]

I tend to use \subfloats[]{} in my figures when I want to list multiple labelled figures of similar content in one bigger picture. However, I see that some people use \subfigure.

What is the difference between these two options?

Is one better than the other?

\documentclass{article}
\usepackage{float}
\usepackage[caption = false]{subfig}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
\subfloat[caption]{\includegraphics[width= 2in]{something}}\\
\subfloat[caption]{\includegraphics[width= 2in]{something}}
\end{figure}
\end{document}


Or

\documentclass{article}
\usepackage{subfigure}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
\subfigure[caption]{\includegraphics[width = 2in]{something}}\\
\subfigure[caption]{\includegraphics[width = 2in]{something}}
\end{figure}
\end{document}


Since subcaption vs. subfig: Best package for referencing a subfigure is two years old, does Axel's solution still apply? By this I mean, has nothing changed with subfig? Are there only 2 'biased' pros for the use of subfig?

Is the outcome still it is more advisable to use subcaption over subfig where I am using the latter subfig?

marked as duplicate by karlkoeller, Heiko Oberdiek, Werner, barbara beeton, mafpJul 3 '13 at 21:36

• I would add floatrow and subcaption into that list. – badroit Jul 3 '13 at 19:00
• you might want to consider that subfig is intended to replace subfigure, although it may not be fully backward compatible. subfigure is deprecated for use in new documents. – barbara beeton Jul 3 '13 at 19:09
• Obligatory link Subfig vs. Subcaption – percusse Jul 3 '13 at 19:20
• @percusse so the only reason is hyperref. Then in the second solution, the author mentions the use of \subcaption over \subfloat. So I guess I should add that as argument to OP about which one is truly the best or most appropriate to use, no? – dustin Jul 3 '13 at 19:26
• @dustin Read Axel's (the author of caption, subcaption ...) very last comment at the end. Also (O)riginal (P)oster is you :-) There is never a truly best. It's all temporal opinions. – percusse Jul 3 '13 at 19:29

The question now seems a bit clearer.

I can give you a very simple answer which can be found anywhere. This is from CTAN

Package subfigure – Deprecated: Figures divided into subfigures

The pack­age is now con­sid­ered ob­so­lete: it was su­per­seded by sub­fig, but users may find the more re­cent sub­cap­tion pack­age more sat­is­fac­tory.

Also considered that the latest versions of both subfigure and subfig have been released in 2005, while the latest version of subcaption has been released a few months ago, you can make your conclusions.

As you can read on the corresponding CTAN entries, subfig and subfloat, the subfig package replaces the sub­fig­ure pack­age.

Here are examples taken from the corresponding manual:

Example using the subfig package:

\begin{figure}%
\centering
\subfloat[Second figure.]{...}\\
\subfloat[Third.]{\label{3figs-c}...}%
\caption{Three sub-floats.}
\label{3figs}
\end{figure}


Example using the subfloat package:

\begin{subfigures}
\label{fig:fig1a2}
%
\begin{figure}\centering
\fbox{fig. 1}
\caption{This is the first figure}\label{fig:fig1}
\end{figure}
%
\begin{figure}\centering
\fbox{fig. 2}
\caption{This is the second figure}\label{fig:fig2}
\end{figure}
%
\end{subfigures}


In my PhD thesis however I used the caption package together with subcaption package which worked very well. Here's my preample:

\usepackage[%
font={small,sf},
labelfont=bf,
format=hang,
format=plain,
margin=0pt,
width=0.8\textwidth,
]{caption}
\usepackage[list=true]{subcaption}


When I wanted to put two pictures side by side I used this template:

\begin{figure}
\centering
\subcaptionbox[Short Subcaption]{%
Subcaption%
\label{subfig:sublabel1}%
}
[%
0.45\textwidth % width of caption
]%
{%
\includegraphics[width=0.45\textwidth]%
{picture1.jpg}%
}%
\hspace{0.1\textwidth} % seperation
\subcaptionbox[Short Subcaption]{%
Subcaption%
\label{subfig:sublabel2}%
}
[%
0.45\textwidth % width of caption
]%
{%
\includegraphics[width=0.45\textwidth]%
{picture2.jpg}%
}%
\caption[Short Caption]{Caption}
\label{fig:label}
\end{figure}


You see that in this example the widths add up to 100 % (45 subpic + 10 sep + 45 subpic = 100).

Update (subcaption)

Using \hfill so separate the different subfigures is a better way than the \hspace{0.1\textwidth} approach (see subcaption: Calculating the Width). In addition I made the code more compact and used images that are available on a normal LaTeX system by default.

\begin{figure}
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.20\textwidth]{example-image-a}}%
\hfill
\subcaptionbox{Subcaption B}{\includegraphics[width=0.20\textwidth]{example-image-b}}%
\hfill
\subcaptionbox{Subcaption C}{\includegraphics[width=0.20\textwidth]{example-image-c}}%
\hfill
\subcaptionbox{Subcaption D}{\includegraphics[width=0.20\textwidth]{example-image}}%
\caption{Caption}
\end{figure}


• The template with subcaption wasn't working for me, I commented the hspace and it's working now. Thank you for your templates, very handy. – nessiagp Feb 8 '17 at 0:44