In the code below, building off solutions found here, I am trying to use the \node and \subnode options to draw the arrow, but I cannot get the file to compile. Can you help me to fix the code to get the arrow to point to the text and the highlighted cell like this
Here is the code:
\documentclass{article}
\usepackage{tikz}
\usepackage{blkarray}
\usetikzlibrary{fit,calc,arrows,shapes,decorations.pathreplacing,pgfplots.groupplots, matrix}
\tikzset{%
highlight/.style={rectangle,rounded corners,fill=red!15,draw,
fill opacity=0.5,thick,inner sep=0pt}
}
\newcommand{\tikzmark}[2]{\tikz[overlay,remember picture,
baseline=(#1.base)] \node (#1) {#2};}
%
\newcommand{\Highlight}[1][submatrix]{%
\tikz[overlay,remember picture]{
\node[highlight,fit=(left.north west) (right.south east)] (#1) {};}
}
\begin{document}
\[
M = \left(\begin{array}{*5{c}}
\tikzmark{left}{1} & 2 & 3 & 4 & 5 \\
6 & 7 & 8 & 9 & 10 \\
11 & 12 & \tikzmark{right}{13} & 14 & 15 \\
16 & 17 & 18 & 19 & 20
\end{array}\right)
\Highlight[first]
\qquad
M^T = \left(\begin{array}{*5{c}}
\tikzmark{left}{1} & 6 & 11 & 16 \\
2 & 7 & 12 & 17 \\
3 & 8 & \tikzmark{right}{13} & 18 \\
4 & 9 & 14 & 19 \\
5 & 10 & 15 & 20
\end{array}\right)
\]
\Highlight[second]
%
\tikz[overlay,remember picture] {
\draw[->,thick,red,dashed] (first) -- (second) node [pos=0.66,above] {Transpose};
\node[above of=first] {$N$};
\node[above of=second] {$N^T$};
}
\[
\begin{blockarray}{ccccc}
x_{1} & x_{2} & x_{3} & x_{4} & \\
\begin{block}{[cccc|c]}
1 & 0 & \tikzmark{left}{-1} & 0 & 0 \\
0 & 1 & 2 & 0 & 0 \\
0 & 0 & \tikz{\node{\subnode{d1}\tikzmark{right}{0}};} & 1 & 0 \\
\end{block}
\end{blockarray}
\Highlight[new1]
\]
%\begin{tikzpicture}[remember picture,overlay]
% \node [shift={(3.0em,-4.0ex)}, anchor=west] at ({pic cs:starta}) (X) {Tip measurement};
% \draw [mybluei, thick, -latex] (X.west) -| ($({pic cs:starta})!0.5!({pic cs:enda})+(0,-0.5ex)$);
%\end{tikzpicture}
\end{document}



\subnodeis not defined. You don't define it and you don't load anything which defines it. To use it, you need to load thetikzmarklibrary. However, it defines\tikzmarkso you can't use this and then say\newcommand\tikzmark.... If you need your definition of the marks, you can simply use a different name.\newcommand\mytikzmark...will work fine. However, I cannot figure out what you want to do with the\subnodecommand. This should take 2 arguments: name of the subnode and contents of the subnode. You just have one. – cfr Feb 08 '16 at 21:34\mytikzmarkwithin the node, but that is not going to work. That is why\subnodewas written: so that you could mark stuff within nodes, when the usual methods of settingtikzmarks (however defined) aren't available. So either don't use a subnode here or a TikZ picture and just use\mytikzmark. Or use\subnodes inside the TikZ picture. But I can't see why you want a TikZ picture here. What are you trying to produce exactly? – cfr Feb 08 '16 at 21:37