Graphics, Figures & Tablestext coming before tables and images

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
skibbereen
Posts: 1
Joined: Wed Sep 16, 2009 1:59 am

text coming before tables and images

Post by skibbereen »

Hi, I'm really new to Latex and I've been having this problem where some text that I type after a table or picture is shown before the table or picture when I typeset. for example:

here's where I write a paragraph of text #1

here's a table

here's paragraph of text #2

when I typeset that, it comes up:

paragraph #1
paragraph #2
table

does anyone know how I can fix this? thank you.

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

text coming before tables and images

Post by gmedina »

skibbereen wrote:...does anyone know how I can fix this? thank you.
There's really nothing to fix; I mean, that behaviour is not really a problem; it's one of the useful characteristics of (La)TeX. Some objects float.

Here you can read a brief description:

TeX FAQ - Moving tables and figures in LaTeX.

In that page you will find a link that explains how to prevent figures and tables from floating.

Here you can also find some useful advise:

Prevent floating of figures or tables - TeXblog
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

text coming before tables and images

Post by localghost »

You can use special options for placing float objects. Consider the following example.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{blindtext}

\begin{document}
  \blindtext

  \begin{figure}%[!ht]   % <--- try these options by uncommenting them
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure}\label{fig:dummy}
  \end{figure}

  \blindtext
\end{document}
Find out the difference by compiling two versions of the code. Once without and once with the options for the float environment (figure here). Your document shows a similar behaviour.


Best regards and welcome to the board
Thorsten
Post Reply