Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Two tables side-by-side?

1,196 views
Skip to first unread message

Peter Percival

unread,
Aug 11, 2016, 3:15:29 PM8/11/16
to
Is it possible to put two tables side-by-side on a page? I'm using

\begin{table}[h]
$$
array in here
$$
\caption{text}
\end{table}

twice, so one table is below the other and it's a bit wasteful of paper.

--
Made weak by time and fate, but strong in will
To strive, to seek, to find, and not to yield.
Ulysses, Alfred, Lord Tennyson

Peter Flynn

unread,
Aug 11, 2016, 5:32:44 PM8/11/16
to
On 08/11/2016 08:15 PM, Peter Percival wrote:
> Is it possible to put two tables side-by-side on a page? I'm using
>
> \begin{table}[h]
> $$
> array in here
> $$
> \caption{text}
> \end{table}
>
> twice, so one table is below the other and it's a bit wasteful of paper.

You can fake it by using the [H] (capital) positional identifier from
the float package. This means "REALLY HERE", by making the table
completely non-floating, although the documentation does warn you that
if you have other (really floating) tables close by, the sequence may
get disturbed. Then put the two fake tables in a two-column environment:

\documentclass{article}
\usepackage{float,lipsum,multicol}
\begin{document}
\lipsum[1]
\begin{multicols}{2}
\begin{table}[H]
\centering
\begin{tabular}{clr}
foo&bar&blort\\
bar&blort&foo\\
blort&foo&bar\\
\end{tabular}
\caption{text}
\end{table}
\columnbreak
\begin{table}[H]
\centering
\begin{tabular}{clr}
foo&bar&blort\\
bar&blort&foo\\
blort&foo&bar\\
\end{tabular}
\caption{text}
\end{table}
\end{multicols}
\lipsum[2]
\end{document}

///Peter
--
http://latex.silmaril.ie/formattinginformation/

jfh

unread,
Aug 11, 2016, 8:34:06 PM8/11/16
to
Or put the 2 tables in 2 minipage environments side by side.

Alain Ketterlin

unread,
Aug 12, 2016, 4:43:23 AM8/12/16
to
Peter Percival <peterxp...@hotmail.com> writes:

> Is it possible to put two tables side-by-side on a page? I'm using
>
> \begin{table}[h]
> $$
> array in here
> $$
> \caption{text}
> \end{table}
>
> twice, so one table is below the other and it's a bit wasteful of paper.

I guess you mean two tabulars/arrays inside one table.

\begin{table}
\begin{minipage}{0.5\linewidth}
$$ array here $$
\caption{text1}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
$$ array here $$
\caption{text2}
\end{minipage}
\end{table}

or use the subfig package

-- Alain.

Peter Percival

unread,
Aug 12, 2016, 6:00:06 AM8/12/16
to
Thank you.
>
> or use the subfig package
>
> -- Alain.
>


Peter Percival

unread,
Aug 12, 2016, 6:01:19 AM8/12/16
to
Done, shamelessly stealing Alain Ketterlin's code.

Peter Percival

unread,
Aug 12, 2016, 6:43:27 AM8/12/16
to
Thank you, I shall try this as well as the minipage solution and see
which I prefer.

Ulrich D i e z

unread,
Sep 2, 2016, 5:36:30 AM9/2/16
to
Peter Percival

> Is it possible to put two tables side-by-side on a page? I'm using
>
> \begin{table}[h]
> $$
> array in here
> $$
> \caption{text}
> \end{table}
>
> twice, so one table is below the other and it's a bit wasteful of paper.

Off the cuff I'd suggest ensuring that
- either (La)TeX is in horizontal mode (building a horizontal list for a paragraph)
via \leavevmode
- or (La)TeX is in restricted horizontal mode and builds the horizontal list for a
\hbox of width \textwidth
and then using two vertical boxes (\vbox or \vtop) for placing the arrays.

Be aware that so-called vertical boxes will not in any case be placed below
each other: "vertical" in "vertical boxes" refers to how the _content_ of these
boxes will be typeset inside/into these boxes. How the vertical boxes
themselves will be placed depends on the mode (La)TeX is in when encountering
these boxes.

Within each vertical box the width of lines in case (La)TeX enters horizontal
mode while typesetting the content of that box can be adjusted via
the dimension-parameter \hsize.
As it was ensured that TeX is in (restricted) horizontal mode, the vertical boxes
themselves will be placed into the same line.

Ulrich


\documentclass[a4paper]{article}
\begin{document}

\begin{table}
\leavevmode
\vbox{\hsize=.5\textwidth
$$Array~1$$
\caption{Caption 1}%
}%
\vbox{\hsize=.5\textwidth
$$Array~2$$
\caption{Caption 2}%
}%
\end{table}

\begin{table}
\hbox to \textwidth{%
\vbox{\hsize=.5\textwidth
$$Array~3$$
\caption{Caption 3}%
}%
\vbox{\hsize=.5\textwidth
$$Array~4$$
\caption{Caption 4}%
}%
}%
\end{table}

\end{document}
0 new messages