Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Sub-figures using subfloat in LaTeX

📅 2010-Mar-14 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Two subfigures in a figure in LaTeX
Two subfigures in a figure in LaTeX

To include more than one figures inside a figure the subfig package can be used. It provides the subfloat command that is used to specify each of the sub-figures as a figure.

Its usage is shown below in a simple example:

% Package for subfloat

% Figure with two sub-figures
\caption{ Two foo figures. }

Note that each of the subfigures can be given an optional label which can be used to refer to them in the text of the document.

If you are using TeX Live, in Ubuntu for example, subfig can be found in the texlive-latex-recommended package. Note that I have seen that subfig has problems working with Beamer.