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 the problem, that I need to insert some external pates in my thesis. After that I start a new section and want to add a (floating) figure.

The problem is that the figure is not set here as I defined (\begin{float}[htp]). Instead it is always set on a separate page as far as I can see.

I will give an example.

The file to be included (Call it includefile.tex or modify the other file later and run pdflatex on it.):

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[utf8x]{inputenc}
\title{This is just a simple sample file}
\begin{document}
\maketitle
\end{document}

The main file:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage{lipsum}
\begin{document}
\section{First}
\lipsum[1-4]
\includepdf{includefile.pdf}
\pagebreak
\section{Problem}
Here comes some simple text.

\begin{figure}[htp]
    \centering
    \rule{0.5\textwidth}{0.3\textheight}
    \caption{A simple picture.}
\end{figure}

This should come after the figure.
\end{document}

You will see, that the black box is typeset on the forth page. Although there is clearly enough space on the third page.

If you just diable the input of the external PDF file (comment out line 8), you will get the expected result.

How to place the figure generally correct? Is this a problem of pdfpages?

I do know of the possibilty to use the float package and the H modifier. The is not what I want to do because this should be done automatically. I have it in an user defined macro for easy modification of e.g the appearence. Therefore setting to H would lead to multiple changes in the text, which is what I would like to avoid.

share|improve this question
1  
Good question! However, I would not call it "breaks the algorithm", more "changes [htp] to [p] with floats in the queue. If you use [!t] placement, everything works as expected. –  tohecz Feb 20 '13 at 12:52
add comment

1 Answer

up vote 1 down vote accepted

use

\begin{figure}[!htp]

With the ! TeX can ignore the parameters for floats, eg amount of text per page, aso

share|improve this answer
add comment

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.