50

I was using the subfigure package to align multiple small images in a document. However, WikiBooks states that "the subfigure and subfig packages are deprecated and shouldn't be used any more" (WikiBooks Floats, Figures and Captions).

What is the alternative/proper option to achieve the same result?

Canageek
  • 17,935
PLG
  • 1,202
  • 4
    Afaik, only subfigure is deprecated and subfig is the way to go instead. – Ruben Nov 13 '13 at 11:52
  • 8
    subfig isn't deprecated!. You can also use subcaption which provides subfigure. –  Nov 13 '13 at 11:53
  • 18
    I've written tens of times that subfig is only deprecated by one (albeit respectable) guide. The package subcaption has better features, perhaps, but subfig remains invaluable with classes such as RevTeX4 that are not compatible with caption (which is required by subcaption). – egreg Nov 13 '13 at 11:57
  • Thank you, I will try subfig and subcaption then! =) – PLG Nov 13 '13 at 12:29
  • 1
    @egreg Can you post up an answer explaining this and what the updsides of each are? As I recall, you explained this to me less then a week ago. – Canageek Nov 14 '13 at 05:34
  • Some slightly related article from the TUGboat "Side-by-side gures in LaTeX": http://tug.org/TUGboat/tb34-1/tb106thurnherr.pdf – Henri Menke Nov 15 '13 at 15:14
  • 1
    @egreg, also I couldn't make subcaption work with Beamer, although subfig works. – alfC Mar 17 '14 at 01:54
  • subfig isn't deprecated but quickly becoming so as there is no active support for it. – percusse Mar 17 '14 at 09:56
  • @usr1234567 The answer https://tex.stackexchange.com/a/144951/2574 is up-to-date, and furthermore there were no recent changes regarding these packages: subfig is still version 1.3 from 2005, and the user interface of subcaption hasn't changed since 2011, I (as maintainer of subcaption) only have done bugfixing in the last 5 years. –  Jul 11 '16 at 20:57
  • 1
    BTW: I do not understand all the fuzz about avoiding "deprecated" packages. The LaTeX2e world is full of abandoned packages, and most of them are still working fine and used by many people. Of course, it would be nice if someone would fix known bugs, but often there is a workaround or patch available on the net. (And the same is true for packages offered by the LaTeX2e team itself!) And both, subfigure and subfig are fine and easy-to-use packages, and beside the broken hyperref compatibility of subfig, I see no reason of not still using them today. –  Jul 17 '16 at 10:53

2 Answers2

40

There are at least four classes that aren't compatible with caption (hence with subcaption), whereas subfig is a substitute when called as

\usepackage[caption=false]{subfig}
  1. The ws-proc9x6 class (and related ones by the same publisher), see how to get the ws-procs9x6 document class to work with subcaption package?

  2. tufte-book and the other similar classes, see Problem with tufte-book and subfigure

  3. IEEEtran, see 2-col floats and citation order problem

  4. REVTeX, see subfigures with revtex?

It's true that subfig doesn't cooperate well with hyperref, but when the alternative is no subfloats at all …


Related subfloat discussion is also given in subcaption vs. subfig: Best package for referencing a subfigure

egreg
  • 1,121,712
  • 1
    subfig is simpler, I find. If you don't need what caption offers or the complexities and sophistication of subcaption, subfig often works well. – cfr Jul 16 '16 at 02:17
  • 2
    @cfr What do you mean by "simpler"? "Simpler to use"? The syntax of \subcaptionbox (by subcaption) is similar to \subfloat (by subfig). "Simpler implementation"? No, the major part of the caption package is inside caption3.sty and this is loaded by subfig, too, even when using caption=false. The rest of subfig is handling the counters and duplicated code while the (sub)caption package tries to use as much code as possible for both, captions and sub-captions. So if you want a real lightweight solution without all the caption stuff, you need to use subfigure. –  Jul 17 '16 at 10:46
  • 2
    @AxelSommerfeldt Simpler to understand and to use. subcaption's documentation requires more effort to navigate. Not necessarily more difficult, but certainly trickier and more time-consuming. subfig is relatively straightforward to figure out and utilise. This is not a criticism of subcaption. It is pretty much to be expected given that subcaption is more powerful/flexible than subfig. But if you don't need that power and flexibility, subfig is often easier. – cfr Jul 17 '16 at 18:14
  • @cfr Thanks for the feedback. I'm not really happy with the documentation either, and am currently rewriting the caption bundle doc., but unfortunately progress is rather slow... –  Jul 19 '16 at 15:14
  • @AxelSommerfeldt Documentation is hard. Really hard. – cfr Jul 19 '16 at 15:28
11

I was able to avoid subfig completely. Used The Subfig Package documentation: "Do You Need This Package?"

\begin{figure}%
\centering
\parbox{1.2in}{...figure code...}%
\qquad
\begin{minipage}{1.2in}%
...figure code...
\end{minipage}%
\caption{Here are two figures side-by-side.}%
\label{fig:1figs}%
\end{figure}

Thanks for the info! I'm sure it will be even more useful as I dig into the package more.

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
PLG
  • 1,202