2

I have two tables side by side. I want to trick readers into seeing this as one table, by widening the toprule command.

In the MWE below I want to join the toprule of the cats table to the dogs table, and the same for the bottom rule and mid rules.

Imgur

This is a sneaky way of entering table data by order of column, rather than by rows.

The MWE is

\documentclass[10pt]{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}[t]{l}\toprule
cat\\
cat\\
cat\\
cat\\
cat\\
cat\\\bottomrule
\end{tabular}
\begin{tabular}[t]{l}\toprule
dog\\
dog\\
dog\\
dog\\
dog\\
dog\\\bottomrule
\end{tabular}
\end{document}
2
  • Isn't it just the space after \end{tabular} ? Add a % right after to remove the space
    – daleif
    Commented Nov 29, 2015 at 17:14
  • yes! but the other guy got the answer first. sorry!
    – Tim
    Commented Nov 29, 2015 at 17:16

2 Answers 2

3

This is very simple to achieve ... just ad % between tables to prevent space between them:

enter image description here

\documentclass[10pt]{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}[t]{l}\toprule
cat\\
cat\\
cat\\
cat\\
cat\\
cat\\\bottomrule
\end{tabular}%
\begin{tabular}[t]{l}\toprule
dog\\
dog\\
dog\\
dog\\
dog\\
dog\\\bottomrule
\end{tabular}
\end{document}
2
  • yes perfect. I still don't understand the rules of %.......my bad.
    – Tim
    Commented Nov 29, 2015 at 17:16
  • 1
    The % make that \end{tabular} is continued without any spaces with begin{tabular} in the next editor line. The same result you obtain if you write ` ...\end{tabular}\begin{tabular} ...`.
    – Zarko
    Commented Nov 29, 2015 at 17:21
1

You can simply wrap the tabulars inside a tabular. For example:

\documentclass[10pt]{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{@{}c@{}c@{}}\toprule
  \begin{tabular}[t]{l}
    cat\\
    cat\\
    cat\\
    cat\\
    cat\\
    cat\\
  \end{tabular}
  &
  \begin{tabular}[t]{l}
    dog\\
    dog\\
    dog\\
    dog\\
    dog\\
    dog\\
  \end{tabular}\\
  \bottomrule
\end{tabular}
\end{document}

nested tables

You must log in to answer this question.

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