3

I have a figure that is bigger than the margins. In the long run, the size won't matter. But for now, Latex is putting it on its own page (which is fine) and placing it at the very bottom of the sheet. It looks bad because it gets mixed up with the page number. Is there any way to convince Latex to move the figure up to the top of the page? BTW, the [t] argument has no effect. Thanks.

EDIT: Here's a bit of code that produces the problem:

\documentclass{article}

\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}
\centering
\subfloat[\label{fig:a}]{\includegraphics[width=5in]{example-image-a}}
\par
\subfloat[\label{fig:b}]{\includegraphics[width=5in]{example-image-b}}
\par
\caption{Note that the figure space overlaps the page number.}
\end{figure}

\end{document}

The two PNGs can be any fairly square figures with widths around 5 in.

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jun 24 '15 at 23:58
  • Your image is so big that occupy whole page. Otherwise for figure positioning us option htbp, ie begin{figure}[htbp] – Zarko Jun 25 '15 at 2:18
3

I've sometimes found that it is enough to put negative vertical space above the tall float, e.g.,

  \begin{figure}
      \vspace*{-2.5\baselineskip}
      \centerline{\hbox{\includegraphics*[keepaspectratio=true,width=0.87\textwidth]{mytallfig.pdf}}}
      \caption{My lengthy multiline caption}
  \end{figure}

or something along those lines. This requires some fiddling around in each case, however, and so I like the more systematic suggestions that others have made above. But this lazy solution works.

  • this is not good idea. rather make figure height smaller. for example \includegraphics[height=0.4\textheight]{mytallfig.pdf}. Also use of\centerline is problematic. Better is use only\begin{figure}\centering\includegraphics[height=0.4\texthight] {mytallfig.pdf}\caption{My lengthy multi line caption}\end{figure}. – Zarko Feb 26 '17 at 3:33
  • @Zarko 10 -- Thanks, very good point on '\centerline'. Could you elaborate, however, on why it is not a good idea to move the figure upward by a few baselines, i.e., into the space reserved for the page header? That space is typically empty on pages that have only a figure. The rationale for keeping the figure large may be, e.g., to improve readability of small details on an image that itself cannot be redrawn. – John Feb 26 '17 at 13:57
  • this is mater of taste, but so far I didn't see any book which not have uniform page layout. if the size of figure is so important, than this figure should be divided into two figures with width of the \textwidth. – Zarko Feb 26 '17 at 15:33
  • Ok, thanks. I do agree that page design should govern in the end. In cases with prominent running headers, pulling the figure up can add some visual balance between facing pages. – John Feb 26 '17 at 16:02
2

You can always lie:

\documentclass{article}

\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}
\centering
\makebox(0,545){%
  \parbox[b]{5in}{%
  \subfloat[\label{fig:a}]{\includegraphics[width=5in]{example-image-a}}
  \par
  \subfloat[\label{fig:b}]{\includegraphics[width=5in]{example-image-b}}
  \vspace*{10mm}\par\mbox{ }}}
  \caption{Note that the figure space overlaps the page number.}
\end{figure}

\end{document}

lying to TeX

  • I would use \raisebox to both move it up and lie about how big it is. Throw in \rlap and some negative \hspace and you won't even get an overfull \hbox warning. – John Kormylo Jun 25 '15 at 3:34
  • Thanks. This does work for the example. Problem is that when I do my real figure with a much longer caption, the caption still writes over the page number. I can use your solution to raise the figures in the page, but the caption doesn't follow them. It stays on top of the page number. Any way to get the whole shootin' match to move up? Thanks. – bob.sacamento Jun 25 '15 at 15:33
  • @bob.sacamento I would take John Kormylo's advice. He's much better at this stuff than me. – cfr Jun 25 '15 at 16:24
  • @bob.sacamento - Judging by your description of the problem, the main problem is that the float is simply too tall. Try reducing the height of the graphs. – Mico Aug 24 '15 at 6:52
1

If there's a single float on a floats-only page, LaTeX by default centers the float vertically, i.e., tries to create equal amounts of whitespace above and below the float. Your description -- that LaTeX is placing your float at the very bottom of the page -- makes it sound like the float is too tall for the page as well as, apparently, too wide. (If a float is too tall for the textblock, LaTeX aligns its top edge with the top edge of the text block; any vertical overage will thus become apparent at the bottom of the text block, possibly to the point of interfering with the page number.)

I suggest you change the dimensioning of the subfloats to focus on their relative vertical dimension rather than on their absolute horizontal dimension.

enter image description here

\documentclass{article}

\usepackage{graphicx}
\usepackage{subfig}
\usepackage{showframe} % just to show page layout
\begin{document}

\begin{figure}
\centering
\subfloat[\label{fig:a}]{\includegraphics[height=0.4\textheight]{example-image-a}}
\par
\subfloat[\label{fig:b}]{\includegraphics[height=0.4\textheight]{example-image-b}}
\par
\caption{Note that the figure space no longer overlaps the page number. Note that the figure space no longer overlaps the page number. Note that the figure space no longer overlaps the page number. Note that the figure space no longer overlaps the page number.}
\end{figure}

\end{document}

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.