[Tex/LaTex] Vertical align center and horizontal align left in tabular

tables

I found this small piece of code on here, which creates a new column type. However, when I apply it to my tabular, only the left column is vertically aligned. The right has not been affected at all.

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash} m{#1} }

Below, I setup my table and I use this new column type L. However, as you can probably see, only the first column is affected.

\begin{center}
    \noindent\begin{tabular}{ | L{\dimexpr 0.4\linewidth-2\tabcolsep} | L{\dimexpr 0.4\linewidth-2\tabcolsep} | }  
    \hline

    \multicolumn{1}{|c|}{\textbf{Header}} & \multicolumn{1}{c|}{\textbf{Header}} \\[2ex] \hline

    TEXT
    &
    MORE TEXT \\[3ex]
    \hline

    TEXT
    &
    MORE TEXT \\[3ex]
    \hline

    \end{tabular}
\end{center}\break

How do I make both columns be affected?

Best Answer

The explicit spacing in \\[3ex] affects vertical alignment. Use \renewcommand\arraystretch instead.

\documentclass{article}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash} m{#1} }
\begin{document}
\renewcommand\arraystretch{1.3}
\begin{tabular}{ | L{\dimexpr 0.4\linewidth-2\tabcolsep} | L{\dimexpr 0.4\linewidth-2\tabcolsep} | }  
\hline
    TEXT TEXT TEXT TEXT TEXT 
    TEXT TEXT TEXT TEXT TEXT 
    TEXT TEXT TEXT TEXT TEXT 
    TEXT TEXT TEXT TEXT TEXT 
    &
    MORE TEXT \\
\hline
    TEXT
    &
    MORE TEXT MORE TEXT MORE TEXT
    MORE TEXT MORE TEXT MORE TEXT
    MORE TEXT MORE TEXT MORE TEXT
    MORE TEXT MORE TEXT MORE TEXT \\
\hline
\end{tabular}
\end{document}

enter image description here

Related Question