3

While trying to answer a tabular related question here I found the following behavior which surprised me:

I'm trying to overlap a multi-line text in an otherwise left aligned column with the empty cell above. This is intended as an alternative to the multirow package in this case. I tried \raisebox{<amount>}[0pt]{\begin{minipage}[t]{<width>} .. \end{minipage}} (or \begin{adjustbox}{minipage=[t]{<width>},raise={<amount>}{0pt}) but this does not raise the minipage at all when a l, c or r column type is used. It works for p{<width>}.

A MWE is:

\documentclass{article}
\usepackage{blindtext}
\begin{document}

\begin{tabular}{lp{6cm}}
    text & .\raisebox{1ex}{Text} \\
    text &
    .\raisebox{2\baselineskip}{\begin{minipage}[t]{5cm}% baseline is raised
        \blindtext
    \end{minipage}} \\
\end{tabular}

\clearpage
\begin{tabular}{ll}% same for c and r
    text & .\raisebox{1ex}{Text} \\
    text &
    .\raisebox{2\baselineskip}{\begin{minipage}[t]{5cm}% baseline is not raised!
        \blindtext
    \end{minipage}} \\
\end{tabular}

\end{document}

Result with 'p' type:

With 'p' type

Result with 'l' type:

With 'l' type

This behavior escapes me. It is usually always possible to use a minipage in an otherwise horizontal mode. I guess that maybe some internal macro is redefined which interferes with this? Can anyone explain why this happens and how to make \raisebox work also for non-p column types?

1 Answer 1

7

Your example is too complicated. The problem is that you are using \baselineskip that's set to zero in l-columns:

\documentclass{article}

\begin{document}

\begin{tabular}{ll}% same for c and r
    text & .\raisebox{1ex}{Text} \\
    text &
    .\the\baselineskip. \raisebox{\baselineskip}{blub}\raisebox{1cm}{BLA}\\
\end{tabular}

\end{document}
2
  • 2
    And \normalbaselineskip can be used in place of \baselineskip
    – egreg
    Commented May 21, 2012 at 10:35
  • Thanks Ulrike and @egreg. I knew it must be some macro redefinition, but would not have guessed \baselineskip to be the cause. You are right Ulrike, I should have used a direct value instead. Commented May 21, 2012 at 11:45

You must log in to answer this question.

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