# Inclined line between two cells in a table [duplicate]

Possible Duplicate:
Diagonal lines in table cell

How can I put an inclined line between two cells in a table? I know that \cline{i-j} put a partial horizontal line, but I want that this line is inclined... Can somebody help me?

-

## marked as duplicate by Joseph Wright♦Oct 5 '11 at 20:04

Can you please describe in more detail what you mean with "inclined"? Should the line go from the upper corner of a cell to the bottom opposite corner of the same cell, or should it cross several cells? – Gonzalo Medina Jun 14 '11 at 21:16
Yes, thank you for the fast response. The line should go from the upper corner of a cell to the bottom opposite corner and I wanted to write things in both sides of the cell. – Flávio Marchesini Jun 14 '11 at 21:20

There is a slashbox package (not included in TeX Live2010) to draw diagonal lines in a matrix cell; however, the results obtained with this package are rather poor (see example below). Another option would be to use TikZ and a matrix of nodes. In the following example I show both approaches: one example taken from slashbox.tex and the other one built with the help of TikZ:

\documentclass{article}
\usepackage{slashbox}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}

\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}

\vspace{1cm}

\begin{tikzpicture}
% the matrix
\matrix [matrix of nodes,text height=8pt,text depth=2pt,text width=0.5cm,nodes={align=center}] (mat)
{
a & b & c \\
d & e & f \\
g & h & i \\
j & k & l \\
};
% the horizontal lines
\foreach \i in {1,2,3,4}
\draw (mat-\i-1.north west) -- (mat-\i-3.north east);
\draw (mat-4-1.south west) -- (mat-4-3.south east);
% the vertical lines
\foreach \i in {1,2,3}
\draw (mat-1-\i.north west) -- (mat-4-\i.south west);
\draw (mat-1-3.north east) -- (mat-4-3.south east);
% the diagonal lines
\draw (mat-1-1.north west) -- (mat-1-1.south east);
\draw (mat-3-3.north west) -- (mat-3-3.south east);
\end{tikzpicture}

\end{document}


-
Thank you very much! It was exactly what I needed! – Flávio Marchesini Jun 14 '11 at 21:45