# Align math contents in a table

While trying to display some data in a table, I use tabu and siunitx. I want the content to be centered by the dot. However, the cell at last column, first row is not centered.

\documentclass{article}
\usepackage{siunitx}
\usepackage{tabu}
\newcolumntype Y{S[%
group-four-digits=false,
round-mode=places,
round-precision=3,
round-integer-to-decimal=false,
per-mode=symbol,
detect-all,
]}
\tabucolumn Y
\usepackage{booktabs}
\makeatletter
\def\NN{\tabularnewline}
\def\FL{\toprule}
\def\ML{\NN\midrule}
\def\LL{\NN\bottomrule}
\makeatother

\begin{document}

\begin{tabu}{|c|Y|Y|Y|Y|}
\FL
$K$ & {2} & {5} & {10} & {100}
\ML
$\gamma_3$ & 0.13731 & 0.14011 & 0.11446 & 0.040306
\NN
$\gamma_4$ & -0.22974 & -0.069162 & -0.17112 & 0.11587
\LL
\end{tabu}
\end{document}

-
Is your question similar to Aligning text in S columns in a way that respects the decimal marker for numerical entries I wonder if the 'standard' \newcommand{\heading}[1]{\multicolumn{1}{c}{#1}} trick could work for you? –  cmhughes Feb 5 '13 at 5:28
I tried that. It does the trick, however a global solution would be better. –  cacamailg Feb 5 '13 at 5:31
The problem arises because of the way you have 'hidden' the end-of-row inside another macro. Picking up the last cell in the row correctly is tricky, and this leads to the need to do various pieces of detection inside the package. However, that fails if the \\ (or \tabularnewline) is inside another command. As such, the best way to deal with this is to replace \ML with \\ \midrule here.
I tried to use \makeatletter \def\NN{\\} \def\FL{\toprule} \def\ML{\NN\midrule} \def\LL{\NN\bottomrule} \makeatother and doing that way it did work. Any clue? –  cacamailg Feb 5 '13 at 12:35