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.

10

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

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.

  • Sounds interesting - I'll have a look at it. Thanks. – Bastian Ebeling Aug 13 '12 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.