Two pictures and text on one page

I got the following problem: I want to have two pictures at the end of a subsection just before the next subsections starts. I tried it with:

    \begin{figure}[ht]
\centering
\includegraphics[width=\linewidth]{geschw.png}
\caption{Geschwindigkeitsverläufe von Globoidkurve und Greifer bei 0,7s Wechselzeit}
\includegraphics[width=\linewidth]{beschl.png}
\caption{Beschläunigungsverläufe von Globoidkurve und Greifer bei 0,7s Wechselzeit}
\label{fig:geschw}
\end{figure}


But then the pictues are at the end of the whole text.

The first subsection ends at the end of a page so i tried to use

    \begin{figure}[p]


which placed them on the next page between the end of the first and the beginning of the second subsection, but in the middle of the page with white space above and below. The next subsection then starts at the next page.

Is it somehow possible to move the pictures to the top of the page and let the next subsection start right below.

-
figure is a floating environment, it is supposed to appear at specific points (top, bottom or on a page of its own) and not between sections. Please see How to influence the position of float environments like figure and table in LaTeX? and How do I ensure that figures appear in the section they're associated with? which should help you. –  Martin Scharrer Apr 5 '12 at 12:45

Try it as:

{
\centering
\includegraphics[width=\linewidth]{geschw.png}
\captionof{figure}{Geschwindigkeitsverläufe von Globoidkurve und Greifer bei 0,7s Wechselzeit}
\includegraphics[width=\linewidth]{beschl.png}
\captionof{figure}{Beschläunigungsverläufe von Globoidkurve und Greifer bei 0,7s Wechselzeit}
\label{fig:geschw}
}


The first thing you need to ask yourself when dealing with pictures is, if you want them to float or not. In your case you do not. This will give you more control but requires a greater amount of intervention in your part to set the correct spacing around them. Overflowing into the bottom margins might also force you to include manual page breaks.

Please also note the use of \captionof from the caption package to include a caption, textdoc caption for more details and a plethora of useful settings. Also note that the images might look better with a combined caption rather than two, please experiment to see what works best in your case.

Best to always include a full MWE with a question as shown below for the solution:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption,lipsum}
\begin{document}
\section{First}
\lipsum[1-2]
{
\centering
\includegraphics[width=\linewidth]{geschw.png}
\captionof{figure}{Geschwindigkeitsverläufe von Globoidkurve und Greifer bei 0,7s Wechselzeit}
\includegraphics[width=\linewidth]{beschl.png}
\captionof{figure}{Beschläunigungsverläufe von Globoidkurve und Greifer bei 0,7s Wechselzeit}
\label{fig:geschw}
}
\end{document}

-
no doesnt work. i give me an error \caption out of float and if i use the figure wrapping ther is no differnce –  Andy Apr 5 '12 at 12:36
@Andy Please usepackage{caption} and captionof in order not to get the error as in the answer. –  Yiannis Lazarides Apr 5 '12 at 12:39
thx now with \captionof{figure}{..} its working –  Andy Apr 5 '12 at 13:14

As Yiannis has said, if you never want the figures to move, not putting them in a floating environment is the thing to do. Normally however you do want to give LaTeX some flexibility.

Allowing figures at the top of the page is the default so if that is not happening you can check why. One case is easy:

When you use

\begin{figure}[p]


You are explicitly disallowing top floats and only allowing the floats to go on float pages. The default position argument is [tbp] so not using the optional argument at all is often best.

If your figure has not appeared at the top of the page it must violate one of the constraints set Frank's answer has full details of those parameters, but perhaps the most likely one to have been exceeded is \@topfraction which article class sets to 0.7 so if the double figure is more than 70% of the page height it will not by default be placed above non-floating text. You can use [!tph] where the ! says relax all the constraints for this figure.

If you want to allow floats to float, but never float into the next section you can use placeins as described here How do I ensure that figures appear in the section they're associated with?

-