[Tex/LaTex] How to force multiple tables onto a single page

tables

I am doing the final layouting pass on a book, and while LaTeX does "the right thing" most of the time, and the occassional ugliness can be tweaked with minor touches to the text, there are cases where I feel there is no alternative to forcing LaTeX's hand.

The case I am looking at right now are three tables, which need to be close together due to context, and basically would fill a complete page on their own.

However, LaTeX basically insists that three tables on one page look bad, and spreads them over multiple pages.

How could I force those tables to be on the same page?

Stating \begin{table}[h] doesn't work. (LaTeX apparently simply ignores the setting.)

Putting the tables into individual cells of a page-sized table ("the HTML way") doesn't work, because I cannot put captions and labels to them properly that way.

Attached is a much dumbed-down version of the problem as a kind of MWE. I used scrbook as documentclass because that's what the original document is in, and changing that (or the twocolumn layout) is not an option.

\documentclass[paper=a4,fontsize=10pt,twocolumn]{scrbook}

\usepackage{lipsum}
\usepackage{tabularx}

\begin{document}

\lipsum[1]

\begin{table}
\caption{Tab 1}
\begin{tabularx}{\columnwidth}{|X|}
\hline
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\hline
\end{tabularx}
\end{table}

\lipsum[2]

\begin{table}
\caption{Tab 2}
\begin{tabularx}{\columnwidth}{|X|}
\hline
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\hline
\end{tabularx}
\end{table}

\lipsum[3]

\begin{table}
\caption{Tab 3}
\begin{tabularx}{\columnwidth}{|X|}
\hline
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\hline
\end{tabularx}
\end{table}

\end{document}

Best Answer

If you really want to have the tables together on one page, cheat a bit. Put all the material in a single table-environemt. That means you need to put the stuff between the tables either in front or after them. Here as a quick example.

\documentclass[twocolumn,paper=a4,fontsize=11pt,captions=tableabove]{scrbook}

\usepackage{showframe}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{tabularx}
\colorlet{tablegray}{gray!50!white}
\newcommand{\faketable}[1]{{\color{tablegray}\rule{\linewidth}{.#1\textheight}}}
\begin{document}

\lipsum[1-2]

Now we are using a twocolumn, floating environment and put all
tables and all captions inside. This is hardwired, LaTeX will
float the *whole container* around. This might need some
readjustments.

\begin{table*}
    \begin{minipage}{0.45\textwidth}
        \caption{I am das duck}
        \faketable{3}
        \bigbreak
        \caption{I am the penguin}
        \faketable{5}
    \end{minipage}
    \hfill
    \begin{minipage}{.45\linewidth}
        \caption{I bin das Walross}
        \faketable{8}
    \end{minipage}
\end{table*}

\lipsum[2]
\lipsum[3]
\end{document}

Here is what pdflatex will give you:

Page 1 Page 2