0

I want to arrange 33 subfigures by putting them in groups of 3, I tried the following solution:

\documentclass[smallextended,table]{svjour3} 
\begin{document}
\begin{figure}
%start first row
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\textwidth]{IMG/IMG_RQs/cli/....pdf}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\textwidth]{IMG/IMG_RQs/cli/....pdf}
\end{subfigure}

\hfill \begin{subfigure}{0.3\textwidth} \includegraphics[width=\textwidth]{IMG/IMG_RQs/cli/....pdf} %end first row .... %start last row... \hfill \begin{subfigure}{0.3\textwidth} \includegraphics[width=\textwidth]{IMG/IMG_RQs/cli/....pdf} \hfill \begin{subfigure}{0.3\textwidth} \includegraphics[width=\textwidth]{IMG/IMG_RQs/cli/....pdf} \hfill \begin{subfigure}{0.3\textwidth} \includegraphics[width=\textwidth]{IMG/IMG_RQs/cli/....pdf} \end{subfigure} \end{figure} \end{document}

The output is partially correct, indeed, the figures occupy three columns, however, the last group of images is drawn outside the vertical margin of the document, as shown in figure enter image description here

How can I fix it?

2 Answers2

1

As you cannot fit 33 images on one page, one simple solution would be to use longtable instead of figure. The adjustbox is added to set image dimensions in one place. Similarly, the macro \N is created to add the same vertical space after each row. A similar effect can be accomplished by changing arraystretch to a value larger than 1.0

\renewcommand\arraystretch{F}   % F>1.0 causes vertical stretch

but then change \N to the regular \\.

showframe is not important in the final version. It serves as a reference by drawing frames around all pages.

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage[Export]{adjustbox}
\usepackage{longtable}

\usepackage{showframe} % For a reference in drafts \renewcommand\ShowFrameLinethickness{0.2pt} \renewcommand\ShowFrameColor{\color{blue}}

\adjustboxset{width=0.28\linewidth} \newcommand\N{\[10pt]}

\begin{document}

\begin{longtable}{ccc} \caption{Set of N x 3 figures} \ \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \includegraphics{example-image-a} & \includegraphics{example-image-b} & \includegraphics{example-image-c} \N \end{longtable} \end{document}

Celdor
  • 9,058
1

As an alternative to longtable proposed by Celdor, you can use a tcbraster from tcolorbox.

\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcbraster}[raster columns=3, blanker]
\foreach \i in {1,...,11}
    {\tcbincludegraphics{example-image-a}
    \tcbincludegraphics{example-image-b}
    \tcbincludegraphics{example-image-c}}
\end{tcbraster}
\end{document}

enter image description here

Ignasi
  • 136,588