1

I have many images to display on multiple pages, with 4 rows of 2 images side by side (total 8) per page.

However, I do not want the images at the last page (sometimes <4 rows) to be centered, but ordering from top to bottom. This is done by specifying \begin{figure}[ht].

Code for first 2 images (and repeats for another 5 times for the total 7 rows):

\documentclass[]{article}
\usepackage{floatrow}
\usepackage{graphicx}
\begin{figure}[ht] 
\begin{floatrow} 
\begin{minipage}[t]{0.4\linewidth} 
\includegraphics[width=120pt]{image1.pdf} 
\end{minipage} \hspace{-55pt} 
\begin{minipage}[t]{0.8\linewidth}\vspace{20pt} 
\includegraphics[width=370pt]{image2.pdf}
\newline 
\vspace{-50pt} 
\end{minipage} 
\end{floatrow} 
\end{figure}

\begin{figure}[ht] 
\begin{floatrow} 
\begin{minipage}[t]{0.4\linewidth} 
\includegraphics[width=120pt]{image3.pdf} 
\end{minipage} 
\hspace{-55pt} 
\begin{minipage}[t]{0.8\linewidth}\vspace{20pt} 
\includegraphics[width=370pt]{image4.pdf}
\newline 
\vspace{-50pt} 
\end{minipage} 
\end{floatrow} 
\end{figure}

But the resultant images are not arranged correctly, with only 3 images being on the 1st page and 4 on the second:

enter image description here

The desired output is to occupy pages fully (4 images first page), and then occupy from top to bottom in the subsequent page, if there is less than 4 images left:

enter image description here

6
  • Could you please make your example code compilable by adding the documentclass as well as the relevant packages? See also: minimal working example (MWE)
    – leandriis
    Aug 27, 2019 at 20:05
  • Please also specify if the images will have captions. Also, why do you use a floating environment like figure if you aparently don't want your images to move around?
    – leandriis
    Aug 27, 2019 at 20:07
  • @leandriis I have editted to add the document class and packages used for the example. I use the floating environment to include and align all elements (images, table and caption, with the last two not included in this MWE) in the rows.
    – Jane
    Aug 27, 2019 at 20:43
  • Why not simply use something like \noindent \includegraphics[width=0.225\textwidth]{image1.pdf}% \hfill% \includegraphics[width=0.725\textwidth]{image2.pdf} \bigskip completely without the figure environments? You can use \captionof from the caption package to add a caption. If this does not siut your needs regarding the not shown table and captions, please edit your question to also include information on the desired output and alignment of thouse elements.
    – leandriis
    Aug 27, 2019 at 21:22
  • Thank you for the simpler fix. With this information and the help from another post tex.stackexchange.com/questions/66109/… I was able to solve the more complex example of my code with additional tables.
    – Jane
    Aug 28, 2019 at 0:20

1 Answer 1

2
  • You not provide any information about your document.
  • The sum of width of minipages in one row is bigger than text width. This cause problems to placements figure on page.
  • instead of float rows and minipages I would rather use tabular at least for each row with figures:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\setcounter{totalnumber}{4}         % 2 may work better
\renewcommand{\textfraction}{0.05}  % allow minimal text w. figs


\begin{document}
    \begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep} 
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image1.pdf}
    &   \includegraphics{image2.pdf} 
\end{tabular}
\end{figure}

\begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image3.pdf}
    &   \includegraphics{image4.pdf}
\end{tabular}
    \end{figure}

\begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image5.pdf}
    &   \includegraphics{image6.pdf}
\end{tabular}
    \end{figure}

\begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image7.pdf}
    &   \includegraphics{image8.pdf}
\end{tabular}
    \end{figure}

\clearpage
\begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image9.pdf}
    &   \includegraphics{image10.pdf}
\end{tabular}
    \end{figure}

\begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image7.pdf}
    &   \includegraphics{image11.pdf}
\end{tabular}
    \end{figure}

\begin{figure}[h]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image9.pdf}
    &   \includegraphics{image12.pdf}
\end{tabular}
    \end{figure}
\end{document}
  • it is not clear why you like to have each figures pair as standalone float. You should consider to merge four or more rows with figures into one float:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}

\begin{document}
    \begin{figure}[ht]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep} 
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image1.pdf}
    &   \includegraphics{image2.pdf}    \\
\includegraphics{image3.pdf}
    &   \includegraphics{image4.pdf}    \\
\includegraphics{image5.pdf}
    &   \includegraphics{image6.pdf}    \\
\includegraphics{image7.pdf}
    &   \includegraphics{image8.pdf}    
\end{tabular}
    \end{figure}

\begin{figure}[ht]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep}
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image9.pdf}
    &   \includegraphics{image10.pdf}   \\
\includegraphics{image7.pdf}
    &   \includegraphics{image11.pdf}   \\
\includegraphics{image9.pdf}
    &   \includegraphics{image12.pdf}   \\
\end{tabular}
    \end{figure}
\end{document}

If you like to ad captions to your figure, than you need to put in separate table row. For example like this:

    \begin{figure}[ht]
    \setkeys{Gin}{width=\linewidth}
\begin{tabular}{@{} p{\dimexpr0.25\linewidth-\tabcolsep} 
                    p{\dimexpr0.75\linewidth-\tabcolsep} @{}}
\includegraphics{image1.pdf}
    &   \includegraphics{image2.pdf}    \\
\caption{figure 1}
    &   \caption{figure 2}              \\
% rest of float's body
0

You must log in to answer this question.

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