I'm trying to strike out a column and a row from a matrix, and I get it to work if I define the tikzmark myself (from I post I found on the internet). I understand, however, that tikzmark is now included by default in the tikz library, so I tried to use it instead. But I get errors of names not defined. This is the MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc, tikzmark}
%% draw horizontal and vertical lines in tables
%\newcommand{\tikzmark}[2]{\tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {$#2$};}
\newcommand{\DrawVLine}[3][]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[#1] (#2.north) -- (#3.south);
\end{tikzpicture}
}
\newcommand{\DrawHLine}[3][]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[#1] (#2.west) -- (#3.east);
\end{tikzpicture}
}
\begin{document}
\begin{equation*}
\begin{bmatrix}
\tikzmark{top}{ a } & 0 & -a & \tikzmark{right}{-c} \\
0 & b & 0 & -b \\
-a & 0 & a & k \\
\tikzmark{bottom}{d} & -b & d & c \\
\end{bmatrix}
\end{equation*}
\DrawVLine[red, ultra thick, opacity=0.5]{top}{bottom}
\DrawHLine[red, ultra thick, opacity=0.5]{top}{right}
\end{document}
which doesn't work. But if you uncomment the definition of tikzmark and remove it from \usetikzlibrary then I get the expected result:




\tikzmarkwith some\tikznodecommand, which is also around. Referring to coordinates from\tikzmarkrequires apic cs:. – Jul 08 '18 at 12:40