This question is best explained by giving the usecase:

I have a table where I list some data and I would like to add a column to the right which gives the ratio of two adjacent rows. Now to make it more obvious the ratio of which rows this is I would like to shift the column which the ratios by half the height of a row so that each of the ratio values sits to the right of the two columns which it was calculated from.

E.g. instead of this

 A    ratio
 3      2
 6      3

imagine the same table but the numbers in the right column shifted down by half a row.

Is this even possible?

2 Answers 2

A & \multicolumn{1}{c}{ratio}\\
3 &2\\
6 &3\\

The \multicolumn{1}{c}{...} is necessary to avoid applying the shift also to the heading.

  • (+1) Snap! And thanks for showing how to use \normalbaselineskip -- I was sure there was a command like that but couldn't remember what it was...
    – Ant
    Sep 26, 2011 at 10:57
  • Using a dimensione expressed in ex units is quite the same.
    – egreg
    Sep 26, 2011 at 11:00
   % (for "quotient")
A & \multicolumn{1}{l}{ratio}\\
3 & 2\\
6 & 3\\
18 \\

Table with numbers in ratio column shifted downwards

The key part here is that \raisebox moves the number down and \smash stops it from just expanding the row (as far as the table is concerned the number takes up no space at all). Then we apply it to the whole column at once using Martin Scharrer's collcell (which loads array behind the scenes), and use \multicolumn to stop the column title from going awry.

Using booktabs is just to make it look prettier.

(I'll also note that there are probably better ways to code the shift distance than hard-coding it as -1ex!)


You must log in to answer this question.

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