Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a document with three tables. These three tables currently are too long for the page, so I would like to make 2 tables appear next to each other and then make the third table appear below them. This way, all tables would fit into the same page.

This is my MWE:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[margin=2.54cm]{geometry}
\usepackage{graphicx,booktabs,tabularx}
\usepackage[table]{xcolor}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{document}

\begin{table}[htbp]

\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\footnotesize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\footnotesize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\footnotesize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\footnotesize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
60 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 &  \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
120 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 &  \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
240 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 & \\ \hline
 & 69 & 9 &  \\ \cline{ 2- 3}
480 & 69 & 9 & 16.67 \\ \cline{ 2- 3}
 & 92 & 32 &  \\ \hline
 & 159 & 99 &  \\ \cline{ 2- 3}
1000 & 173 & 113 & 109.67 \\ \cline{ 2- 3}
 & 177 & 117 &  \\ \hline
 & 391 & 331 &  \\ \cline{ 2- 3}
2000 & 383 & 323 & 311.00 \\ \cline{ 2- 3}
 & 339 & 279 &  \\ \hline
 & 561 & 501 & \\ \cline{ 2- 3}
4000 & 631 & 501 & 512.33 \\ \cline{ 2- 3}
 & 595 & 535 &  \\ \hline
\end{tabularx}


\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\footnotesize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\footnotesize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\footnotesize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\footnotesize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
60 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 &  \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
120 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 &  \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
240 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 & \\ \hline
 & 69 & 9 &  \\ \cline{ 2- 3}
480 & 69 & 9 & 16.67 \\ \cline{ 2- 3}
 & 92 & 32 &  \\ \hline
 & 159 & 99 &  \\ \cline{ 2- 3}
1000 & 173 & 113 & 109.67 \\ \cline{ 2- 3}
 & 177 & 117 &  \\ \hline
 & 391 & 331 &  \\ \cline{ 2- 3}
2000 & 383 & 323 & 311.00 \\ \cline{ 2- 3}
 & 339 & 279 &  \\ \hline
 & 561 & 501 & \\ \cline{ 2- 3}
4000 & 631 & 501 & 512.33 \\ \cline{ 2- 3}
 & 595 & 535 &  \\ \hline
\end{tabularx}

\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\footnotesize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\footnotesize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\footnotesize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\footnotesize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
60 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 &  \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
120 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 &  \\ \hline
 & 60 & 0 &  \\ \cline{ 2- 3}
240 & 60 & 0 & 0.00 \\ \cline{ 2- 3}
 & 60 & 0 & \\ \hline
 & 69 & 9 &  \\ \cline{ 2- 3}
480 & 69 & 9 & 16.67 \\ \cline{ 2- 3}
 & 92 & 32 &  \\ \hline
 & 159 & 99 &  \\ \cline{ 2- 3}
1000 & 173 & 113 & 109.67 \\ \cline{ 2- 3}
 & 177 & 117 &  \\ \hline
 & 391 & 331 &  \\ \cline{ 2- 3}
2000 & 383 & 323 & 311.00 \\ \cline{ 2- 3}
 & 339 & 279 &  \\ \hline
 & 561 & 501 & \\ \cline{ 2- 3}
4000 & 631 & 501 & 512.33 \\ \cline{ 2- 3}
 & 595 & 535 &  \\ \hline
\end{tabularx}

\label{tables_test}
\caption{three tables!}
\end{table}


\end{document}

How can I achieve this? How can I make those three tables fit inside one page?

share|improve this question
    
Tabular environments are positioned using the same rules as a letter such as X they are only vertically spaced as you have a paragraph break (blank line) between each –  David Carlisle Mar 18 at 0:41
    
Wow, what a dumb mistake! I had no idea it was this simple. Thanks ! If you turn that comment into an answer I will vote for it right now and this will be closed :D Everyone wins! –  Flame_Phoenix Mar 18 at 0:50

1 Answer 1

up vote 6 down vote accepted

Tabular environments are positioned using the same rules as a letter such as X they are only vertically spaced as you have a paragraph break (blank line) between each.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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