Destaque a célula da matriz e tenha setas apontando para a célula com texto

Destaque a célula da matriz e tenha setas apontando para a célula com texto

Este código é construído a partir das soluções postadasaqui. Estou tentando a abordagem sugerida nosoluções duplicadas. Estou tendo dois problemas:

  1. Não tenho certeza de como fazer com que a seta aponte para o texto "variável livre" com esta nova abordagem, e

  2. Os colchetes parecem ser mais curtos e próximos dos números em comparação com a matriz original.

Você pode me ajudar a corrigir esses problemas de desenhar a seta para apontar para o texto e também corrigir a forma como os colchetes aparecem?

É assim que eu gostaria que meu resultado final fosse, obrigado!:

insira a descrição da imagem aqui

Aqui está o código:

\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} 

Responder1

Você deve mover o nó "variável livre"; a seta seguirá automaticamente.

\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] {
  \node[below=(.5cm of new1), xshift=1.5cm, red,font=\itshape, name=free1] {\shortstack{free \\ variable};}}
\tikz[overlay,remember picture] \draw[->] (free1) to[out=180,in=270] (new1);

\end{document} 

insira a descrição da imagem aqui

informação relacionada