Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Diagonal lines in table cell

Is there a better way to label both axes of a table at the same time rather than using slashbox? It looks kind of ugly.

share|improve this question
add comment

marked as duplicate by Joseph Wright Oct 5 '11 at 20:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

You are right that they do not look very nice. You can use two different alternatives. In first one you can use a sub-heading, as the first example in the code below and the second one (which I prefer) is to assume that your reader is an intelligent human being and omit them altogether! By proper captioning you can also ensure that your message is clear. alt text

\documentclass{article}
\usepackage{slashbox,booktabs,amsmath}
\pagestyle{empty}
\begin{document}

\noindent
\begin{tabular}{|l||*{5}{c|}}\hline
\backslashbox{Room}{Date}
&\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2}
&\makebox[3em]{6/3}&\makebox[3em]{6/4}\\\hline\hline
Meeting Room &&&&&\\\hline
Auditorium &&&&&\\\hline
Seminar Room &&&&&\\\hline
\end{tabular}

\bigskip

\begin{table}[htbp]
\begin{tabular}{llllll}
\toprule
\textbf{Date} &\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2}
&\makebox[3em]{6/3}&\makebox[3em]{6/4}\\
\midrule
\textbf{Room} &&&&&\\
Meeting Room &&&&&\\
Auditorium &&&&&\\
Seminar Room &&&&&\\
\bottomrule
\end{tabular}
\caption{Room availability \textit{vs} dates.}
\end{table}


\bigskip

\begin{table}[htbp]
\begin{tabular}{llllll}
\toprule
~&\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2}
&\makebox[3em]{6/3}&\makebox[3em]{6/4}\\
\midrule
Meeting Room &&&&&\\
Auditorium &&&&&\\
Seminar Room &&&&&\\
\bottomrule
\end{tabular}
\caption{Room availability \textit{vs} dates.}
\end{table}

\end{document}
share|improve this answer
add comment

that is a problem when the entries for \backslashbox are very small. Insert some spaces and everything will be fine and, by the way, always load pict2e which extends the default line segments.

\documentclass{article}
\usepackage{slashbox,pict2e}
\pagestyle{empty}
\begin{document}

\noindent
\begin{tabular}{|r||*{5}{c|}}\hline
\backslashbox{Room~}{Date~~}
  & 5/31& 6/1 & 6/2 & 6/3 & 6/4 \\\hline
Meeting Room &&&&& \\\hline
Auditorium   &&&&& \\\hline
Seminar Room &&&&& \\\hline
\end{tabular}

\end{document}

alt text

share|improve this answer
add comment

AFAIK, there are two packages for this diag cell in table. One is slashbox, the other is makecell, which may produce better result sometimes. Here is an example of \diaghead in makecell:

\documentclass{article}
\usepackage{makecell}
\begin{document}
\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

And it would be even better on screen if you use pict2e package together with slashbox or makecell.

share|improve this answer
    
copied from tex.stackexchange.com/questions/11690/… –  Leo Liu Feb 23 '11 at 4:21
add comment