Context
I want to put 4 tabular
s horinzontally aligned with each other, and I'm currently using a janky setup of an adjustbox
(for each tabular
) inside a minipage
(for each tabular
) all inside one figure environment.
Problem
It works fine with just three tables, but when I add the fourth table (titled Iteration), it gets enlarged with a short header (like "Iteration" or "I") and shrunk with a big header (like "ThisIsRandomText").
MWE
What I have now
Code
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{booktabs, tabularx, array, makecell}
\usepackage{adjustbox}
\usepackage{float}
\begin{document}
\begin{itemize}
\item This is item 1. \\
\begin{figure}[H]
\centering
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c @{}}
\toprule
Iteration \\
\midrule
1 \\
2 \\
3 \\
4 \\
5 \\
6 \\
7 \\
8 \\
9 \\
10 \\
11 \\
12 \\
13 \\
14 \\
15 \\
16 \\
17 \\
18 \\
19 \\
20 \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c c c @{}}
\toprule
\multicolumn{3}{c}{Changing $A$} \\
\cmidrule{1-3}
$x$ & $f(x)$ with changed constant & $f(x)$ result \\
\midrule
$15$ & $\displaystyle\frac{6120.90}{15+60.6}-30.96$ & $\num{50.0042857143}$ \\
$15$ & $\displaystyle\frac{6120.91}{15+60.6}-30.96$ & $\num{50.0044179894}$ \\
$15$ & $\displaystyle\frac{6120.92}{15+60.6}-30.96$ & $\num{50.0045502646}$ \\
$15$ & $\displaystyle\frac{6120.93}{15+60.6}-30.96$ & $\num{50.0046825397}$ \\
$15$ & $\displaystyle\frac{6120.94}{15+60.6}-30.96$ & $\num{50.0048148148}$ \\
$15$ & $\displaystyle\frac{6120.95}{15+60.6}-30.96$ & $\num{50.0049470899}$ \\
$15$ & $\displaystyle\frac{6120.96}{15+60.6}-30.96$ & $\num{50.0050793651}$ \\
$15$ & $\displaystyle\frac{6120.97}{15+60.6}-30.96$ & $\num{50.0052116402}$ \\
$15$ & $\displaystyle\frac{6120.98}{15+60.6}-30.96$ & $\num{50.0053439153}$ \\
$15$ & $\displaystyle\frac{6120.99}{15+60.6}-30.96$ & $\num{50.0054761905}$ \\
$15$ & $\displaystyle\frac{6121.00}{15+60.6}-30.96$ & $\num{50.0056084656}$ \\
$15$ & $\displaystyle\frac{6121.01}{15+60.6}-30.96$ & $\num{50.0057407407}$ \\
$15$ & $\displaystyle\frac{6121.02}{15+60.6}-30.96$ & $\num{50.0058730159}$ \\
$15$ & $\displaystyle\frac{6121.03}{15+60.6}-30.96$ & $\num{50.0060052910}$ \\
$15$ & $\displaystyle\frac{6121.04}{15+60.6}-30.96$ & $\num{50.0061375661}$ \\
$15$ & $\displaystyle\frac{6121.05}{15+60.6}-30.96$ & $\num{50.0062698413}$ \\
$15$ & $\displaystyle\frac{6121.06}{15+60.6}-30.96$ & $\num{50.0064021164}$ \\
$15$ & $\displaystyle\frac{6121.07}{15+60.6}-30.96$ & $\num{50.0065343915}$ \\
$15$ & $\displaystyle\frac{6121.08}{15+60.6}-30.96$ & $\num{50.0066666667}$ \\
$15$ & $\displaystyle\frac{6121.09}{15+60.6}-30.96$ & $\num{50.0067989418}$ \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c c c @{}}
\toprule
\multicolumn{3}{c}{Changing $B$} \\
\cmidrule{1-3}
$x$ & $f(x)$ with changed constant & $f(x)$ result \\
\midrule
$15$ & $\displaystyle\frac{6121}{15+60.50}-30.96$ & $\num{50.1128476821}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.51}-30.96$ & $\num{50.1021109787}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.52}-30.96$ & $\num{50.0913771186}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.53}-30.96$ & $\num{50.0806461009}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.54}-30.96$ & $\num{50.0699179243}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.55}-30.96$ & $\num{50.0591925877}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.56}-30.96$ & $\num{50.0484700900}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.57}-30.96$ & $\num{50.0377504301}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.58}-30.96$ & $\num{50.0270336068}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.59}-30.96$ & $\num{50.0163196190}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.60}-30.96$ & $\num{50.0056084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.61}-30.96$ & $\num{49.9949001455}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.62}-30.96$ & $\num{49.9841946575}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.63}-30.96$ & $\num{49.9734920005}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.64}-30.96$ & $\num{49.9627921735}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.65}-30.96$ & $\num{49.9520951751}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.66}-30.96$ & $\num{49.9414010045}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.67}-30.96$ & $\num{49.9307096604}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.68}-30.96$ & $\num{49.9200211416}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.69}-30.96$ & $\num{49.9093354472}$ \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c c c @{}}
\toprule
\multicolumn{3}{c}{Changing $C$} \\
\cmidrule{1-3}
$x$ & $f(x)$ with changed constant & $f(x)$ result \\
\midrule
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.06$ & $\num{49.9056084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.05$ & $\num{49.9156084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.04$ & $\num{49.9256084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.03$ & $\num{49.9356084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.02$ & $\num{49.9456084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.01$ & $\num{49.9556084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.00$ & $\num{49.9656084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.99$ & $\num{49.9756084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.98$ & $\num{49.9856084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.97$ & $\num{49.9956084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.96$ & $\num{50.0056084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.95$ & $\num{50.0156084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.94$ & $\num{50.0256084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.93$ & $\num{50.0356084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.92$ & $\num{50.0456084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.91$ & $\num{50.0556084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.90$ & $\num{50.0656084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.89$ & $\num{50.0756084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.88$ & $\num{50.0856084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.87$ & $\num{50.0956084656}$ \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\end{figure}
\end{itemize}
\end{document}
Image
What I used to have
Code
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{booktabs, tabularx, array, makecell}
\usepackage{adjustbox}
\usepackage{float}
\begin{document}
\begin{itemize}
\item This is item 1. \\
\begin{figure}[H]
\centering
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c c c @{}}
\toprule
\multicolumn{3}{c}{Changing $A$} \\
\cmidrule{1-3}
$x$ & $f(x)$ with changed constant & $f(x)$ result \\
\midrule
$15$ & $\displaystyle\frac{6120.90}{15+60.6}-30.96$ & $\num{50.0042857143}$ \\
$15$ & $\displaystyle\frac{6120.91}{15+60.6}-30.96$ & $\num{50.0044179894}$ \\
$15$ & $\displaystyle\frac{6120.92}{15+60.6}-30.96$ & $\num{50.0045502646}$ \\
$15$ & $\displaystyle\frac{6120.93}{15+60.6}-30.96$ & $\num{50.0046825397}$ \\
$15$ & $\displaystyle\frac{6120.94}{15+60.6}-30.96$ & $\num{50.0048148148}$ \\
$15$ & $\displaystyle\frac{6120.95}{15+60.6}-30.96$ & $\num{50.0049470899}$ \\
$15$ & $\displaystyle\frac{6120.96}{15+60.6}-30.96$ & $\num{50.0050793651}$ \\
$15$ & $\displaystyle\frac{6120.97}{15+60.6}-30.96$ & $\num{50.0052116402}$ \\
$15$ & $\displaystyle\frac{6120.98}{15+60.6}-30.96$ & $\num{50.0053439153}$ \\
$15$ & $\displaystyle\frac{6120.99}{15+60.6}-30.96$ & $\num{50.0054761905}$ \\
$15$ & $\displaystyle\frac{6121.00}{15+60.6}-30.96$ & $\num{50.0056084656}$ \\
$15$ & $\displaystyle\frac{6121.01}{15+60.6}-30.96$ & $\num{50.0057407407}$ \\
$15$ & $\displaystyle\frac{6121.02}{15+60.6}-30.96$ & $\num{50.0058730159}$ \\
$15$ & $\displaystyle\frac{6121.03}{15+60.6}-30.96$ & $\num{50.0060052910}$ \\
$15$ & $\displaystyle\frac{6121.04}{15+60.6}-30.96$ & $\num{50.0061375661}$ \\
$15$ & $\displaystyle\frac{6121.05}{15+60.6}-30.96$ & $\num{50.0062698413}$ \\
$15$ & $\displaystyle\frac{6121.06}{15+60.6}-30.96$ & $\num{50.0064021164}$ \\
$15$ & $\displaystyle\frac{6121.07}{15+60.6}-30.96$ & $\num{50.0065343915}$ \\
$15$ & $\displaystyle\frac{6121.08}{15+60.6}-30.96$ & $\num{50.0066666667}$ \\
$15$ & $\displaystyle\frac{6121.09}{15+60.6}-30.96$ & $\num{50.0067989418}$ \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c c c @{}}
\toprule
\multicolumn{3}{c}{Changing $B$} \\
\cmidrule{1-3}
$x$ & $f(x)$ with changed constant & $f(x)$ result \\
\midrule
$15$ & $\displaystyle\frac{6121}{15+60.50}-30.96$ & $\num{50.1128476821}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.51}-30.96$ & $\num{50.1021109787}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.52}-30.96$ & $\num{50.0913771186}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.53}-30.96$ & $\num{50.0806461009}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.54}-30.96$ & $\num{50.0699179243}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.55}-30.96$ & $\num{50.0591925877}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.56}-30.96$ & $\num{50.0484700900}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.57}-30.96$ & $\num{50.0377504301}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.58}-30.96$ & $\num{50.0270336068}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.59}-30.96$ & $\num{50.0163196190}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.60}-30.96$ & $\num{50.0056084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.61}-30.96$ & $\num{49.9949001455}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.62}-30.96$ & $\num{49.9841946575}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.63}-30.96$ & $\num{49.9734920005}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.64}-30.96$ & $\num{49.9627921735}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.65}-30.96$ & $\num{49.9520951751}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.66}-30.96$ & $\num{49.9414010045}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.67}-30.96$ & $\num{49.9307096604}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.68}-30.96$ & $\num{49.9200211416}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.69}-30.96$ & $\num{49.9093354472}$ \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\begin{minipage}{0.25\textwidth}
\begin{adjustbox}{width=\textwidth}
\begingroup
\setcellgapes{5pt}
\makegapedcells
\begin{tabular}{@{} c c c @{}}
\toprule
\multicolumn{3}{c}{Changing $C$} \\
\cmidrule{1-3}
$x$ & $f(x)$ with changed constant & $f(x)$ result \\
\midrule
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.06$ & $\num{49.9056084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.05$ & $\num{49.9156084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.04$ & $\num{49.9256084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.03$ & $\num{49.9356084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.02$ & $\num{49.9456084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.01$ & $\num{49.9556084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-31.00$ & $\num{49.9656084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.99$ & $\num{49.9756084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.98$ & $\num{49.9856084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.97$ & $\num{49.9956084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.96$ & $\num{50.0056084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.95$ & $\num{50.0156084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.94$ & $\num{50.0256084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.93$ & $\num{50.0356084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.92$ & $\num{50.0456084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.91$ & $\num{50.0556084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.90$ & $\num{50.0656084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.89$ & $\num{50.0756084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.88$ & $\num{50.0856084656}$ \\
$15$ & $\displaystyle\frac{6121}{15+60.6}-30.87$ & $\num{50.0956084656}$ \\
\bottomrule
\end{tabular}
\endgroup
\end{adjustbox}
\end{minipage}
\end{figure}
\end{itemize}
\end{document}
Image
P.S.
I'd prefer not to have these as 1 table or change the layout from a single horizontal line. I just want to know how I can align that 4th "Iterations" table with the rest of them in the same horizontal space.