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...
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}
\restylefloat{table}
Then for each table you can use the H
placement option (e.g. \begin{table}[H]
) to make sure it doesn't get repositioned.
In case someone is using org-mode, put this on top:
#+LATEX_HEADER: \usepackage{float} #+LATEX_HEADER: \restylefloat{table}
And then,#+CAPTION: A table #+NAME: tab:table-label #+ATTR_LATEX: :placement [H] :center t <<actual table content>>
Excuse the poor newline formatting in comments.Sorry, but the claim that it's necessary to run
\restylefloat{table}
in order to use the[H]
positioning specifier is false. One should only ever run\restylefloat{table}
if one has first run the package instructions\floatstyle
,\floatplacement
, or\floatname
. Please update your answer to remove the reference to\restylefloat
. In case you need more proof that running\restylefloat
routinely is not a good idea, do see the posting Caption and label of a table, of two tables kept side by side, is assigned to another table.