[Tex/LaTex] How to specify a fixed height for all rows in a table

spacingtables

I have something like this:

\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{tabular}{| c | C{3cm} | C{4cm} |}
Short Text & Short Text & Short Text \\ \hline
Short Text & Short Text & Loooooooooooooooooooooong Text \\ \hline 
\end{tabular}

which would make the second row have a wider height. Then how do I specify a fixed height for all rows in my table?

Best Answer

I don't know what are the specifications you want but if you want to have the same height in each rows :

1)

\documentclass[a4paper]{article}
\usepackage{array}  

\begin{document} 

\newcolumntype{C}[1]{%
 >{\vbox to 5ex\bgroup\vfill\centering}%
 p{#1}%
 <{\egroup}}  

\begin{tabular}{|c | C{3cm} | C{5cm} |} 
 \hline 
 Short Text & Short Text & Short Text \tabularnewline \hline
Short Text  & Short Text & Loooooooooo  oooooooooooong Text \tabularnewline \hline  
Short Text  & Short Text & Loooooooooooooooooooooong Text \tabularnewline \hline 
\end{tabular}    
\end{document}

enter image description here

Interesting links about tables : firstly, a document can be found here TableTricks.pdf, interesting also is the wiki page Tables on wiki

2) A new approach perhaps more easy to modify is :

\documentclass[a4paper]{article}
\usepackage{array}  

\begin{document} 
\def\mystrut(#1,#2){\vrule height #1 depth #2 width 0pt}

\newcolumntype{C}[1]{%
   >{\mystrut(3ex,2ex)\centering}%
   p{#1}%
   <{}}  

\begin{tabular}{|c | C{3cm} | C{4cm} |} 
\hline 
Short Text & Short Text & Short Text \tabularnewline \hline
Short Text  & Short Text & Loooooooooooooooooong Text \tabularnewline \hline  
\end{tabular}    
\end{document}

In this solution it's more easy to place the text. You need only to modify heightand depth for the strut.

Related Question