UK TeX FAQ -- question label slashbox

### Diagonal separation in corner cells of tables

You want to label both the top or bottom row and the left- or rightmost column, somewhere at the corner of the table where the row and column meet. A simple way to achieve the result is to construct the table with an arrangement of rules (and possibly `\``multicolumn` entries), to look like:

>     -----------------
>     x  y
>        --------------
>        1  2  3  4  5
>     -----------------
>     1
>     2
>     3
>     4
>     5
>     -----------------

However, this doesn’t satisfy everyone: many want the labelling in a single cell at the top left of the table. It sounds a simple enough requirement, yet it calls for some slightly tricky LaTeX coding. The slashbox package does the job for you: it defines commands `\``slashbox` and `\``backslashbox`, each taking the two labels as arguments. It draws a picture with the two labels on either side of a slanting line; the command (and hence the picture) may be placed in the corner cell, where the labelled row and column meet.

The package isn’t the world’s neatest: it uses LaTeX `picture` mode to draw its line, and picture mode has many tedious restrictions (and doesn’t, in all honesty, produce particularly good pictures). Load slashbox with the pict2e package, and at least the picture quality will be improved.

Documentation of slashbox is less than satisfactory: a LaTeX source file of rather startling starkness accompanies the package file in the distribution. It does, however, process to a DVI file that gives some idea of how the `\``slashbox` may be expected to look. (The third example in the file shows the effect of `picture` mode’s restrictions: the dividing line doesn’t go from corner to corner in the box: to correct this requires revision of slashbox — pict2e alone doesn’t help in this regard.)

`slashbox.sty`
  macros/latex/contrib/slashbox (or browse the directory)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=slashbox