I would rather do it slightly different using a \vphantom
, it requires a little more manual work, but is easier to understand.
The reason why you get different size columns is the column specifier m
and what it does. This particular specifier is actually a parbox
. Obviously, since your text is longer than the width of the parbox
it will overflow or get wrapped to the following line. As TeX's hyphenation patterns do not have a pattern for ooooooooooooo
it just overflows out of the table, but this is another story.
In order to have all the cells the same hight, I would use a strut
or TeX's equivalent a \vphantom
in this case. A phantom command will create an invisible box with width zero but the height of the enclosing text. We do this with the command:
\def\Z{\vphantom{\parbox[c]{1cm}{\Huge Something Long}}}
This strut like in manual typesetting will make all the rows equal. The final code is as follows:
\documentclass[11pt]{article}
\usepackage{array}
\begin{document}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\def\Z{\vphantom{\parbox[c]{1cm}{\Huge Something Long}}}
\bigskip
\begin{tabular}{| c | C{3cm} | C{4cm} |}
\hline
\Z Short Text & Short Text & Short Text \\ \hline
\Z Short Text & Short Text & Loooooooooooooooothetheme Text \\ \hline
\end{tabular}
\end{document}
If you have long repetitive tables of the same type, it might make it worthline to define a command addRow
that can automate the addition of the strut.
By changing the parameter in the vphantom
parbox
to any of t,b,c
, you can also get alignments at bottom, center or top.
As a sideline I changed Looo...
to a word having an ending with a known hyphenation pattern and this time the overflow of text in the right margin also disappeared.