I have a large image that needs to be scaled and put onto one page, which has a section title as well. The image should fill the maximum space avaiable.
I tried passing different arguments to the \includegraphics
command, but it doesn't seem to work, because it doesn't take the section header into account.
I've tried different variations of
\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{myfig.png}
\includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{myfig.png}
\includegraphics[page=1,width=\textwidth,height=\textheight,keepaspectratio]{myfig.png}
Best Answer
If you can be sure that the section header will always be at the top of the page, you could try executing the commands
in the preamble and issuing a command such as
after the respective
\section
header. Depending on how much space the section header takes up, you may have to fiddle a bit with the height you assign to the graphics file, i.e., you may have to try0.7\textheight
or0.75\textheight
.Addendum: The form of the
\includegraphics
command above assumes, implicitly, that the limiting element for the image size is its height, i.e., that even if the height is maximized the width will not exceed the\textwidth
parameter. If this assumption is incorrect, i.e., if there's a chance that the image's width will exceed\textwidth
when the image's height is maximized, you should use the following version of the command instead: