[Tex/LaTex] Why I can not place the figure where I want

floatsgraphicspositioning

I have some text and after that I want to insert a figure. The text almost finishes on the second page, so I want to place the figure on the top of the third page (right after the text), but I cant. I've read the placement commands frome here: http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions and I tried all the different options (i.e. \begin{figure}[t!], \begin{figure}[t], \begin{figure}[b], \begin{figure}[h], …) but the figure stays on the same place in the middle of the third page. I want it to go at the top. What I am missing?
Here is the code:

    \documentclass[11pt]{article}

\usepackage{amssymb,amsmath}
\usepackage{pgf}
\usepackage{tikz}
\usepackage{amsthm}
\usepackage{graphicx}
\graphicspath{ {img/} }
\usepackage{fullpage}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\newtheorem{thm}{Theorem}
\newtheorem{thm1}{Theorem}
\theoremstyle{definition}
\usepackage{float}
\newtheorem{defn}{Definition}[section]
\floatname{algorithm}{Algorithm}
\newcommand{\euler}{e}
\newenvironment{claim}[1]{\par\noindent\underline{Claim:}\space#1}{}
\newenvironment{claimproof}[1]{\par\noindent\underline{Proof:}\space#1}{\hfill $\blacksquare$}

\begin{document}

\title{some titlw}
\author{me}
\date{\today}
\maketitle
\section{Some section}
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdf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ure}[t]
\includegraphics[width=0.25\textwidth]{graphic1}           
\end{figure}
asasdasdadsads
\end{document}

Best Answer

As it stands, your document does not contain enough text for LaTeX to put the figure at the top of a page. On the first page, floats at the top are banned. There is no second page (of text). So, having the figure left at the end of the document, LaTeX does whatever it must to place it: it puts it on a page of floats and, by default, that means the floats are vertically centred on the page.

If you have more text after the figure, this won't happen:

\documentclass[11pt]{article}
\usepackage{kantlipsum}% for the demo
\usepackage{amssymb,mathtools}% fixes/enhancements for amsmath (loads amsmath)
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage{amsthm}
\usepackage{fullpage}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\newtheorem{thm}{Theorem}
\newtheorem{thm1}{Theorem}
\theoremstyle{definition}
\usepackage{float}
\newtheorem{defn}{Definition}[section]
\floatname{algorithm}{Algorithm}
\newcommand{\euler}{e}
\newenvironment{claim}[1]{\par\noindent\underline{Claim:}\space#1}{}
\newenvironment{claimproof}[1]{\par\noindent\underline{Proof:}\space#1}{\hfill $\blacksquare$}

\begin{document}

  \title{some titlw}
  \author{me}
  \date{\today}
  \maketitle
  \section{Some section}
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxcVxcVxcvcvxxcVxcVvcx
  sdfsdfdsfsdfsdfsdfdfvdxffvdxvxdvcdFvSDFdxfvdxfvxfcvxdfvxcfvxcvxcVxCVxc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includegraphics[width=0.25\textwidth]{graphic1}
  \end{figure}
  asasdasdadsads

  \kant[1-2]
\end{document}

float to top

If you want the figure to be centred, add \centering at the start of the figure environment`.

float to centre top

If that's the end of your document, you can add \newpage\vfill\mbox{ } at the end to force a new, otherwise empty page for the figure to float to the top of.

float to centre top on empty page

Related Question