2

How can I get latex to place my figure sufficiently at the top of my page to allow for my caption to nicely fit at the bottom?

enter image description here

\documentclass{amsart}
\usepackage{graphicx}
\begin{document}


\begin{figure}[htbp]
\makebox[\textwidth]{
  \centering
  \includegraphics{./Figures/chapter7/rel_risk_overall_ss.pdf}}
    \caption{Comparing average risk during care to 3 uninfected patients within single and multibed room relative to \emph{direct care}.  $\alpha=0.069$. }
  \label{fig:rel_risk}
\end{figure}

\end{document}

  • 1
    you can tweak the size of the included graphics with totalheight or width options, for example \includegraphics[totalheight=17cm] \includegraphics[width=\textwidth]. Any of these two commands will keep the aspect ratio of the figure. – guillem May 17 '13 at 11:06
  • Ahh yes this looks good! totalheight will not scale the figure then? – HCAI May 17 '13 at 11:08
  • As far as i recall, totalheight will scale the figure (keeping the aspect ratio). I think that you could specify both width and height using both options at the same time, and the image aspect ratio will change. There is also the scale option which can be useful in your case. – guillem May 17 '13 at 11:12
  • I used to use scale assiduously but don't want the font size of my figures to change noticeably. I really just want my figure to fit on the page by placing the float closer to the top of the page. – HCAI May 17 '13 at 14:22
2

Most likely your figure is too large (in height) and you should get a warning when compiling. The geometry package can show you the actual available space with \usepackage[showframe]{geometry}. Usually figures are centred vertically on a page if there is no other content. You can align them at the top with

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother
  • Hmm quite possibly. Where do I paste your code? – HCAI May 17 '13 at 11:06
  • it needs to go before \begin{document} to affect your whole document. Did you check your page size with the geometry package, did you check for warnings in the log-file? – Martin H May 17 '13 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.