Tenho este código para colocar seis imagens em duas linhas (3 imagens para cada linha):
\begin{figure}[htbp!]
\centering
\begin{subfigure}[b]{0.3 \textwidth}
\includegraphics[width=\textwidth]{1agw-eva.png}
\caption{Cec\_2021\_ Function 1}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{2agw-eva.png}
\caption{Cec\_2021\_ Function 2}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{3agw-eva.png}
\caption{Cec\_2021\_ Function 3}
\end{subfigure}
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{4agw-eva.png}
\caption{Cec\_2021\_ Function 5}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{5agw-eva.png}
\caption{Cec\_2021\_ Function 7}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{6agw-eva.png}
\caption{Cec\_2021\_ Function 8}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.9\textwidth}
\centering
\includegraphics[width=\textwidth]{7agw-eva.png}
\caption{Cec\_2021\_ Function 3}
\end{subfigure}
\caption{caption.}
\label{fig:fig-evaluation}
\end{figure}
Mas eles são mostrados em posições verticais.
Responder1
Isso funciona muito bem. Tenha cuidado com as linhas em branco, que iniciam um novo parágrafo, pois elas não devem estar presentes nas linhas que terminam com \hfill
.
\documentclass[a4paper]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htbp!]
\centering
\begin{subfigure}[b]{0.3 \textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 1}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 2}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 3}
\end{subfigure}
\medskip
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 5}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 7}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering \includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 8}
\end{subfigure}
\medskip
\begin{subfigure}[t]{0.9\textwidth}
\centering \includegraphics[width=\textwidth]{example-image}
\caption{Cec\_2021\_ Function 3}
\end{subfigure}
\caption{Convergence curves for AGWO and other recent algorithms
during 2500 iterations.}
\label{fig:agwo-evaluation}
\end{figure}
\end{document}