[Tex/LaTex] Centering cells of a tabular column using m{}

tablesvertical alignment

I want to use a tabular to list some headlines, that might be quite long or contain linebreaks. The first column is kind of an Index or Key for the second columns content, so i would like to (vertically) center it (and i'll add \midrules for readability). To achieve the centering i included the array-package with its column definition m{2.5em}. The remaining two columns have fixed widths, too. But – as in the following MWE – the first column is somehow vertically placed top or bottom but not centered.

\documentclass[a4paper,div=calc]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{array,booktabs,calc}
\begin{document}
\begin{tabular}{>{\raggedleft}m{2.5em}b{.5\textwidth-6\tabcolsep-8em}p{5.5em}}%
    \toprule\textbf{\#}&\textbf{Name}&\textbf{Notes}\\\midrule%
    A & 
    Lorem ipsum dolor sit amet, consectetur adipisici elit&\\
    B & \begin{minipage}[t]{.5\textwidth-6\tabcolsep-8em}
        An\\even\\higher\\row\\with\\linebreaks
    \end{minipage}&\\
    2 & Short Entry & 
    \\\bottomrule
\end{tabular}
\end{document}

And here's how it looks, as you can see, the first column is not vertically centered (i know in this quick MWE the minipage does not have enough space below).
MWE of the non vertically centered first column

Any ideas?

Best Answer

use tabularx with a redefinition of the X columntype, then you do not need the calc package:

\documentclass[a4paper,div=calc]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}   
\begin{document}

\begin{tabularx}{0.5\linewidth}{>{\raggedleft}m{2.5em} X m{5.5em}}%
    \toprule\textbf{\#}&\textbf{Name}&\textbf{Notes}\\\midrule%
    A & Lorem ipsum dolor sit amet, consectetur adipisici elit&\\
    B & An\newline even\newline higher\newline 
        row\newline with\newline linebreaks &         \\
    2 & Short Entry & 
    \\\bottomrule
\end{tabularx}

\end{document}

enter image description here

Related Question