# How to get the available space for an image

I want to design a figure (in a external graphics editor, e.g, Illustrator) to exactly fit (without scaling!) the whole available space on an empty page of my document minus the caption of the figure. The caption is given and its extension should be be concerned when determining the available space left for the figure.

How can I get the available image dimensions minus the caption?

• On an otherwise empty page? Otherwise the problem might be getting a rather small image. – egreg Feb 7 '14 at 9:59
• Exactly! I'll modify my question... – Robinaut Feb 7 '14 at 12:22

you might start with the layout package in an otherwise empty document, with the document class and page geometry you'll be using. the single command \layout will produce a diagram with the current values of the various dimension components. that won't give exactly the answer you want, but should provide the information you need to calculate it.

edit: i can't think offhand how this might be done automatically, so i'd experiment.

on a page by itself, using the intended document class, insert a figure environment, some \hrules to delimit the area, and include the actual caption. here's an example that will give a result that is larger than the area actually available, but the log file will say by how much it's too large, and since this layout allows everything to be measured, some fairly simple calculations should result in the length you're looking for.

\documentclass{book}
\usepackage{layout}
\begin{document}
\layout
\begin{figure}[p]
\centering
\hrule
\vspace{\textheight}
\hrule
\caption{this is the caption for the figure in question.
we don't know how much space it's going to take, so we
want to measure it, so that the figure itself can be made
as large as possible.}
\hrule
\end{figure}
\end{document}


the report in the log for this example is

LaTeX Warning: Float too large for page by 44.08887pt on input line 19.


according to the \layout diagram, the \textheight is 550pt. subtracting the 44pt reported in the log, the available height for the image should be 506pt, and the width is the \textwidth. (the thickness of the three rules is ignored here, but if it really matters, that's another 1.2pt.)

• I'm already using the layout package to get the whole page dimensions. How can I get the dimensions of the space covered by a certain image caption? – Robinaut Feb 9 '14 at 10:02