Is it possible to maximise the size of the whole float (including the caption)? I would like the float to fit the maximum allowable size (both width and height) on the page (i.e. for binding). I have included an example, which makes the figure too large for the page and cuts off the caption. I also use a package from my university that sets the margin size, etc.
\documentclass{report}
\usepackage{mwe}
\usepackage{rotating}
\begin{document}
\begin{sidewaysfigure}[p]
\includegraphics[height=1\textheight,width=1\textwidth]{example-image-a}
\caption{long figure caption...long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
long figure caption...
END OF CAPTION}
\label{fig:example}
\end{sidewaysfigure}
\end{document}
Best Answer
A simple solution, but it needs manual adjustment:
Note:
\textwidth
doesn't work as expected. Therefore in preamble is defined new length and set totextwidth-\abovecaptionskip
. Space, needed for caption is determined ingraphics
option by manually set number of caption lines in it calculation.Addendum: In case of image in the portrait format, the code is simpler. You not need sidewaystable and therefore the height of image can be calculated in
includegraphics
options field: