矩阵及其子矩阵突出显示

矩阵及其子矩阵突出显示

我必须突出显示从矩阵中移除的第 i 行和第 j 列,以形成矩阵的子式,如图所示在此处输入图片描述

我的尝试是这样的,但我不知道如何突出显示..

    \documentclass[preview, border=1pt, convert={outext=.png}]{standalone}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{braket}
\usepackage[table]{xcolor}
\newcommand\x{\times}
\newcommand\y{\cellcolor{green!10}}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{equation*}
    A = \det\left(\begin{array}{cccc}
    \rowcolor{red!20}
    a_{11}  & \ldots  & a_{1j} & \ldots & a_{1n} \\
    \ldots   & \ldots & \ldots & \ldots & \ldots \\
   \rowcolor{blue!20}
    a_{1j}  & \ldots   & a_{ij} & \ldots & a_{in} \\
    \ldots   & \ldots & \ldots & \ldots & \ldots \\
    a_{n1}  &  \ldots  & a_{nj} & \ldots & a_{nm}\\
  \end{array}\right)
\end{equation*}
\end{document}

答案1

tikzmark可以使用来声明东西节点,tikz您可以使用来在节点周围放置盒子,并eso-pic允许您在后台对其进行随机播放。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark,fit}
\usepackage{eso-pic}
\begin{document}
\[A = \det\left(\begin{array}{cccc} a_{11} & \tikzmarknode{a12}{a_{12}} & \ldots & a_{1n}  \\ 
    \tikzmarknode{a21}{a_{21}} & a_{22} & \ldots & \tikzmarknode{a2n}{a_{2n}}  \\
    \ldots & \ldots & \ldots & \ldots \\
    a_{n1} & \tikzmarknode{an2}{a_{n2}} & \ldots & a_{nn}  \\
    \end{array}\right)\]
\AddToShipoutPictureBG*{\begin{tikzpicture}[overlay,remember picture]
\node[fit=(a12) (an2),draw=red,fill=red,fill opacity=0.2]{};
\node[fit=(a21) (a2n),draw=blue,fill=blue,fill opacity=0.2]{};
\end{tikzpicture}}  

\end{document}

在此处输入图片描述

或者

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark,fit}
\usepackage{eso-pic}
\begin{document}
\[A = \det\begin{pmatrix} a_{11} & \cdots & \tikzmarknode{a1i}{a_{1i}} & \cdots & a_{1n}  \\ 
    \vdots & \ddots & \vdots & \reflectbox{$\ddots$} & \vdots \\
    \tikzmarknode{aj1}{a_{j1}} & \cdots & a_{ji} & \cdots & \tikzmarknode{ajn}{a_{jn}}  \\
    \vdots & \reflectbox{$\ddots$} & \ldots & \ddots & \vdots \\
    a_{n1} & \cdots &\tikzmarknode{ani}{a_{ni}} & \cdots & a_{nn}  \\
    \end{pmatrix}
\]
\AddToShipoutPictureBG*{\begin{tikzpicture}[overlay,remember picture]
\node[fit=(a1i) (ani),draw=red,fill=red,fill opacity=0.2]{};
\node[fit=(aj1) (ajn),draw=blue,fill=blue,fill opacity=0.2]{};
\end{tikzpicture}}      
\end{document}

在此处输入图片描述

如果你无法安装最新版本的tikzmark,你可以这样做

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{fit}
% overleaf
\newcommand{\tikzmarknode}[3][]{\ifmmode%
\tikz[remember picture,baseline=(#2.base)]{\node[inner sep=0pt,#1](#2){$#3$};}%
\else%
\tikz[remember picture,baseline=(#2.base)]{\node[inner sep=0pt,#1](#2){#3};}%
\fi}
\usepackage{eso-pic}
\begin{document}
\[A = \det\begin{pmatrix} a_{11} & \cdots & \tikzmarknode{a1i}{a_{1i}} & \cdots & a_{1n}  \\ 
    \vdots & \ddots & \vdots & \reflectbox{$\ddots$} & \vdots \\
    \tikzmarknode{aj1}{a_{j1}} & \cdots & a_{ji} & \cdots & \tikzmarknode{ajn}{a_{jn}}  \\
    \vdots & \reflectbox{$\ddots$} & \ldots & \ddots & \vdots \\
    a_{n1} & \cdots &\tikzmarknode{ani}{a_{ni}} & \cdots & a_{nn}  \\
    \end{pmatrix}
\]
\AddToShipoutPictureBG*{\begin{tikzpicture}[overlay,remember picture]
\node[fit=(a1i) (ani),draw=red,fill=red,fill opacity=0.2]{};
\node[fit=(aj1) (ajn),draw=blue,fill=blue,fill opacity=0.2]{};
\end{tikzpicture}}      
\end{document}

相关内容