[Tex/LaTex] put all 4 tables on the same row line

tables

I am trying to use 'minipage' to put all 4 tables on the same row line. But, it does not work. I only can put small tables on the same row line. How can I solve it.

Best Answer

The following may do what you're looking to achieve. Note the use of \hfill in the three gaps between the tables; it ensures that the four tables take up the full width of the text block.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage[hmargin=2.5cm]{geometry}  % choose page margins here
\usepackage{booktabs} % for \toprule, \midrule, and \bottomrule macros

\newcommand\maketabular{%  %% macro for a repeated element
\begin{tabular}{lrrr}
\toprule
A & B & C & D \\
\midrule
15 & 20 & 30 & 40 \\
30 & 40 & 60 & 80 \\
\bottomrule
\end{tabular}} % end of \maketabular macro

\begin{document}
\begin{table}[h!]  % "[h!]" placement directive just for this example
\caption{Four side-by-side tables}
% increase the vertical separation between caption and tabular material
\medskip 

\maketabular
\hfill % for maximal horizonal separation between the tabular environments
\maketabular
\hfill
\maketabular
\hfill
\maketabular
\end{table}
\end{document}
Related Question