3

I am trying to display five images as sub figures, but I would like to arrange them in a different way than what I am currently getting as output. Depending on whether I use the \hfill each subfloat, I can get a different arrangement, but I can't seem to be able to arrange them like this (which is what I would like to do):

       (a)    (b)    (c)

           (d)     (e)

The code and output that I am getting are:

\begin{figure}[!htb]
    \caption{capt}
    \subfloat[]{\includegraphics[width=0.33\textwidth]{blank.png}}\hfill
    \subfloat[]{\includegraphics[width=0.33\textwidth]{blank.png}}\hfill
    \subfloat[]{\includegraphics[width=0.33\textwidth]{blank.png}}\hfill
    \subfloat[]{\includegraphics[width=0.33\textwidth]{blank.png}}\hfill
    \subfloat[]{\includegraphics[width=0.33\textwidth]{blank.png}}   
     \label{lab}
\end{figure}

Output example

Thank you so much for the help!

1
  • Welcome to TeX.SE.
    – Mico
    Jun 19, 2020 at 14:06

2 Answers 2

5

Make two paragraphs and use \centering. Don't forget the p option.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}[!htbp]
\centering

\caption{capt}\label{lab}

\subfloat[]{\includegraphics[width=0.33\textwidth]{example-image}}\hfill
\subfloat[]{\includegraphics[width=0.33\textwidth]{example-image}}\hfill
\subfloat[]{\includegraphics[width=0.33\textwidth]{example-image}}

\subfloat[]{\includegraphics[width=0.33\textwidth]{example-image}}%
\hspace*{0.005\textwidth}%
\subfloat[]{\includegraphics[width=0.33\textwidth]{example-image}}

\end{figure}

\end{document}

The separation space in the bottom row will be the same as in the top one.

enter image description here

3
  • 1
    \ in the documentclass
    – js bibra
    Jun 19, 2020 at 14:31
  • @jsbibra Thanks: copy/paste error.
    – egreg
    Jun 19, 2020 at 14:39
  • That's perfect! Thank you, @egreg
    – Victor
    Jun 19, 2020 at 14:43
2

Something like this?

enter image description here

Note the blank line and \medskip directive after the 3rd of 5 subfigures

\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{subfig,graphicx}
\begin{document}
\begin{figure}[!htb]
\caption{capt}\label{lab}

\subfloat[]{\includegraphics[width=0.32\textwidth]{dados/figuras/blank.png}}\hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{dados/figuras/blank.png}}\hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{dados/figuras/blank.png}}
    
\medskip
\hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{dados/figuras/blank.png}}\hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{dados/figuras/blank.png}}   
\hfill\mbox{}
     
\end{figure}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .