7

I'd like to build a tabular and next to it a graphics in the same height.
I use the following code (for minimal working purposes, I used \rule) and do not understand, what is going wrong:

\documentclass{minimal}
\begin{document}
    \newsavebox{\testbox}%
    \newlength{\testheight}%
    \savebox{\testbox}{%
            \begin{tabular}{cr}%
                \multicolumn{2}{c}{\underline{\underline{\textsc{Line 1}}}}\\ \\
                Line&2\\%
                Line&3\\%
                Line&4\\%
            \end{tabular}%
        }%
        \settoheight{\testheight}{\usebox{\testbox}}
        \usebox{\testbox}\hfill\rule{3pt}{\the\testheight}\hfill\rule{3pt}{\the\testheight}
\end{document}

As \savebox if fragil, I also played around with the robust commands \mbox and/or \sbox - without success.

2 Answers 2

11

By default tabular is vertically centred so the height is only (roughly) half what you need.

Depending what you want to do you could use

           \begin{tabular}[b]{cr}%

so the table is bottom aligned, or you could extract the height and the depth of the box.

0
0

May be you can try tabulatht from the Oberdiek-bundle. The tabularht package defines some environments that add a height specification to tabular and array environments.

1
  • Sounds interesting - I'll have a look at it. Thanks. Aug 13, 2012 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .