Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have multiple figures placed in my document (all of which are using [htbp], [ht] etc. and are placed correctly). The last figure receives a separate page (which is alright) but it's centered on this page, which looks weird as the figure is quite small.

Is there any way to get this figure on top of this page? As written above, its a separate page and the last one in this chapter.

I can't really provide a minimal example (since I guess that the position depends on my previous figures), but here's the code I use for the figure (I've tried [ht], [ht!], [htbp] etc but none of them work - I've also deleted the .aux files before compiling):

\begin{figure}[t!]
\centering
\begin{tabularx}{\columnwidth}{cc}
\subfloat[Results 1]
{ \centering    \includegraphics[width=0.47\textwidth,height=0.47\textheight,keepaspectratio]{images/plot1}
}
&
\subfloat[Results 2]
{ \centering    \includegraphics[width=0.47\textwidth,height=0.47\textheight,keepaspectratio]{images/plot2}
}
\end{tabularx}
\caption{Blabla}
\end{figure}

Thanks in advance!

share|improve this question
    
Hi and welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. It is the default and in general correct behaviour that floats on pages with no text are vertically centered. Why would you want it another way? –  tohecz May 26 at 10:33
    
It looks a bit weird because the image is quite small. Of course, another option would be to make it bigger (it's a plot), but I'm just wondering if there's a way to place it on top. –  user52450 May 26 at 10:47
    
The usage of ! as a specifier to the figure environment is discouraged for years now ;-) –  Christian Hupfer May 26 at 10:51
    
Why are you using [!t] in the first place? How about [!ht] instead if there is room for it here. –  daleif May 26 at 11:02
    
You could drop the figure environment and use \captionof{figure}{Blabla} instead. Then the graphicx is at the place where you want to have it, if there is enough place left on the page, otherwise on the next page. –  Christian Hupfer May 26 at 11:04

2 Answers 2

up vote 2 down vote accepted

Just place a large enough \vspace after the caption to push it to the top. Specifying the \vspace too large is OK. Here, I place a figure on a [p] page to guarantee the "bad" behavior, but add a 128inch \vspace after the caption, exaggerated to make the point that the actual length is immaterial, if it is large enough to do the trick.

\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[p]
\centering
\includegraphics[width=0.47\textwidth,height=0.47\textheight]{file}
\caption{Blabla}
\vspace{128in}
\end{figure}
\end{document}

enter image description here

To avoid the "warning" that comes from a too-large float (if that bothers you), one could add negative \vspace prior to the figure contents, as in

\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[p]
\vspace{-128in}
\centering
\includegraphics[width=0.47\textwidth,height=0.47\textheight]{file}
\caption{Blabla}
\end{figure}
\end{document}
share|improve this answer
1  
That's a nasty thing to do that generates a Float to large! warning. –  tohecz May 26 at 11:56
    
@tohecz How does the children's rhyme go?... Sticks and stones can break my bones, but warnings can never hurt me. –  Steven B. Segletes May 26 at 11:58
    
@tohecz Please see my follow up –  Steven B. Segletes May 26 at 12:01
    
Warning should make you warned. Warning appearing for things that are correct should be avoided. I always come through the log to check for presence of warning. And these "ok" ones then only confuse me. –  tohecz May 26 at 12:08
    
@tohecz I didn't mean to diminish the import of your statement. You admittedly make a good point, which spurred me to revise my answer. –  Steven B. Segletes May 26 at 12:10

As tohecz pointed out, this is the general and correct behavior. But you can change this by using

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

as found here, following the answer to a similar question.

share|improve this answer
    
Setting lengths globally is not always a good idea ;-) –  Christian Hupfer May 26 at 11:00
    
If you deviate from the default, at least do it consistently ;-) @ChristianHupfer –  Markus May 26 at 11:32
    
@ChristianHupfer I agree with Markus on this. The solution is IMHO the proper way to do it, if you want it in the first place. Upvoted. –  tohecz May 26 at 11:57
    
Thanks a lot! It might sound weird but I like the idea of the centering, it's just the very last page of the paper and looks extremely weird (since a small image is in the middle). –  user52450 May 26 at 20:14
    
But thanks anyways! –  user52450 May 26 at 20:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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