15

Possible Duplicate:
How to influence the position of float environments like figure and table in LaTeX?

I am trying to create a table after some text:

Some text. foobar foobar \\

\begin{table}[t]
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
 & a & c & & &  \\
\hline
$\{X, X', Y\}$ & & b &  & &  \\
\hline
\hline
\end{tabular}
\end{table}

However, the table is appearing before the text even though I type if after I type the text. Why?

David Faux
  • 4,117

1 Answers1

19

If you don't need to use a caption, don't use table environment which is a floating object. Further, you have mentioned the option [t] which means the table will be at the top of the page. Use [htb] as the option as in this code:

\documentclass{book}
\usepackage{lipsum}

\begin{document}
 \lipsum[1]

\begin{table}[htb]
\centering
\caption{This is a table}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
 & a & c & & &  \\
\hline
$\{X, X', Y\}$ & & b &  & &  \\
\hline
\hline
\end{tabular}
\end{table}
\end{document}

enter image description here

For more details on the control of float placements refer to this question and answers.