Considering the answer of question, I used the slashbox package to draw a diagonal line. But the problem is I have multiple rows in my table and that makes the line not aligned well within the cell corners. It also gives wierd spaces between cells:
\documentclass{article}
\usepackage{slashbox}
\usepackage{adjustbox}
\begin{document}
\begin{table}[!htpc]
\begin{center}
\centering
\caption{some table.}
\label{possibility}
\begin{footnotesize}
\adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
max width=\textwidth}{
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
&first & first & second & second & both & both & &\\
&key & key & key & key& key & key & none&all\\
\backslashbox{Room}{Date} &at & at & at & at & at & at& & \\
&d & p & d & p & d & p & &\\ \hline
$C_1$&Y & N & N & N & N & N & N &N \\ \hline
\hline
\end{tabular}
}
\end{footnotesize}
\end{center}
\end{table}
\end{document}
EDIT
I have used the answer presented by @bernard but it gives me ! Use of \line doesn't match its definition
as an error. Not sure if it would happen for others as well.
Best Answer
It's better to use
diagbox
, which is more powerful. I improved your table usingmakecell
(allows for line breaks and vertical padding in cells). Also, don't use thecenter
environment in tables, as it adds unwanted vertical spacing; use\centering
instead. The placement of the diagonal line is adjusted through the optional argument of\multirow
.