This code is building from the solutions posted here. I am trying the approach suggested from the duplicate solutions. I am having two issues:
I am not sure how to get the arrow to point to the text "free variable" with this new approach, and
The brackets seem to be shorter and closer to the numbers as compared to the original matrix.
Can you help me fix these issues of drawing the arrow to point to the text and also fix the way how the brackets appear?
This is how I would like my end result to look, Thanks!:
Here is the code:
\documentclass[11pt]{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{0,173,239}
\usepackage{blkarray}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning,fit}
\tikzset{%
highlight/.style={rectangle,rounded corners,fill=ocre!50,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}
\[
\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 & \tikzmark{right}{0} & 1 & 0 \\
\end{block}
\end{blockarray}
\]
\Highlight[new1]
\tikz[overlay,remember picture] {
\draw[->,thick,red,dashed] (new1) node [pos=0.66,above,text width = 2cm] {\emph{free \\ variable};
}}
\end{document}

