5

How do I tell my table* to be on top of the same pages as the paragraph I want?

I know of the question https://stackoverflow.com/q/1673942/659634. Which does not answer how to work with double column tables. I have a table that I want to put at the top of a page closest to paragraph 2. I create my tables as follows. Table 0 is the only one that compiles. Tables 1 and Table 2 don't compile correctly.

I want Table 0 to be on top of the page of paragraph 2. But when it compiles it is 1 page below it. Paragraph 2 could be either at the beginning of the page or only one sentence the end of the page. I still want the table to appear at start of the page which Paragraph 2 is started on.

\usepackage{float}
\restylefloat{table}

Paragraph 1...
\begin{table*}
    table0...
\end{table*}

\begin{table*}[H]
    table1...
\end{table*}

\begin{table*}[H]
   table2...
\end{table*}[H]
...

Paragraph 2...
Paragraph 3...

One caveat: I have multiple sections. Each section is in a different file.

Whitecat
  • 1,321
  • 1
    You probably need this question which includes the Mother (Father) of All Float-Positioning Answers. Basically, put the float on the page prior to the one you want it to appear on. – cfr Aug 28 '15 at 19:32
  • 3
    double column floats always go at the earliest onto the following page. – David Carlisle Aug 28 '15 at 19:37
  • What do you mean the float? Is that the '\restylefloat{table}' or the table 0? Is there any way I could do it while leaving the table in the same position? – Whitecat Aug 28 '15 at 19:37
  • 2
    There is no [H] option for two column floats. – David Carlisle Aug 28 '15 at 19:37
  • 1
    No you need to move the begin{table*} earlier in the file. – David Carlisle Aug 28 '15 at 19:38
  • I have all chapters in their own separate files. And would then mean that the table is put into the end of a different chapter. – Whitecat Aug 28 '15 at 19:42
  • If the page starts a chapter, the table cannot go at the top of that page anyway. And it would look very odd to have it before your chapter title. – cfr Aug 28 '15 at 21:33
  • 1
    @Whitecat no, floats will not float past a chapter heading (which in most classes uses \clearpage to force out all floats and start a new page) – David Carlisle Aug 28 '15 at 21:36
  • Sorry for being unclear I am not using chapters I am using sections. – Whitecat Aug 28 '15 at 22:22
  • In that case, you can get this to work but you have to insert the float on the previous page. If that happens to be in a file for the previous section, I think that's where you have to put it. I'm not sure why you are using H - even if it applied here, it would not put the table at the top of the page but here on the page (wherever here happens to be). – cfr Aug 28 '15 at 23:40

1 Answers1

2

There is no [H] for double column floats. Just use

\begin{table*}

It is a restriction of the current implementation of double floats that they can always go, at the earliest, on the page after the page on which their location in the source file has been set. (Essentially because once TeX has started setting that column it is too late to leave space for a spanning table on the current page and change the required text column heights.) So if the float appears too late, simply move it earlier in the source file.

egreg
  • 1,121,712
David Carlisle
  • 757,742