2

I would like to have a figure that occupies whatever white space is left at the bottom of the page without having to fine tune it manually.

Here is an attempt of what I'm trying to do:

\documentclass[a4paper]{report}
\usepackage{lipsum}
\usepackage{float}
\usepackage{graphicx}

\begin{document}
\lipsum[1-2]
\begin{figure}[H]
  \centering
  \includegraphics[height=\vfill]{example.png} % error: illegal unit of measure
\end{figure}
\end{document}

I'm looking for a command to replace the incorrect \vfill, but give the effect I'm looking for. Thank you

Tymric
  • 527
  • 1
  • 3
  • 11
  • 1
    You can't really do this (although you can approximate in various ways) Tex breaks up the page a long time after the vertical list has been set. Also what do you want to do if this falls 0.01pt from the bottom of the page, just have a very small image? – David Carlisle May 19 '14 at 14:41
  • @DavidCarlisle Why couldn't it work in a similar way to how \vfill normally does? Or perhaps like citations and references by requiring the compiler to run twice? I agree that it will still require some attention, but I only intend to use it where there is enough space to show the image. – Tymric May 19 '14 at 14:45
  • 1
    See http://tex.stackexchange.com/questions/12125/stretching-a-framebox-over-the-whole-page/. You will probably have to reduce the calculated height a bit to account for the spaces around the figure environment. And you naturally can test if the value is too small. – Ulrike Fischer May 19 '14 at 15:01
  • TeX has boxes and glue as its model glue stretches and boxes are fixed, the output routine when deciding whether to break the page at any point is informed how bad any glue stretch would have to be to break there, if glue can't stretch enough you get the underful box warning, but no such feature for boxes and the image needs to be included and scaled when the vertical list is being set which is nowhere near teh page break decision TeX may set several pages of material before deciding to split off any pages. – David Carlisle May 19 '14 at 15:03

0 Answers0