TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

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.

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
up vote 4 down vote accepted

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:



Meeting Room &&&&&\\\hline
Auditorium &&&&&\\\hline
Seminar Room &&&&&\\\hline


% 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);


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.