I am trying to highlight a particular column in a matrix. I therefore draw the matrix (with easybmat
) in a node and I draw the shape of the column in a scope (on the background). However, the scope is shifted right, and I do not know why.
The highlight should be from (second line, first column) to (last line, first column).
\documentclass{article}
\usepackage{etex}
\usepackage{easybmat}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{backgrounds,fit}
\tikzset{%
highlight/.style={rectangle,rounded corners,fill=orange!35,draw,thick,inner sep=2pt}
}
\newcommand{\tikzmark}[2]{\tikz[remember picture,baseline=(#1.base),inner sep=0,outer sep=0pt] \node (#1) {#2};}
\begin{document}
\begin{tikzpicture}[remember picture]
\node (){
$
\left( \begin{BMAT}(r){cccccccc}{cccccccc}
a_{1\,1}^{(k)} & a_{1\,2}^{(k)} & \cdots & & & & \cdots &
a_{1\,n}^{(k)} \\
\tikzmark{left}{0} & a_{2\,2}^{(k)} & & & & & &
a_{2\,n}^{(k)} \\
\vdots & & \ddots & & & && \vdots \\
& \vdots & & a_{k-1\, k-1}^{(k)} & & & & \\
& & & & a_{k\, k}^{(k)} & & & \\
& & \cdots &\vdots & & a_{k+1\, k+1}^{(k)} & & \\
& & & & \vdots & \vdots &\ddots & \vdots \\
\tikzmark{right}{0} & & & & & a_{n\, k+1}^{(k)} & &
a_{n\,n}^{(k)} \\
\end{BMAT} \right)
$
};
\begin{scope}[on background layer]
\node[highlight,overlay,fit=(left.north west) (right.south east)] {};
\end{scope}
\end{tikzpicture}
\end{document}