23

I'm posting today because I would like to reduce white space in a document I'm writing. The content is two-columns but I have floating tables that span across both columns (table*).

At some point, the text ends in the beginning of the first column of a new page. I would like to include my table on this page since it has a lot of free space below the text, but when I insert the table* right after the text, it goes to the top of the next page instead:

Do you know a way of obtaining the desired behavior?

Minimal working example :

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\twocolumn

\paragraph{}
\lipsum[1]

\begin{table*}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
Column 1 & Column 2 & Column 3 & Column 4 \\
\hline
Column 1 & Column 2 & Column 3 & Column 4 \\
\hline
\end{tabular}
\end{table*}%


\end{document}
10
  • I add that the table goes at the top of the next page if I have content after the table, but is centered on the next page if I push the content afterwards one more page with \clearpage
    – beeb
    Apr 6, 2013 at 19:11
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. BTW include your comment in your Question to make it relevant and concise. Apr 6, 2013 at 19:13
  • 2
    Have a look at Keeping tables/figures close to where they are mentioned and How to influence the position of float environments like figure and table in LaTeX?, which might answer your question. In that case, we’d probably close your question as a duplicate, just to keep things tidy.
    – doncherry
    Apr 6, 2013 at 19:18
  • 1
    Thanks for your comments, I included a MWE. None of the solutions proposed in the two links could help me because of the two-column environment. The only thing said about my situation is that I should move it earlier in the code in order for the table to appear at the top of the page. Thing is I want this table after the text. I know this is not standard tex behavior, but is there a way to force it?
    – beeb
    Apr 6, 2013 at 19:30
  • i don't know of any way to force a full-width float to "backtrack" in a two-column environment unless it is input before the page on which it is to appear at the top. move it, and insert lots of comments in the source file to say what you did, and what you want the result to be. Apr 6, 2013 at 21:25

2 Answers 2

16

there seems to be no way to put a full-width float at the top of the first page; various mechanisms are used to prevent it, and i haven't found a workaround. (this is most likely also true for the first page of a new chapter in a book or report. maybe frank mittelbach or david carlisle knows a way to do it.)

however, the question states that

At some point, the text ends in the beginning of the first column of a new page.

if it is acceptable to place the float on some page after the first, this is possible, by moving the input for the figure far enough earlier that it is read in (and then delayed) before the page is finished that will be the page preceding the one on which the figure is wanted.

the following example will do this. it's ugly, but it works; it's used in tugboat all the time. (tugboat almost never has the requirement to put such a float at the top of the first page, and if there is such a requirement, we revert to plain tex.) i've added a [t] to request that the float be positioned at the top; it's probably redundant, but it does have the desired effect with some document classes (amsart for one, but apparently not article) if the float ends up as the only thing on the page.

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\twocolumn

\paragraph{}
\lipsum[1-4]

%% this table should appear *before* the paragraph indicated below.
%% it is placed here in the input to force its position at the top of the next page.
\begin{table*}[t]
\centering
\begin{tabular}{|c|c|c|c|}
\hline
Column 1 & Column 2 & Column 3 & Column 4 \\
\hline
Column 1 & Column 2 & Column 3 & Column 4 \\
\hline
\end{tabular}
\end{table*}

\lipsum[5-6]

%% the table coded above should appear at the top of the page on which
%% this paragraph appears.
\paragraph{I want the figure above this text}
\lipsum[1]

\end{document}

EDIT:

the example below will place the figure at the bottom of the page, across both columns, at the cost of an overfull box message. (i'm trying to figure out how to get rid of that, but haven't yet succeeded.)

the approach is to launch a single-column float somewhere in the first column, above where it will start. in the single-column float is embedded a minipage that is the full page width. after the first run, determine by how much the column was shortened, and, somewhere in the second column, issue a negative \enlargethispage command that will leave the bottom part of the page blank, allowing the full-width figure to overflow into the empty area.

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\twocolumn

%% avoid overfull boxes from the lipsum test.
\sloppy

\paragraph{}
\lipsum[1]

%% this table should appear at the bottom of the page.
%% it must be placed in the input somewhere near the top of the
%% first column so that it will actually appear in the first column.
\begin{table}[b]
\begin{minipage}{\textwidth}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
Column 1 & Column 2 & Column 3 & Column 4 \\
\hline

Column 1 & Column 2 & Column 3 & Column 4 \\
\hline
\end{tabular}
\end{minipage}
\end{table}

%% the table coded above should appear at the bottom of the page on which
%% this paragraph appears.
\textbf{I want the figure at the bottom of the page}

\lipsum[1]

\lipsum[2]

%% somewhere in the second column, reduce the page (column) length
%% by the amount needed to clear the figure.
\enlargethispage{-4\baselineskip}

\lipsum[3-6]

\end{document}

yes, it's ugly. don't say you weren't warned.

additional caveat -- the vertical spacing can be fouled up by section headings that have stretch built in. that makes this an iterative process. try to avoid applying this approach until your text is final, and even then, it might be wise to try to "fix" a page break at the top of the page on which the table is to appear.

EDIT 2:

the kludge described here became a tugboat article, "placing a full-width insert at the bottom of two columns", tugboat 35:3 (2014), p.255. (like all tugboat articles in electronic form, this article has a one-year "embargo" during which it is available only to tug members; it will become available to everyone sometime in late fall, 2015.)

one important point mentioned in the article is that the stfloats package, mentioned in Put a table* at the bottom of a page? works only for pages after the first page.

10
  • Hello, thanks for your reply, that's what I did to solve my problem since there is apparently no way to put such a float at the bottom of a page.
    – beeb
    Apr 7, 2013 at 22:09
  • there's no automatic way to put a full-width float at the bottom of a page. there is a totally horrendous workaround that i will try to explain tomorrow. (it's time for supper now.) Apr 7, 2013 at 22:26
  • Thank you for the edit, that's exactly what I wanted ! I know it's not pretty but it's a workaround so I'm happy ! Thanks :)
    – beeb
    Apr 8, 2013 at 23:14
  • 1
    you could put \hspace*{-\textwidth} immediately after the minipage or put the minipage in \makebox[0pt][l]{....] to hide eh width and avoid the overfull box warning Dec 16, 2014 at 15:19
  • 1
    @Jean-SébastienGosselin -- not exactly sure what you mean by "same page" placement, but it's definitely necessary to place the input for the float well before the point where it should be positioned, to make sure that there is sufficient room remaining for the insertion in the first column. (tex is "one way".) i've added a reference/link to a tugboat article that expands on this answer. Apr 22, 2015 at 12:51
5

I found this working best for me, especially with a two-column figure/table at the bottom of the first page:

% The trick is with the following package. You **need** to use the following package.
\usepackage{nidanfloat}

% ....

% Put your figure near the first page content.
\begin{figure*}[b]
    \centering
    \def\svgwidth{\textwidth}
    \import{sections/images/}{some_figure.pdf_tex}
    \caption{Some caption.}
    \label{fig:some_label}
\end{figure*}
3
  • 1
    This is the only solution working for me! Could you elaborate on why this works?
    – Matt
    Jun 16, 2021 at 8:39
  • 1
    nidanfloat package description: "This package enables a bottom placement option for double floats in two column mode (nidan-kumi)."
    – user105100
    Jun 16, 2021 at 13:04
  • Nicely worked for me too!
    – Daniel
    Nov 9, 2021 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .