# Vertical space at the bottom of nested tabulars

I'm trying to make a macro which typeset a text "accross a vertical line", and I'm using a tabular for that :

\documentclass{article}

\begin{document}

\makeatletter

\newlength\tdv@temp

\newcommand\center@box[3]{\parbox[c][#1][c]{#2}{\makebox[#2][c]{#3}}}

\newcommand\txt@value@on@bar[1]{%
\settowidth{\tdv@temp}{$#1$}%
\begin{tabular}{@{\hspace{0pt}}c@{\hspace{0pt}}}%
\rule{5pt}{8mm}\\%
\center@box{8mm}{\tdv@temp}{#1}\\%
\rule{5pt}{8mm}\\%[-4pt]%
\end{tabular}%
}

\begin{tabular}{|c|c|}
\hline
$1$ & $2$ \\
\hline
\txt@value@on@bar{0} & 2 \\
\hline
\end{tabular}

\end{document}


There's a tiny space at the bottom, which I think is related to \arraystretch.

But if I set \def\arraystretch{0}, the first line is stretched (at the very worst, I could put a strut there), and if I try to uncomment the \\[-4pt], the cells are not aligned vertically anymore.

• I don't know which layout you want to achieve, but the center@box looks much too complicated. I would start with \rule[-\ht\@arstrutbox]{0pt}{8mm}#1\\\rule[-\ht\@arstrutbox]{5pt}{8mm} and then adjust the values. – Ulrike Fischer Jul 23 at 7:09
• Thanks for the answer, it works indeed but I have no idea why. What is \@arstrutbox and why don't I have the vertical space in both the inner tabular and the outer one ? – Fred Jul 23 at 7:45
• In fact no, it doesn't work if I change 8mm by other values : I lose alignment with the left cell at 7mm and get back space at top at 5mm. The total height (3*24mm in my example, but typically it'd be 3*5) of the cell is meant to be editable by "user". – Fred Jul 23 at 8:06
• well your inner tabular has its baseline in the middle and depending on the content this is quite unrelated to the baselines of the various lines in this tabular. If you want to align e.g. the 0 with the 2 you should better put the zero on the first line so that you can use [t]. – Ulrike Fischer Jul 23 at 13:18