1

I am using the twosided book document class, and I am trying to place two figures with text after each figure. I am noticing that after the first figure, the text is placed at the bottom of the page with a large amount of white space separating the figure and the text. However, after the second image, there is no such white space and the text neatly hugs the bottom of second figure. Is there any way to replicate this behaviour on the first figure?

Please note that I am using the float package here to force figure placement, I noticed that the standard !htp does not achieve the proper text placement. But if there is a solution that works with !htp, then I am absolutely open to it.

The MWE is as follows:

\documentclass[11pt, twoside]{book}
\usepackage{graphicx}
\usepackage{mwe}
\usepackage{float}

\begin{document}

\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\linewidth]{example-image-a}
  \caption{caption-a}
\end{figure}

testing

\begin{figure}[H]
  \centering
  \includegraphics[width=0.8\linewidth]{example-image-b}
  \caption{caption-b}
\end{figure}

testing

\end{document}

which produces the following document:

figure and text 1

figure and text 2

EDIT:

It was suggested that the [H] should be avoided, and so when I convert to [ht] options, the ordering of the figure and the text is not as intended.

\documentclass[11pt, twoside]{book}
\usepackage{graphicx}
\usepackage{mwe}
\usepackage{float}
\usepackage{blindtext}

\begin{document}

\begin{figure}[ht]
  \centering
  \includegraphics[width=0.8\linewidth]{example-image-a}
  \caption{caption-a}
\end{figure}

\blindtext

\begin{figure}[]
  \centering
  \includegraphics[width=0.8\linewidth]{example-image-b}
  \caption{caption-b}
\end{figure}

\blindtext

\end{document}

which results in the following document:

edited page 1 edited page 2

Inserting a \clearpage after the text in the first MWE worked for me.

3
  • 1
    twoside also activates \flushbottom for vertically justification of pages. I would recommend not to use option [H] (but no option or something like [htp]), to avoid the issue after adding more text. But maybe you want \raggedbottom (which I do not recommend for books) or just a \clearpage before the second figure.
    – cabohah
    Nov 17, 2023 at 8:17
  • Your images are to big that can be fit on one page. Try to reduce the size of the first one to width=0.8 and than replace placeholder [H] with [!ht]. Please consider @cabohah comments above.
    – Zarko
    Nov 17, 2023 at 9:23
  • Thanks @cabobah, I tried avoiding the [H] option as you suggested, but this causes issues with figure-text ordering (see edit). I then tried your suggestion with [H] and the \clearpage command, and this works as intended, thanks! Nov 17, 2023 at 20:41

0

Browse other questions tagged .