1. Thank you, this was very useful.

2. Anja

Thank you, this is indeed very useful!

I only have one question:

What should I adjust if I have 3×2 subfigures?

I followed your suggestion with adding an empty line after the third subfigure but I end up with 2 colums and 4 lines instead of 3 colums and 2 lines.

• tom

Hi Anja,

Thanks for your question. The code below produces three columns. The trick is to split the line width into three equal parts instead of assigning a fixed width.

Best, Tom

\documentclass[varwidth, border=10pt]{standalone}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}
\begin{figure}
\begin{subfigure}[b]{0.3\linewidth}
\centering\rule{1cm}{1cm}
\caption{Caption text 1}
\end{subfigure}\hfill
\begin{subfigure}[b]{0.3\linewidth}
\centering\rule{1cm}{1cm}
\caption{Caption text 2}
\end{subfigure}\hfill
\begin{subfigure}[b]{0.3\linewidth}
\centering\rule{1cm}{1cm}
\caption{Caption text 3}
\end{subfigure}

\begin{subfigure}[b]{0.3\linewidth}
\centering\rule{1cm}{1cm}
\caption{Caption text 4}
\end{subfigure}\hfill
\begin{subfigure}[b]{0.3\linewidth}
\centering\rule{1cm}{1cm}
\caption{Caption text 5}
\end{subfigure}\hfill
\begin{subfigure}[b]{0.3\linewidth}
\centering\rule{1cm}{1cm}
\caption{Caption text 6}
\end{subfigure}
\end{figure}
\end{document}
3. Ben

Many thanks for these tricks!

4. frank

Doesn’t seem to work.
! LaTeX Error: Not in outer par mode.

• Hi Frank,

Thanks for your feedback. The code above works for me. The error you see typically arises if you place a floating environment (e.g. figure, table) within a non floating environment (e.g. minipage). If that doesn’t help, please provide a minimal working example for me to reproduce the error.

Best, Tom

5. Vincent

The logarithmic graph has base e, not 10

• That’s right, thanks for letting me know.

Best, Tom

6. Hoan

Hi, thanks a lot.
I did as your instruction and it worked. But when I tried to label each sub figure and referenced it did not work (I want it appears 1a 1b 1c…). Do you have any suggestions?

• Hi Hoan,

Thanks for your feedback. You are right, the labels are missing in the example above. Please take a look at the examples on my figures code snippet page. There, the labels are set correctly and it shows how to reference the figures. Use either \ref or \subref depending on if you want to get the full label or only the sub-label.

HTH, Tom

7. Fossil Plants

THANKS!!!! This saved me a bunch of time! I ended up using the pdfcrop technique, as it is much simpler to pull out a page with a figure and crop it, then to make the new fig in latex.

• Great to hear. Best, Tom