tags:

views:

869

answers:

5

Hi,

I have a LaTeX document that contains some text, followed by 4 tables, followed by some further text. I want the 4 tables to appear between the two pieces of text, 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 there own page with loads of whitespace, 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...
A: 

I ran into this issue repeatedly with LaTeX. Try this.

bcash
I tried playing with the setting specified on that page but none of them seemed to have any effect.
Jared Russell
After changing some of these parameters, did you change your table placements from \begin{table}[h] to either \begin{table}[htp] or \begin{table}[htpb]?
bcash
+2  A: 

After doing some more googling I came across the float package, which lets you force LaTeX not to reposition 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.

Jared Russell
A: 

You may want to add this to your preamble, and adjust the values as necessary:

 %------------begin Float Adjustment
%two column float page must be 90% full
\renewcommand\dblfloatpagefraction{.90}
%two column top float can cover up to 80% of page
\renewcommand\dbltopfraction{.80}
%float page must be 90% full
\renewcommand\floatpagefraction{.90}
%top float can cover up to 80% of page
\renewcommand\topfraction{.80}
%bottom float can cover up to 80% of page
\renewcommand\bottomfraction{.80}
%at least 10% of a normal page must contain text
\renewcommand\textfraction{.1}
%separation between floats and text
\setlength\dbltextfloatsep{9pt plus 5pt minus 3pt }
%separation between two column floats and text
\setlength\textfloatsep{4pt plus 2pt minus 1.5pt}

Particularly, the \floatpagefraction may be of interest.

Mica
A: 

If you want to have two tables next to each other you can use: (with float package loaded)

\begin{table}[H]
 \begin{minipage}{.5\textwidth}
  %first table
 \end{minipage}
 \begin{minipage}{.5\textwidth}
  %second table
 \end{minipage}
\end{table}

Each one will have own caption and number. Another option is subfigure package.

Crowley
+2  A: 

What happens if the text plus tables plus text doesn't fit onto a single page? By trying to force the typesetting in this way, you are very likely to end up with pages that run too short; i.e., because a table cannot by default break over a page it will be pushed to the next, and leave a gap on the page before. You'll notice that you never see this in a published book.

The floating behaviour is a Good Thing! I recommend using [htbp] as the default setting for all tables and figures until your document is complete; only then should think about fine-tuning their precise placement.

P.S. Read the FAQ; most other answers here are partial combinations of advice given there.

Will Robertson