8

I'd like to group two tables, one below the other, so they don't show separated ie. one in each page. What's the best way to achieve that? I've read about positioning them side by side, but not this.

Probably, I could create a custom float with \usepackage{float}, but I bet there is a simpler way (other than playing around with [htpb]).

  • 1
    Welcome to TeX.SX! Any number of tables, with their captions, can go in the same table environment (so long as they fit in a page). – egreg May 23 '14 at 17:34
  • But then they will show up in the Index of tables as the same table. I want them to be separate tables, yet be grouped. – Arnaugir May 23 '14 at 17:34
  • It's the caption that produces the entry in the list of tables. Two captions, two entries. – egreg May 23 '14 at 17:35
  • Thank you. I was making a really wrong assumption there. – Arnaugir May 23 '14 at 17:37
  • 3
    @Arnaugir Every caption should have its own label. – egreg May 23 '14 at 17:45
14

Any number of tables can go in a single table environment, along with their captions, so long as they fit in a page.

The entries in the list of tables are generated by the \caption command, so there will be two entries even if two tables are in the same table environment.

However, there will be a problem when the caption package is loaded together with hyperref, because the link in the list of tables or the ones made by \ref might bring to the first of the two tables. The hypcap package fixes it.

Here's an example.

\documentclass{article}
\usepackage{kantlipsum} % just to produce nonsense text

\usepackage{caption} % for better vertical separation
\usepackage{hyperref}
\usepackage{hypcap} % fix the links

\begin{document}
\title{A title}
\author{A. Uthor}

\maketitle

\listoftables

\section{A section}

A reference to the first table~\ref{tab:first} and one to the
second table~\ref{tab:second}, followed by nonsense text.

\kant

\begin{table}[htp]

\centering
\caption{First table}\label{tab:first}

\begin{tabular}{ll}
\hline
ab & cd \\
ab & cd \\
ab & cd \\
\hline
\end{tabular}

\bigskip

\caption{Second table}\label{tab:second}

\begin{tabular}{ll}
\hline
ab & cd \\
ab & cd \\
ab & cd \\
\hline
\end{tabular}

\end{table}

\kant

\end{document}
1

I think you have a couple of options here:

Make the tables smaller by simply using \small or \footnotesize in your table. E.g.:

\begin{table}\footnotesize
\caption{Table caption A}\label{tab:A}
\begin{tabular}{ll}
One & two\\
\end{tabular
\end{table}

Other option is setting one to be on top of the page and another one on the bottom:

\begin{table}[t!]
\caption{Table caption A}\label{tab:A}
\begin{tabular}{ll}
One & two\\
\end{tabular
\end{table}


\begin{table}[b!]
\caption{Table caption B}\label{tab:B}
\begin{tabular}{ll}
One & two\\
\end{tabular
\end{table}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.