# Add a fourth 2-column table on a page

I have the following three 2-column tables on a page, and now I need to change it to a four 2-column table on a page. I tried playing around to add the 4th table with no luck. Is there a way I can add the fourth 2-column table next to the third one?

\begin{table}[!htbp]
\centering
{\footnotesize
\begin{tabular}{
|c|c|c@{\hskip 1cm}
|c|c|c@{\hskip 1cm}
|c|c|c@{\hskip 1cm}
}
\cline{1-2}\cline{4-5}\cline{7-8}
$n$ & $w_n +\mathcal{O}(5^2)$ && $n$ & $w_n +\mathcal{O}(5^2)$ && $n$ & $w_n +\mathcal{O}(5^2)$ \\
\end{tabular}}


Simple four tabulars can be much easier than building this in a bigger tabular. Tabulars can be horizontally stacked like minipages by specifying the [t] key to be aligned at their top most rows.

\documentclass{article}
\usepackage{array}
\setlength\extrarowheight{2pt}
\begin{document}

\begin{table}[!htbp]
\centering
\begin{tabular}[t]{|c|c|}
\hline
$n$ & $w_n +\mathcal{O}(5^2)$ \\
\hline
$1$ & $w_1 +\mathcal{O}(5^2)$ \\
\hline
$2$ & $w_2 +\mathcal{O}(5^2)$ \\
\hline
\end{tabular}
\hfill % Second tabular
\begin{tabular}[t]{|c|c|}
\hline
$n$ & $w_n +\mathcal{O}(5^2)$ \\
\hline
\end{tabular}
\hfill% Third tabular
\begin{tabular}[t]{|c|c|}
\hline
$n$ & $w_n +\mathcal{O}(5^2)$ \\
\hline
\end{tabular}
\hfill% Fourth tabular
\begin{tabular}[t]{|c|c|}
\hline
$n$ & $w_n +\mathcal{O}(5^2)$ \\
\hline
\end{tabular}
\end{table}

\end{document}


• Glad my answer could help! – AboAmmar Sep 3 '16 at 9:19

Not really sure what you are using this for, as it seems a bit odd. I have here created a command which creates a table, if this is something you will be doing a lot.

### Code

% add a fourth 2-column table in a page - TeX - LaTeX Stack Exchange
% Date: fredag 2. september 2016 13.55.41

\documentclass{article}

\newcommand{\mathTable}[2]{%
\begin{tabular}{|c|c|}
\hline
$$#1$$ & $$#2$$\\
\hline
\end{tabular}
}
\begin{document}

\begin{table}[hbt]
\centering
\mathTable{n}{w_n + \mathcal{O}(5^2)}
\mathTable{n}{w_n + \mathcal{O}(5^2)}
\mathTable{n}{w_n + \mathcal{O}(5^2)}
\mathTable{n}{w_n + \mathcal{O}(5^2)}
\end{table}

\end{document}


Since the contents of the tables are in math mode, I suggest you use an array environment instead of a tabular environment. This will save you from having to type lots and lots of $ characters. I'd also get rid of the @{\hskip 1cm} spacing directives. \documentclass{article} \usepackage{array} % for "\extrarowheight" macro \setlength\extrarowheight{2pt} \begin{document} \begin{table}[!htbp] \centering$\begin{array}{*{11}{|c}|}
\cline{1-2}\cline{4-5} \cline{7-8}\cline{10-11}
n & w_n +\mathcal{O}(5^2) && n & w_n +\mathcal{O}(5^2) &&
n & w_n +\mathcal{O}(5^2) && n & w_n +\mathcal{O}(5^2) \\
\cline{1-2}\cline{4-5} \cline{7-8}\cline{10-11}
\end{array}\$
\end{table}
\end{document}