# Why is my table appearing before my text? [duplicate]

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?

## marked as duplicate by cmhughes, Qrrbrbirlbel, Werner, Kurt, Paulo CeredaOct 30 '12 at 1:01

• You are using a floating environment, table. Remove that and the tabular will appear where you place it. – Peter Grill Oct 29 '12 at 23:21
• See also the general reference: tex.stackexchange.com/q/39017/8057 – krlmlr Oct 29 '12 at 23:23
• I'd actually say this question is a duplicate of the one @user946850 pointed to? – doncherry Oct 29 '12 at 23:24
• @doncherry agreed, voting to close; David, this helps to keep the site tidy :) – cmhughes Oct 30 '12 at 0:02

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}


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