2

I am using the tabu package to generate tables and I cannot make vertical adjustments to the cells content.

The horizontal markers l, c, r, or j work fine but the column types p,m, or b have no effect on the table's content position.

I have tried many combinations, read the docs and search the web to no avail.

\documentclass{article}

\usepackage{tabu}

\begin{document}

    \begin{tabu} to \linewidth{ | X | X[-1,m] | c | X[-1,b] | }

        \tabucline-
        A somewhat longer text to show that 
        the next row's content \emph{is not} 
        presented in the middle of the cell 
        and the last not at the bottom.&
        Second&
        Third& 
        fourth\\
        \tabucline-

    \end{tabu}

\end{document}

Result :

How can I go about and achieve vertical alignment; specifically the middle column type ?

I can only assume I am missing the obvious since it is a basic requirement.

4

enter image description here

\documentclass{article}

\usepackage{tabu}

\begin{document}

    \begin{tabu} to \linewidth{ | X[m] | X[-1,m] | c | X[-1,b] | }

        \tabucline-
        A somewhat longer text to show that 
        the next row's content \emph{is not} 
        presented in the middle of the cell 
        and the last not at the bottom.&
        Second&
        Third& 
        fourth\\
        \tabucline-

    \end{tabu}

\end{document}

note that the last column is b means that the reference point is on its bottom line not that it goes to the bottom of the cell, for a one line entry b and p are the same, just as b and t are the same for a one line parbox or tabular.

  • Thanks @David for your answer and clarifications. Why is it though that we have to modify the first column behavior for the second column to follow ? Also, why is the third column's content not displayed on the top of the cell like it was before? Is it possible to have different column types in one row ? – Pierre-Luc Gauthier Oct 9 '14 at 17:05
  • 2
    @Pierre-LucGauthier the row has a reference baseline the reference baseline of each cell is placed on that line. first cell m means its reference point is in its vertical centre so that centre line is on the row baseline, the second column is also m so it is vertically centred with the centre on the row basseline 3rd cell is c so it is not moved vertically and its baseline is on the row baseline so it look shigh as the baseline of third is lined with eh vertical centre of Second and the final cell is b so its reference line is on the baseline of its bottom (only) row so it matches third. – David Carlisle Oct 9 '14 at 17:56

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.