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!

  • 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 ;-) –  Feb 21 '17 at 08:58
  • thx!!I actually couldnt find other similar question so sorry for asking redundant question.... – Jack Wen Feb 21 '17 at 09: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 09:03
  • @ChristianHupfer: So where's the duplicate? :-) – Martin Schröder Feb 21 '17 at 09:04
  • @MartinSchröder: Here: http://tex.stackexchange.com/questions/39017/how-to-influence-the-position-of-float-environments-like-figure-and-table-in-lat –  Feb 21 '17 at 09:05
  • @ChristianHupfer: That requires people to understand the concept of floats, which the OP seems to lack. – Martin Schröder Feb 21 '17 at 09:07
  • 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 09:12
  • Four of the five highest voted questions tagged [tag:floats] and [tag:positioning] deal with problems like this one, see http://tex.stackexchange.com/questions/tagged/floats+positioning?sort=votes&pageSize=50 – Torbjørn T. Feb 21 '17 at 12:37

0 Answers0