Graphics, Figures & Tables ⇒ Cancelling a cell in a table
Cancelling a cell in a table
How can I cancel a cell in laTeX? I searched google and wikibook and couldn't find any reference to this. I want to draw an X from the corners of the cell.
Also, is it possible to make a row a little higher? a superscript in a cell is to writing on the separating line of the table.
Thanks.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Cancelling a cell in a table
There's a slashbox package that provides two commands \slashbox and \backslashbox to draw diagonal lines across a cell in a table. Some time ago I did some tests using this package and the results are really poor. Give it a try if you want, but don't expect nice results.yotama9 wrote:How can I cancel a cell in laTeX?...
At this moment, I can only think of building the table and then using a package such as PGF/TikZ to manually place the diagonal lines.
Another option would be to buid everything using PGF/TikZ; take a look at the following simple example:
Code: Select all
\documentclass{book}
\usepackage{tikz-inet}
\usepackage{graphicx}
\usetikzlibrary{matrix}
\begin{document}
\begin{center}
\small
\begin{tikzpicture}
\matrix (magic) [%
matrix of nodes,
text width=4.1mm,text height=1mm,
text badly centered
]
{%
0 & 40 & $-$ & 0\\
10 & 20 & 0 & 0\\
20 & 0 & 20 & $-$\\
10 & 0 & 40 & 40\\
};
% horizontal lines of the table
\foreach \i in {1,2,3,4}
\draw (magic-\i-1.north west) -- (magic-\i-4.north east);
\draw (magic-4-1.south west) -- (magic-4-4.south east);
% vertical lines of the table
\foreach \j in {1,2,3,4}
\draw (magic-1-\j.north west) -- (magic-4-\j.south west);
\draw (magic-1-4.north east) -- (magic-4-4.south east);
% the "X" shaped lines
\draw (magic-2-3.north east) -- (magic-2-3.south west);
\draw (magic-2-3.north west) -- (magic-2-3.south east);
\end{tikzpicture}
\end{center}
\end{document}