9

Possible Duplicate:
Tables of numbers

Is it possible to put a "x\y" style legend in one cell (maybe be made up of several cells) of a table? It would be great to make the 'x' slightly lower while the 'y' slight higher.

Please see the picture below for illustration:

XY_style

Thank you very much.

Li Wang
  • 1,013
  • Welcome to tex.sx! Note that it is unusual around here to sign your questions (as there is already a box with your username below it) or to have any greeting. A suggestion: Change your username to something more telling than "user2015". – lockstep Feb 22 '11 at 00:35
  • 2
    Have a look at http://tex.stackexchange.com/questions/7262/tables-of-numbers, http://tex.stackexchange.com/questions/9275/combined-header-cell-in-a-table and http://tex.stackexchange.com/questions/9253/slashbox-alternative. Maybe one of the solutions to these questions is applicable to your case. – Caramdir Feb 22 '11 at 01:29
  • 1
    http://tex.stackexchange.com/questions/7262/tables-of-numbers provides a perfect solution --- i.e. \backslashbox in slashbox package. Thank you very much @Caramdir. – Li Wang Feb 22 '11 at 04:47

1 Answers1

13

AFAIK, there are two packages for this purpose. One is my diagbox (replacement of old slashbox). The other is makecell. Here is an example of \diaghead in makecell:

\documentclass{article}
\usepackage{diagbox}
\usepackage{makecell}
\begin{document}

\section*{diagbox}

\begin{tabular}{|l|c|c|}\hline
\theadfont\diagbox[width=11em]{Diag\\Column Head I}{Diag Column\\Head II}&
\thead{Second\\column}&\thead{Third\\column}\\    \hline
& foo & bar \\    \hline
\end{tabular}

\section*{makecell}

\begin{tabular}{|l|c|c|}\hline
\diaghead{\theadfont Diag ColumnmnHead II}%
{Diag\\Column Head I}{Diag Column\\Head II}&
\thead{Second\\column}&\thead{Third\\column}\\    \hline
& foo & bar \\    \hline
\end{tabular}
\end{document}

enter image description here

Leo Liu
  • 77,365