# Vertical space before and after hrule in tabular tables

Consider this example:

\documentclass{article}
\begin{document}
\begin{tabular}{|c|}
\downbracefill\\\hline
text\\\hline
\upbracefill
\end{tabular}
\end{document}


In the produced document, the vertical spacing between downbracefill and the first hline is not the same as the one between the second hline and upbracefill. This can also be reproduced with \hrulefill instead of \downbracefill and \upbracefill.

I suppose this has to do with the placement of the baselines.

How can I control the vertical space before and after hrule to make them equal in situations like in the given example?

• Is using something like $\overbrace{\underbrace{\text{text text text}}}$ sufficient for you? (if not why?) Oct 25, 2022 at 16:48
• @user202729, i wish to put overbraces and underbraces over and under different spans of cells in a table. Oct 25, 2022 at 16:50
• Weird workaround: Add \\[-16.8pt] after the second \hline. Credit partially tex.stackexchange.com/questions/84524/… Oct 25, 2022 at 16:55
• Use to raise the lower cell use \raisebox{3.6pt}{\upbracefill} . To calculate the raise, well .... Oct 25, 2022 at 17:41

The up/down-bracefill is only a component (it consists from three sub-components but it is not important now) used in the plain TeX macro \overbrace, \underbrace. This macro adds it over/under the given text without any vertical skips, the result is box over box. So, there is not important, how the up/down-bracefill is vertically positioned in respect to a general strut or to parentheses. The vertical position of these components chosen by D. Knuth is somewhat lower than you need. You can try to typeset:

(\downbracefill), (\upbracefill)


and you will see. D. Knuth didn't need to solve vertical position more accurately and we can only guess why the position was chosen as it was.

Edit: If you want to have horizontally stretchable \upbracefill and moreover to have vertical rules in the table, then you can try to apply affine transformation (shifting) before \upbracefill and then apply the inverse transformation:

\def\upbracecorr{3.5 }
\def\xupbracefill{\pdfliteral{1 0 0 1 0  \upbracecorr cm}%
\upbracefill   \pdfliteral{1 0 0 1 0 -\upbracecorr cm}}

\begin{tabular}{|c|}
\downbracefill\\\hline
text text text\\\hline
\xupbracefill
\end{tabular}

• So, how do you suggest me to get small and equal vertical spacing in the indicated places? Oct 25, 2022 at 14:57
• @Alexey If you don't want to have \upbracefill horizontally stretchable then you can write \raise.8ex\hbox{\upbracefill} instead \upbracefill in your example. If you want to have \upbracefill stretchable and moreover, you want to keep the horizontal lines in the table, then the problem is more complicated. Give more specification of your needs. Oct 25, 2022 at 18:34
• I added a solution of shifting \upbracefill to my answer. Use pdftex, where \pdfliteral is implemented. If you are using LuaTeX then define \protected\def \pdfliteral {\pdfextension literal}. Oct 25, 2022 at 19:54