Reputation: 17
I want to create 10 subgraphs side by side in latex overleaf. So, I want to put each two subgraphs beside each other with appropriate size (I need to keep the size without decreasing the size). Already I did that, but the problem is that the last two subgraphs (9 and 10) is out of the page size because the single page can't fit all the subgraphs. Thus, I'm looking for a way to keep the first eight subgraphs in the first page and then put the last two subfigures in the next page. Is there any method to do that?
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[hi]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\caption{A subfigure} \label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-b}
\caption{B subfigure} \label{fig:sub2}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-c}
\caption{C subfigure} \label{fig:sub3}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-d}
\caption{D subfigure} \label{fig:sub4}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-e}
\caption{E subfigure} \label{fig:sub5}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-f}
\caption{F subfigure} \label{fig:sub6}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-g}
\caption{G subfigure} \label{fig:sub7}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-h}
\caption{H subfigure} \label{fig:sub8}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-i}
\caption{I subfigure} \label{fig:sub9}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-j}
\caption{J subfigure} \label{fig:sub10}
\end{subfigure}
\caption{the main caption of the figures} \label{fig:figure}
\end{figure}
\end{document}
Upvotes: 1
Views: 5976
Reputation: 38873
You can use \ContinuedFloat
from the caption
package to split your figure in two. In case you have problems with other text from your document interfering with the figure, add \clearpage
before/after it.
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\caption{A subfigure} \label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-b}
\caption{B subfigure} \label{fig:sub2}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-c}
\caption{C subfigure} \label{fig:sub3}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{D subfigure} \label{fig:sub4}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{E subfigure} \label{fig:sub5}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{F subfigure} \label{fig:sub6}
\end{subfigure}
\hfill
\end{figure}
\begin{figure}[htbp]
\centering
\ContinuedFloat
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{G subfigure} \label{fig:sub7}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{H subfigure} \label{fig:sub8}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{I subfigure} \label{fig:sub9}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{J subfigure} \label{fig:sub10}
\end{subfigure}
\caption{the main caption of the figures} \label{fig:figure}
\end{figure}
\end{document}
Upvotes: 2