Actualmente estoy trabajando en un informe de laboratorio donde tengo que explicar el Método de Eliminación Gaussiana para una matriz. Como parte de mi explicación, quiero rodear porciones circulares/ovaladas de una matriz.
¿Hay alguna forma de rodear la diagonal principal de una matriz o una esquina de la misma? Fotos a continuación con ejemplos. Estoy pensando que quizás tenga que usar una \put
estructura encima de un entorno de matriz/matriz, pero no sé cómo hacerlo.
EDITAR: Esto es lo que tengo actualmente para generar la matriz que dibujé en las imágenes:
\usepackage[utf8]{inputenc}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[numbers]{natbib}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
\usepackage{layout}
\usepackage[title]{appendix}
\usepackage[justification=centering]{caption}
\usepackage{titlesec}
\usepackage[percent]{overpic}
\usepackage{amsmath}
\usepackage{systeme}
\usepackage{blkarray, bigstrut}
...
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
1 & -1 & 3 & -3 \\
-1 & 0 & -2 & 1 \\
2 & 2 & 4 & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
Respuesta1
Aquí hay una posible forma de usar tikzmark
.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{blkarray, bigstrut}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,fit}
\begin{document}
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
\tikzmarknode{A11}{1} & -1 & 3 & -3 \\
-1 & 0 & -2 & 1 \\
2 & 2 & \tikzmarknode{A33}{4} & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\draw let \p1=($(A33)-(A11)$),\n1={atan2(\y1,\x1)} in
node[rotate fit=\n1,fit=(A11) (A33),draw,rounded corners,inner sep=2pt]{};
\end{tikzpicture}
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
1 & -1 & 3 & -3 \\
\tikzmarknode{B21}{-1} & 0 & -2 & 1 \\
\tikzmarknode{B31}{2} & \tikzmarknode{B32}{2} & 4 & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\node[fit=(B21) (B31) (B32),inner sep=2pt] (FB){};
\path (FB.south east) arc(-90:45:4pt) coordinate(aux1);
\draw (aux1) arc(45:-90:4pt) -- ([xshift=4pt]FB.south west)
arc(-90:-180:4pt) -- (FB.north west) arc(180:45:4pt) -- cycle;
\end{tikzpicture}
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
1 & \tikzmarknode{C12}{-1} & \tikzmarknode{C13}{3} & -3 \\
-1 & 0 & \tikzmarknode{C23}{-2} & 1 \\
2 & 2 & 4 & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\node[fit=(C12) (C23) (C13),inner sep=2pt] (FC){};
\path (FC.north west) arc(90:225:4pt) coordinate(aux2);
\draw (aux2) arc(225:90:4pt) -- ([xshift=-4pt]FC.north east)
arc(90:0:4pt) -- (FC.south east) arc(0:-135:4pt) -- cycle;
\end{tikzpicture}
\end{document}
Una solución más corta viene dada por
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{blkarray, bigstrut}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
\tikzmarknode{A11}{1} & -1 & 3 & -3 \\
-1 & 0 & -2 & 1 \\
2 & 2 & \tikzmarknode{A33}{4} & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\draw[red] plot[smooth cycle] coordinates {(A11.north)
(A33.north east) (A33.south) (A11.south west)};
\end{tikzpicture}
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
1 & -1 & 3 & -3 \\
\tikzmarknode{B21}{-1} & 0 & -2 & 1 \\
\tikzmarknode{B31}{2} & \tikzmarknode{B32}{2} & 4 & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\draw[red] plot[smooth cycle] coordinates {(B21.north west) (B21.north east)
(B32.north east) (B32.south east) (B31.south west)};
\end{tikzpicture}
\begin{center}
\begin{blockarray}{cccc}
\begin{block}{ [ ccc| c ]}
\bigstrut[t]
1 & \tikzmarknode{C12}{-1} & \tikzmarknode{C13}{3} & -3 \\
-1 & 0 & \tikzmarknode{C23}{-2} & 1 \\
2 & 2 & 4 & 0 \bigstrut[b] \\
\end{block}
\end{blockarray}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
\draw[red] plot[smooth cycle] coordinates {(C12.north west) (C13.north east)
(C23.south east) (C23.south west) (C12.south west)};
\end{tikzpicture}
\end{document}
Si se reemplaza todo \tikzmarknode
por \tikzmarknode[inner sep=1pt]
, esto se convierte en