Este código se basa en las soluciones publicadas.aquí. Estoy probando el enfoque sugerido por elsoluciones duplicadas. Tengo dos problemas:
No estoy seguro de cómo hacer que la flecha apunte al texto "variable libre" con este nuevo enfoque, y
Los corchetes parecen ser más cortos y más cercanos a los números en comparación con la matriz original.
¿Puedes ayudarme a solucionar estos problemas de dibujar la flecha para señalar el texto y también arreglar la forma en que aparecen los corchetes?
Así es como me gustaría que se viera el resultado final, ¡gracias!:
Aquí está el 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}
Respuesta1
Debes mover el nodo "variable libre"; La flecha seguirá automáticamente.
\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}