[Tex/LaTex] \pbox vertical alignment

boxesvertical alignment

What's going on here, why are the TEXTs not aligned?

enter image description here

\documentclass{article}
\usepackage{pbox}

\begin{document}

\hrule
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Short}
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Long Text}
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Short}
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Long Text}
\hrule

\end{document}

Best Answer

g in Long has a depth where as in Short no letter has depth. This is why the misalignment comes. To correct it, you may add a \vphantom{g} to Short or \smash the Long (or only g).

\documentclass{article}
\usepackage{pbox}

\begin{document}

\hrule
\pbox[c][20pt][b]{\textwidth}{TEXT\\ \vphantom{g}Short}%
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Long Text}%
\pbox[c][20pt][b]{\textwidth}{TEXT\\ \vphantom{g}Short}%
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Long Text}%
\hrule
%
\bigskip
%
\hrule
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Short}%
\pbox[c][20pt][b]{\textwidth}{TEXT\\ \smash{Long} Text}%
\pbox[c][20pt][b]{\textwidth}{TEXT\\ Short}%
\pbox[c][20pt][b]{\textwidth}{TEXT\\ \smash{Long} Text}%
\hrule

\end{document}

enter image description here

Related Question