[Tex/LaTex] How to handle wide columns with \backslashbox


I'm using the package slashbox and my left column is reasonably wide, how can I tune the diagonal line (created by \backslashbox) such that it starts and ends in the corners of the cell?

Example code:

  \begin{tabular}{ *{4}{|c}|} 
   \backslashbox{foo}{bar} & test & header & header \\
   relatively wide column& b & $3$ & $4$ \\
   ds & c & $1$ & $4$ \\


alt text

Best Answer

The simplest and most straightforward way of doing this is to specify the literal size of the slashed box. In your case, it's about 40mm. So try this:


Generalising this approach would not be much more complicated. Compute the size of the backslashbox by taking the size of the column's widest string then add on two times the width of the table's column separators.

alt text