20

Possible Duplicate:
How to fix table position

I'm defining a table in my document like so...

\begin{table}
 \caption{my table}
 \centering

  \begin{tabular}{c llll c c c c}
  \hline         
   Stuff & \multicolumn {1}{ c }{  } & more Stuff
  \end{tabular}
  \label{table:nonlin} 
\end{table}

The table itself is pretty big, takes up almost the entire page. I'm creating it between two blocks of text however when compiled into a pdf it appears to just "float" to the bottom of the document. Why is this happening? How do I correct it?

Skizit
  • 331

1 Answers1

24

The environment table is supposed to float so it's working as intended. Actually it's often a good practice to let LaTeX place the floats.

To control the placement of the table you can provide the environment with options. For example you can use the option htbp as in

\begin{table}[htbp]
...
\end{table}

See http://en.wikibooks.org/wiki/LaTeX/Tables#The_table_environment_-_captioning_etc for details.

N.N.
  • 36,163
  • 9
    [htp] or [htbp], not [h] only. – egreg Nov 05 '11 at 13:54
  • @egreg Oops! Fixed. – N.N. Nov 05 '11 at 13:59
  • Actually LaTeX always adds tp (but not b); adding the options avoids the warning. – egreg Nov 05 '11 at 14:01
  • 1
    Adding ! in front of the h (ie [!htp]) can try and overule LaTeX as to where the best placement for the table is. – drezha Nov 05 '11 at 15:39
  • 1
    @drezha: The float package provides the H specifier for overriding float placement to Here. – Werner Nov 05 '11 at 15:50
  • As @egreg said, [htp] works perfectly if your tables must be at the beginning of a page (esp. of a journal paper). – Kadir May 31 '13 at 07:10
  • 2
    Define 'often a good practice', please. Why? To be honest, I often get the idea latex tries to avoid overfulls, underfulls and overflows, but does not consider that specific placement might appear better of be clearer. In particular when LaTeX throws a float all the way to the bottom of a document on separate page, which is ugly and confusing when the table was referenced to 5 pages ago. – Herbert Nov 27 '18 at 13:35
  • For example: https://pastebin.com/ZbtHCv41 – Herbert Nov 27 '18 at 13:46