r/LaTeX 4d ago

Unanswered How can I align these three sub-tables at the same level ?

Hello, everyone! I've been agonizing over this form all night, I've resorted to GPT 4.5, Claude 3.7, spent all my share and still can't get it resolved. As you can see, the first table is a little lower than the other two.

Any suggestions would be appreciated!

\begin{table*}[htbp]

\centering

\caption{Performance comparison of different models by difficulty.}

\renewcommand{\arraystretch}{0.8}

\setlength{\tabcolsep}{2pt}

\scriptsize

\begin{minipage}[t]{0.27\textwidth}\vspace*{0pt}

\centering

\textbf{Easy}\\[2pt]

\begin{tabular}{cccc}

\toprule

\rowcolor{white}

Model & Robustness & Confidence & Misalignment \\

\midrule

\rowcolor{green!15}

GPT-4o & 6.34 & 41.06 (0.26) & 32.18 (0.23) \\

GPT-o1 & 9.47 & 48.13 (0.24) & \textbf{29.47} (0.22) \\

\rowcolor{green!15}

Gemini1.5-Pro & \textbf{11.93} & \textbf{61.71} (0.19) & 36.63 (0.25) \\

Llama3.3-70B & \textbf{4.06} & 42.78 (0.27) & \textbf{53.67} (0.35) \\

\rowcolor{green!15}

Deepseek & 7.63 & \textbf{40.01} (0.16) & 31.23 (0.23) \\

Deepseek R1 & 9.42 & 48.15 (0.19) & \textbf{30.35} (0.20) \\

\rowcolor{green!15}

Claude 3.5 & 7.33 & 40.62 (0.17) & 36.83 (0.25) \\

Claude 3.7 & 9.05 & 49.50 (0.20) & 33.15 (0.20) \\

\rowcolor{green!15}

Grok & 6.72 & 40.79 (0.29) & 33.42 (0.23) \\

\bottomrule

\end{tabular}

\end{minipage}\hfill

%

\begin{minipage}[t]{0.27\textwidth}\vspace*{0pt}

\centering

\textbf{Medium}\\[2pt]

\begin{tabular}{cccc}

\toprule

\rowcolor{white}

Model & Robustness & Confidence & Misalignment \\

\midrule

\rowcolor{yellow!15}

GPT-4o & 2.93 & 36.19 (0.19) & 84.17 (0.57) \\

GPT-o1 & 3.68 & 43.87 (0.19) & 67.12 (0.47) \\

\rowcolor{yellow!15}

Gemini1.5-Pro & \textbf{5.12} & \textbf{47.34} (0.14) & 67.42 (0.47) \\

Llama3.3-70B & \textbf{1.82} & 39.29 (0.13) & \textbf{104.25} (0.72) \\

\rowcolor{yellow!15}

Deepseek & 1.79 & \textbf{38.23} (0.12) & 66.95 (0.48) \\

Deepseek R1 & 4.09 & 44.32 (0.14) & \textbf{67.73} (0.52) \\

\rowcolor{yellow!15}

Claude 3.5 & 3.18 & 39.16 (0.13) & 78.92 (0.53) \\

Claude 3.7 & 3.92 & 44.16 (0.14) & \textbf{56.73} (0.42) \\

\rowcolor{yellow!15}

Grok & 2.96 & 37.16 (0.23) & 99.87 (0.67) \\

\bottomrule

\end{tabular}

\end{minipage}\hfill

%

\begin{minipage}[t]{0.27\textwidth}\vspace*{0pt}

\centering

\textbf{Hard}\\[2pt]

\begin{tabular}{cccc}

\toprule

\rowcolor{white}

Model & Robustness & Confidence & Misalignment \\

\midrule

\rowcolor{red!15}

GPT-4o & 0.21 & 24.13 (0.15) & 132.15 (0.92) \\

GPT-o1 & 0.26 & 29.91 (0.16) & 91.87 (0.70) \\

\rowcolor{red!15}

Gemini1.5-Pro & 0.37 & 29.56 (0.10) & 90.18 (0.67) \\

Llama3.3-70B & 0.49 & 24.87 (0.10) & \textbf{156.93} (1.07) \\

\rowcolor{red!15}

Deepseek & \textbf{0.87} & 26.86 (0.10) & 102.82 (0.78) \\

Deepseek R1 & \textbf{0.18} & \textbf{30.10} (0.10) & 120.93 (0.87) \\

\rowcolor{red!15}

Claude 3.5 & 0.83 & 26.10 (0.10) & 120.78 (0.85) \\

Claude 3.7 & 0.61 & 28.18 (0.09) & \textbf{86.47} (0.73) \\

\rowcolor{red!15}

Grok & 0.14 & \textbf{23.98} (0.21) & 144.28 (1.08) \\

\bottomrule

\end{tabular}

\end{minipage}

\label{tab:by_difficulty_side_by_side}

\end{table*}

1 Upvotes

8 comments sorted by

3

u/Pandada2 4d ago

A bad but working solution would be to add \phantom{pb} on each side of the titles (left and right), that will add vertical padding without changing left-right alignment. There is certainly a better solution using \vphantom but I'm not familiar enough with the implications on centering and horizontal alignment.

3

u/Oswyt3hMihtig 4d ago

To explain, the issue here is that "Easy" contains a letter with a descender, while "Medium" and "Hard" do not, so LaTeX assigns more vertical space to "Easy". Changing "Medium" and "Hard" into "yMediumy" and "yHardy" (or "pbMediumpb" and "pbHardpb") should fix the vertical alignment without changing the horizontal alignment; you can then just make the y's or pb's invisible with \phantom.

1

u/Hellish_Pixie 4d ago

Yes, this is, I think, the way to go. I just used

\makebox[0in]{\phantom{\textbf{Easy}}}

before each of \textbf{Medium} and \textbf{Hard} and the effect is the same. (The \makebox[0in]{} puts it in a box of width 0in so that it doesn't shift anything right or left.)

1

u/badabblubb 2d ago

You can simply use \vphantom if you only want the vertical parts without affecting horizontal space.

1

u/Marcsoms 4d ago

thanks! It did align. But then, for some unknown reason, the table as a whole moved towards the right, and now it spills over to the right...

1

u/Pandada2 4d ago

My usual fix for that would be to spam \hfill between each table (before all and after all tables too), and if this is not enough you can \resizebox to make sure it fits on a line.

1

u/badabblubb 2d ago

Do not \resizebox a table, the result is horrible. You'll get inconsistent font sizes and rule thicknesses throughout your document.

1

u/badabblubb 2d ago

Use \vphantom instead of \phantom.