[Tex/LaTex] Disable \tabulinesep for some rows with tabu package

spacingtablestabu

The \tabulinesep parameter with tabu package provide good paddings for tables with variant heights. But when using it with diagbox package, the paddings cause problem.

\documentclass{article}
\usepackage{amsmath,diagbox,tabu}
\begin{document}
tabulinesep
{\setlength{\tabulinesep}{3pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$ & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
%
extrarowsep
{\setlength{\extrarowsep}{3pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$ & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
\end{document}

How could I disable \tabulinesep padding for only the first row of the table?

As you could see in the above example, \extrarowsep doesn't give the desired paddings. Therefore I would like to stick to \tabulinesep solution.

enter image description here

Best Answer

As an alternative, I propose \addstackgap of the stackengine package, which only needs to be applied to the tallest cell in an oversized row. Here I use it in conjunction with \extrarowsep, but depending on what look the OP seeks, that is not necessary.

\documentclass{article}
\usepackage{amsmath,diagbox,tabu,stackengine}
\begin{document}
tabulinesep
{\setlength{\tabulinesep}{3pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
$\dfrac12$ & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
%
\Centerstack{addstackgap + extrarowsep}
{\setlength{\extrarowsep}{1pt}
\begin{tabu}{|c|c|c|}
\hline
\diagbox{X}{Y} & Z & Z\\
\hline
\addstackgap[4pt]{$\dfrac12$} & $\dfrac34$ & $\dfrac56$ \\
\hline
$A$ & $B$ & $C$ \\
\hline
\end{tabu}}
\end{document}

enter image description here