LaTeX table positioning

latex

I have a LaTeX document that contains a paragraph followed by 4 tables followed by a second paragraph. I want the 4 tables to appear between the two paragraphs which from what I've read means I should use the [h] option after beginning the table environment (e.g. \begin{table}[h]).

Using this the first two tables appear after paragraph 1 as expected, however paragraph 2 is then displayed with the last two tables appearing on the following page. How can I get the tables to appear in the correct location?

I've tried various things to correct the positioning such as using [h!] however this doesn't seem to have any effect. Using \clearpage after the tables does have the desired effect of making the tables appear before the second paragraph but it then leaves the last two tables on their own page with loads of white-space, when I would prefer to have the second paragraph begin immediately after the tables.

Paragraph 1...

\begin{table}[h]
    table1...
\end{table}

\begin{table}[h]
   table2...
\end{table}[h]
...

Paragraph 2...

Best Answer

After doing some more googling I came across the float package which lets you prevent LaTeX from repositioning the tables.

In the preamble:

\usepackage{float}

Then for each table you can use the H placement option (e.g. \begin{table}[H]) to make sure it doesn't get repositioned.