如何对矩阵中的条目进行阴影处理?

如何对矩阵中的条目进行阴影处理?

我正在使用 overleaf,并试图对矩阵中的条目进行阴影处理,如下图所示:

在此处输入图片描述

这是我的作品,没有阴影。

在此处输入图片描述

有人可以帮忙吗?

这是我的代码:

\documentclass{article}

\usepackage[english]{babel}
\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{indentfirst}
\usepackage{tabularx}
\usepackage{bm}
\usepackage[colorlinks=true, allcolors=teal]{hyperref}
\usepackage[T1]{fontenc}

\begin{document}

\makeatother
\begin{tabularx}{0.9\linewidth}{l@{}c@{}X}
\textbf{2.3.6} & $\quad$ & \textbf{Inverse of a Matrix Using Its Adjoint} \\
& & If $A$ is an invertible matrix, then
\begin{equation}
A^{-1} = \frac{1}{\det(A)} \operatorname{adj}(A)
\end{equation}
\end{tabularx}

\begin{tabularx}{0.9\linewidth}{l@{}c@{}X}
\textbf{Proof} & $\quad$ & We show first that
$$A \operatorname{adj}(A) = \det(A) I$$
Consider the product
$$A \operatorname{adj}(A) = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} 
& a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & & \vdots \\ a_{i1} & a_{i2} & \cdots & 
a_{in} \\ \vdots & \vdots & & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \end{bmatrix} 
\begin{bmatrix} C_{11} & C_{21} & \cdots & C_{j1} & \cdots & C_{n1} \\ C_{12} & C_{22} & 
\cdots & C_{j2} & \cdots & C_{n2} \\ \vdots & \vdots & & \vdots & & \vdots \\ C_{1n} & 
C_{2n} & \cdots & C_{jn} & \cdots & C_{nn} \end{bmatrix}$$
The entry in the $i$th row and $j$th column of the product $A \operatorname{adj}(A)$ is
\begin{equation}
a_{i1} C_{j1} + a_{i2} + C_{j2} + \cdots + a_{in} C_{jn}
\end{equation}
(see the shaded lines above.) If $i = j$, then (12) is the cofactor expansion of 
$\det(A)$ along the $i$th row of $A$ (\textbf{Theorem 2.1.1}), and if $i \ne j$, then 
the $a$'s and the cofactors come from different rows of $A$, so the value of (12) is 
zero. Therefore,
\begin{equation}
A \operatorname{adj}(A) = \begin{bmatrix} \det(A) & 0 & \cdots & 0 \\ 0 & \det(A) & 
\cdots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \cdots & \det(A) \end{bmatrix} = 
\det(A) I
\end{equation}
Since $A$ is invertible and $\det(A) \ne 0$. Therefore, Equation (13) can be rewritten 
as
$$\frac{1}{\det(A)} [A \operatorname{A}] = I \quad \text{or} \quad A \left[ \frac{1} 
{\det(A)} \operatorname{adj}(A) \right] = I$$
Multiplying both sides on the left by $A^{-1}$ yields
$$A^{-1} = \frac{1}{\det(A)} \operatorname{adj}(A)$$
$\blacksquare$ \\
\end{tabularx}

\end{document}

这是我在这里的第一个问题。

答案1

nicematrix可以\CodeBefore通过指定左上角和右下角的单元格来为任何矩形区域添加阴影:

在此处输入图片描述

要为整行或整列着色,也可以使用\rowcolor{blue!15}{4}\columncolor{blue!15}{4}。您可以使用它来为多行/列着色,例如,\rowcolor{blue!15}{1,3-5}

\documentclass{article}

\usepackage{nicematrix}

\begin{document}

Consider the product
\[
A \operatorname{adj}(A) = 
\begin{bNiceMatrix}
\CodeBefore
  \rectanglecolor{blue!15}{4-1}{4-4}
\Body  
a_{11} & a_{12} & \cdots & a_{1n} \\ 
a_{21} & a_{22} & \cdots & a_{2n} \\ 
\vdots & \vdots & & \vdots \\ 
a_{i1} & a_{i2} & \cdots & a_{in} \\ \vdots & \vdots & & \vdots \\ 
a_{n1} & a_{n2} & \cdots & a_{nn} 
\end{bNiceMatrix} 
\begin{bNiceMatrix}
\CodeBefore
  \rectanglecolor{blue!15}{1-4}{4-4}
\Body 
C_{11} & C_{21} & \cdots & C_{j1} & \cdots & C_{n1} \\ 
C_{12} & C_{22} & 
\cdots & C_{j2} & \cdots & C_{n2} \\ 
\vdots & \vdots & & \vdots & & \vdots \\ 
C_{1n} & C_{2n} & \cdots & C_{jn} & \cdots & C_{nn} 
\end{bNiceMatrix}
\]

\end{document}

相关内容