# vertical alignment using tabularx / arraystretch

I am using the tabularx package to customize my tables. I changed the definition of tabularxcolumn to vertically center the text. As I am using arraystretch, the bold 'titles' of my table are aligned quite ugly. How can I fix this?

  \documentclass[fleqn,10pt,twocolumn]{article} % Document font size and equations
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{colortbl}
\usepackage{enumitem}
\renewcommand\tabularxcolumn[1]{m{#1}}
\renewcommand\arraystretch{1.5} \setlength\minrowclearance{2.4pt}

\arrayrulecolor{blue}

\newcolumntype{=}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
#1\ignorespaces
}

\begin{document}
\begin{tabularx}{\linewidth}{|=l^X|@{}}
\multicolumn{2}{>{\columncolor{blue}}c}{\color{white}\textbf{Table: Interfaces}} \\
\hline
\rowcolor{blue}
\rowstyle{\color{white}\bfseries}
\textbf{Interface} &\rowstyle{\color{white}}\textbf{Programming Languages}\\
\texttt{.NET}
& The blablab this is only some text to illustrate my problem:
\begin{itemize}[topsep=-5pt,leftmargin=0.7cm,itemsep=0.8pt,labelsep=.5cm]
\item C\#
\item VB .NET
\end{itemize}\\
\texttt{JNI}
& Some other text \\
\hline
\end{tabularx}
\end{document}


And can someone explain when I need to insert this @{}? I still dont get that..

Overfull \hbox (10.00002pt too wide) in paragraph at lines 34--35


As your table was full width but indented by paragraph indent (10pt) I added \noindent.

You do not have to use @{} ever but if you do use it (or |) you need to be consistent. | adds a rule and @{} removes the usual inter-column padding which by default also appears before the first and after the last column. If you use these you need to use them also in the \multicolumn specifications so that the spanning columns get the same inter-column space as the columns they span.

(update Note the use of an l cell to ensure baseline alignment of the headings)

It's a bit unusual to put Table:.. in the table rather than have a separate caption, but I left it like that:

 \documentclass[fleqn,10pt,twocolumn]{article} % Document font size and equations
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{colortbl}
\usepackage{enumitem}
\renewcommand\tabularxcolumn[1]{m{#1}}
\renewcommand\arraystretch{1.5} \setlength\minrowclearance{2.4pt}

\arrayrulecolor{blue}

\newcolumntype{=}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
#1\ignorespaces
}

\begin{document}

\noindent X\dotfill X

\noindent
\begin{tabularx}{\linewidth}{@{}|=l^X|@{}}
\multicolumn{2}{@{}|>{\columncolor{blue}}c|@{}}{\color{white}\textbf{Table: Interfaces}} \\
\hline
\rowcolor{blue}
\rowstyle{\color{white}\bfseries}
\textbf{Interface} &\multicolumn{1}{l|@{}}{\textcolor{white}{\textbf{Programming Languages}}}\\
\texttt{.NET}
& The blablab this is only some text to illustrate my problem:
\begin{itemize}[topsep=-5pt,leftmargin=0.7cm,itemsep=0.8pt,labelsep=.5cm]
\item C\#
\item VB .NET
\end{itemize}\\
\texttt{JNI}
& Some other text \\
\hline
\end{tabularx}
\end{document}

• But "Programming Languages" still seems to be nearer to the bottom line than "Interfaces"... Jul 3 '13 at 17:00
• @Kathiieee so it is put \strut before each (it is the depth of the g you need to hide) Jul 3 '13 at 17:11
• @DavidCarlisle -- maybe i'm confused here, but if it were the depth of the g that needed to be hidden, then "Interface" (which has no descenders) would be lower than "Programming". ??? Jul 3 '13 at 18:35
• @Kathiieee sorry, see update. Jul 3 '13 at 23:02
• @barbarabeeton you are not confused, I was dashing out of the door (and wrong). See update. Jul 3 '13 at 23:02