# Crossing out multirow/multicolumn cells

Cross out arbitrary table cells with diagonal line shows a way of crossing out single cells. Is it possible to cross out a cell that spans multiple rows and/or multiple columns?

Edit: This is not duplicate because I need it to be just crossing it out with one line exactly, whereas that question needs to cross out the cell with an actual cross. I know this might be really simple for some, but it is nearly completely opaque to me (how to change it).

The following is just a quick adaptation of the solution here.

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{zref-savepos}
\usepackage{multirow}

\newcounter{NoTableEntry}
\renewcommand*{\theNoTableEntry}{NTE-\the\value{NoTableEntry}}

\newcommand*{\smulticolumn}[3]{%
\multicolumn{#1}{#2}{%
\scell{#3}
}%
}

\newcommand*{\smultirow}[3]{%
\multirow{#1}{#2}{%
\scell{#3}
}%
}

\newcommand*{\scell}[1]{
\stepcounter{NoTableEntry}%
\zsavepos{\theNoTableEntry l}% left
\hspace{0pt plus 1filll}%
#1% content
\hspace{0pt plus 1filll}%
\zsavepos{\theNoTableEntry r}% right
\tikz[overlay]{%
\draw
let
\n{llx}={\zposx{\theNoTableEntry l}sp-\zposx{\theNoTableEntry r}sp-\tabcolsep},
\n{urx}={\tabcolsep},
\n{lly}={\zposy{\theNoTableEntry b}sp-\zposy{\theNoTableEntry r}sp},
\n{ury}={\zposy{\theNoTableEntry t}sp-\zposy{\theNoTableEntry r}sp}
in
(\n{llx}, \n{lly}) -- (\n{urx}, \n{ury})
;
}%
}

\begin{document}

\begin{tabular}{|c|c|c|}
\hline
foo & bar & baz \\\hline
\smulticolumn{2}{|c|}{double} & B \\\hline
C & D & \smultirow{2}{*}{$\delta$} \\
E & F & \\\hline
\end{tabular}
\end{document}


Unfortunately, it doesn't work great for multi-row, but at least seems like a reasonable starting point.

You could use \tikzmark.

I think there's a way to calculate the exact positioning automatically, but it's above my level of knowledge.

If you have few cells to cross out, you could calculate it manually with trial and error (like I did) without big problems.

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{tikzmark, calc}
\usepackage{array}
\usepackage{multirow}
\setlength{\extrarowheight}{2pt}

\begin{document}
\begin{tabular}{|c|c|c|}
\hline
foo & bar & baz \\
\hline
\multicolumn{2}{|c|}{\tikzmark{smc}\hfill double\hfill\tikzmark{emc}} & B \\
\hline
C & D & \tikzmark{smr}\multirow{2}{*}{$\delta$}\tikzmark{smr} \\
E & F & \\
\hline
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\draw ($(pic cs:smc)-(\tabcolsep,3.6pt)$) -- ($(pic cs:emc)+(\tabcolsep,10.4pt)$);
\draw ($(pic cs:smr)-(16pt,17.6pt)$) -- ($(pic cs:emr)+(-3.7pt,2.2pt)$);
\end{tikzpicture}
\end{document}


Note that the \tikzmark must be put inside the \multicolumn, see here.