GeneralPage positioning of graphs

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
tgrosu
Posts: 1
Joined: Tue Jun 03, 2008 9:42 am

Page positioning of graphs

Post by tgrosu »

Hello everyone!

I am writing an official document and I ran across the following problem. When I insert a figure, it is automatically aligned at the top of the page and not at the point where the text flows. The problem is that the figures are associated wit the text and sometimes it is the case that the figures are aligned before the text on the same page, or even on previous pages, which definitely doesn't make much sense.

Can you please tell me how to force a graph to follow the relevant text and not to precede it?

Thank you very much!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Page positioning of graphs

Post by localghost »

If you want to have the figure in the final output exactly where it is declared in the source, you can use a command provided by the caption package. An example will demonstrate its usage.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{[fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{blindtext}

\begin{document}
  \blindtext
  \begin{center}
    \rule{6.4cm}{3.6cm}    % replace this with your graphics file
    \captionof{figure}[Dummy figure entry to the ToC]{Dummy figure}\label{fig:dummy}
  \end{center}
  \blindtext
\end{document}
There are other solutions using the standard figure environment, but therefore we need to have some code in the sense of a minimal working example (MWE) that shows how you declare your float environments.


Best regards and welcome aboard
Thorsten
Post Reply