I would like to show a matrix with "strike-out lines" on some of its rows and columns. After some research I found a solution using Tikz matrices, which I reproduce here:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{amsmath}
\begin{document}
\[
\begin{tikzpicture}
\matrix (mat) [%
matrix of nodes,
left delimiter={(},right delimiter={)}
]
{%
2 & 6 & 0 & 4\\
3 & 5 & 5 & 0\\
1 & 0 & 2 & 4\\
5 & 2 & 1 & 0\\
};
% do the strike out thing
\draw[black] (mat-1-1.west) -- (mat-1-4.east);
\draw[black] (mat-1-3.north) -- (mat-4-3.south);
\end{tikzpicture}
\rightarrow
\begin{pmatrix}
0 & 0 & 0 & 0\\
3 & 5 & 0 & 0\\
1 & 0 & 0 & 4\\
5 & 2 & 0 & 0\\
\end{pmatrix}
\]
\end{document}
However, there are a few problems with that: first, the alignment with the second matrix is obviously wrong. Also, the two matrices are in different styles (row/column distance, font, etc).
I already have a several-hundred-long document, so switching every matrix from LateX matrix to Tikz matrix would be too time-comsuming. Is there any other way to get the strike-out effect, resulting in a matrix whose style is consistent with the rest of the matrices in the document?
Thank you!
tikzmark
and overlay the TikZ code on your existing matrices.