# How to vertically align multiline column

I am trying to set up a table with the tabularx package (although the used package does not really matter to me).

The table should stretch across the entire line. I am trying to get both columns centered vertically.

This works fine for the first column, but the second column is aligned (as it seems to me) at the same height as the text in the first column, which renders the second line of text being below the desired "middle" of the cell (The "middle" being somewhere in between the two lines of text). Oddly enough, if i shorten the text in the second column to fit into one line, neither of the columns is aligned correctly (or maybe it is, though not in the fashion i desire...).

Here's what i have so far:

\documentclass[a4paper,12pt,headsepline]{scrartcl}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\linewidth}{| p{0.25\linewidth}| X |}
\hline
\LaTeX & Is a document markup language and document preparation system for
the \TeX typesetting program.\\
\hline
\end{tabularx}
\end{document}


I am aware that vertical alignment in tables is discussed fairly often, although so far i was unable to find any solution that would work for me (including defining new column types). Any hint or suggestion is greatly appreciated, i've been stuck on this for quite some time now...

-
– Claudio Fiandrino Mar 18 '13 at 16:38
@David: Sorry, i did not realize i had forgotten \begin{document} and \end{document}. The editors were faster than me re-checking ;-) – barghest Mar 18 '13 at 17:08

You can try using m{...} type columns (redefining \tabularxcolumn you can change the default p{...} type used by tabularx):

\documentclass[a4paper,12pt,headsepline]{scrartcl}
\usepackage{tabularx}

\renewcommand{\tabularxcolumn}[1]{m{#1}}

\begin{document}

\noindent\begin{tabularx}{\linewidth}{| m{0.25\linewidth}| X |}
\hline
\LaTeX & Is a document markup language and document preparation system for
the \TeX\ typesetting program.\\
\hline
\end{tabularx}

\end{document}


-
Thank you very much for this answer. I had some code that would accidentally change the extrarowheight  - testing your example in another document made me realize that the problem wasn't the code for my table itself. – barghest Mar 18 '13 at 16:53

Please when posting questions always supply a complete document (as in Gonzalo's answer) not a fragment.

Using m is the correct answer to get vertical centering, but one other observation, it may just be an artifact of your small example but in

\begin{tabularx}{\linewidth}{| p{0.25\linewidth}| X |}


tabularx is going to set the table several times to determine the optimum column width of the second column but since there are no l c or r columns that width is known in advance and you could use

 \begin{tabular}{| m{0.25\linewidth}| m{\dimexpr.75\linewidth-4\tabcolsep-3\arrayrulewidth\relax} |}

-