1

I'm writing a homework report in the environment article and I want to include a table in the result section, my code looks like this

\newpage
\section*{Result}
\begin{table}
\begin{tabular}{m{1.5cm} m{3cm} m{3cm} m{3cm} m{3cm}}
\hline
t & Approx. Solution J=1 & Approx. Solution J=3 & Approx. Solution J=5 & Exact Solution\\
\hline
0.00 & 1.500 & 1.500 & 1.500 & 1.500\\
0.02 & 1.314 & 1.347 & 1.338 & 1.341\\
0.04 & 1.162    &1.199&1.191&1.194\\
0.06& 1.037 &1.075 &1.067 &1.071\\
0.08&0.935&0.973&0.965  &0.969\\
0.10    &0.851  &0.889  &0.881  &0.885\\
0.12    &0.782  &0.820  &0.812  &0.816\\
0.14    &0.725  &0.764  &0.755  &0.759\\
0.16    &0.679  &0.717  &0.709  &0.713\\
0.18    &0.641  &0.679  &0.671  &0.675\\
0.20    &0.610  &0.648  &0.640  &0.643\\
\hline
\end{tabular}
\caption{Result of Running the Code Attached}
\end{table}
Exactly the same as Table 5.13 in the textbook. 

Clearly I wrote section* before \begin{table} but the output looks like this table appears before section title

any suggestion would be much appreciated!

marked as duplicate by user31729, Torbjørn T., Martin Schröder, Mico tables Feb 21 '17 at 12:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Welcome to TeX.SE. Your table environment floats away. If you don't want this, omit the table environment, replace \caption with \captionof{table} and load the caption package; or use \begin{table}[htpb]...\end{table}. We have this question about 5 times a day and the answer is always the same ;-) – user31729 Feb 21 '17 at 8:58
  • thx!!I actually couldnt find other similar question so sorry for asking redundant question.... – Jack Wen Feb 21 '17 at 9:03
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Feb 21 '17 at 9:03
  • @ChristianHupfer: So where's the duplicate? :-) – Martin Schröder Feb 21 '17 at 9:04
  • 1
    @ChristianHupfer thank you for your help! after a quick glance of the link u just posted, i was able to fix my problem by using \begin{table}[h!]. thank you again! – Jack Wen Feb 21 '17 at 9:12