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'm using this code to place an image in my page:

\begin{figure}[htp]
\begin{center}
  \includegraphics{img/helper-m.png}
  \caption[labelInTOC]{Helper klasse}
  \label{img:helper-m}
\end{center}
\end{figure}

I don't know why but this is taking up the entire page. The image isn't that big, it's 280*339px in size. I'm using the same code on some other places and it's working fine, only this particular image is giving a problem. Any ideas what's wrong?

Directly under the image there's a new section btw.

share|improve this question
    
have you tried \includegraphics[width=something]{img/...}? Perhaps \includegraphics[width=.5\textwidth]{img/...} for example –  cmhughes Sep 2 '12 at 23:28
1  
Is indeed the image itself displayed so large or is it just in the middle of an otherwise empty page? If the image is displayed like magnified, maybe it contains a wrong resolution declaration. pdftex isn't including the image as a collection of pixels (as PDF is a vector-based format), but as an object with a certain bounding box. For a bitmap image, the size of the bounding box results from the number of pixels and the resolution setting. –  Stephan Lehmke Sep 2 '12 at 23:32
    
The image resolution seems fine and it's in the middle of an empty page. It also seems to have skipped a part of my textblocks to avoid creating unnecessary whitespace. Is there any way to undo that? –  Sled Sep 2 '12 at 23:43

1 Answer 1

Most likely it ended up being a float page p because the constraints on size stopped it being a t float. in which case change [htp] which allows p and constrains teh number and size of floats in the t area to [!ht] which does not allow p and removes the numeric and size constraints.

If that isn't sufficient, edit the question to add a complete example which shows the problem.

share|improve this answer
    
It worked for me! It is really strange because I have many figures of the exact same size, and one of them just took a whole page. But could you please explain what does [htp] and [!ht] mean? –  LWZ Aug 2 '13 at 5:30
1  
@LWZ latex floats may be placed at the (t)op or (b)ottom or (h)ere-where they are defined or on a float-(p)age. If you use [ht] that constrains the float to here or top and doesn't allow bottom or page floats. –  David Carlisle Aug 4 '13 at 19:47
    
Thanks! That means I should always avoid [p] if I don't want any figure ending up taking a whole page, right? What about the [!]? What does that mean? –  LWZ Aug 4 '13 at 20:11
1  
@LWZ well avoiding p makes it highly likely that LaTeX can not position the float at all and so it will be held up to the end of the document taking all later floats with it. ! means to ignore some of the constraints such as number of floats allowed on a page, but again this should be used only vary rarely. Better to set the constraints you want rather than say to ignore the constraints on each float. –  David Carlisle Aug 4 '13 at 20:15

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.