非常特别的 Sarrus

非常特别的 Sarrus

我对这个 tex-code 有疑问。

我的主要目标是让公式类似$...$,在 s 的中心对齐tikzpicture。此外,我希望tikzpicture第二部分的 有 ,pink-$\impliedby$并带有附近的文本“减去这些产品”和“添加这些产品”,文本的写法如下: pink-$\impliedby$减去这些产品

pink-$\impliedby$添加这些产品

请注意,我故意走到了头部。

我还希望我想要计算行列式的矩阵像这样排列:[r]。

我用的是 stix!

代码:


\documentclass{article}
\usepackage{stix}
\usepackage{tikz-cd}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{extarrows}
\usepackage{cancel}
\usepackage{xcolor}
\usepackage{tcolorbox}
\usepackage[customcolors,shade]{hf-tikz}
\usepackage{nicematrix}
\usepackage{diagbox}
\usetikzlibrary{calc,matrix}

\begin{document}

\subsection{Sarrus}

\begin{tikzpicture}[>=stealth]
    \matrix [%
      matrix of math nodes,
      column sep=1em,
      row sep=1em
    ] (sarrus) {%
      %\pAutoNiceMatrix{3-3}{\Block[l]{}{a_{\arabic{iRow},\arabic{jCol}}}}
      a_{1,1} & a_{1,2} & a_{1,3} & a_{1,1} & a_{1,2} \\
      a_{2,1} & a_{2,2} & a_{2,3} & a_{2,1} & a_{2,2} \\
      a_{3,1} & a_{3,2} & a_{3,3} & a_{3,1} & a_{3,2} \\
    };
    \path ($(sarrus-1-1.north west)-(0.5em,0)$) edge ($(sarrus-3-1.south west)-(0.5em,0)$)
          ($(sarrus-1-3.north east)+(0.5em,0)$) edge ($(sarrus-3-3.south east)+(0.5em,0)$)
          (sarrus-1-1)                          edge            (sarrus-2-2)
          (sarrus-2-2)                          edge[->]        (sarrus-3-3)
          (sarrus-1-2)                          edge            (sarrus-2-3)
          (sarrus-2-3)                          edge[->]        (sarrus-3-4)
          (sarrus-1-3)                          edge            (sarrus-2-4)
          (sarrus-2-4)                          edge[->]        (sarrus-3-5)
          (sarrus-3-1)                          edge[dashed]    (sarrus-2-2)
          (sarrus-2-2)                          edge[->,dashed] (sarrus-1-3)
          (sarrus-3-2)                          edge[dashed]    (sarrus-2-3)
          (sarrus-2-3)                          edge[->,dashed] (sarrus-1-4)
          (sarrus-3-3)                          edge[dashed]    (sarrus-2-4)
          (sarrus-2-4)                          edge[->,dashed] (sarrus-1-5);
    \foreach \c in {1,2,3} {\node[anchor=south] at (sarrus-1-\c.north) {$+$};};
    \foreach \c in {1,2,3} {\node[anchor=north] at (sarrus-3-\c.south) {$-$};};
  \end{tikzpicture}, if Matrix $A=\begin{pmatrix*}[r]0&2&1\\3&-1&2\\4&-4&1\end{pmatrix*}$, we have:\\
\begin{tikzpicture}
 \edef\lstadd{{0,16,-12}}
 \edef\lstsub{{-4,0,6}}
 \matrix[matrix of math nodes,nodes={text width=1.5em}] (mat)
 {
    0 & 2 & 1 & 0 & 2 \\
    3 & -1 & 2 & 3 & -1\\
    4 & -4 & 1 & 4 & -4\\
 };
 \foreach \X [evaluate=\X as \Y using {int(\X+2)}]in {1,2,3}
 {\pgfmathtruncatemacro{\mylabel}{\lstadd[\X-1]}
 \draw[purple,-latex,thick] (mat-1-\X.north west) -- (mat-3-\Y.south east)
 node[pos=1.1]{\mylabel};
 \pgfmathtruncatemacro{\mylabel}{\lstsub[\X-1]}
 \draw[purple,-latex,thick] (mat-3-\X.south west) -- (mat-1-\Y.north east)
 node[pos=1.1]{\mylabel};
 }
\end{tikzpicture} $\implies$
\begin{tikzpicture}
 \edef\lstadd{{0,16,-12}}
 \edef\lstsub{{-4,0,6}}
 \matrix[matrix of math nodes,nodes={text width=1.5em}] (mat)
 {
    0 & 2 & 1 & 0 & 2 \\
    3 & -1 & 2 & 3 & -1\\
    4 & -4 & 1 & 4 & -4\\
 };
 \foreach \X [evaluate=\X as \Y using {int(\X+2)}]in {1,2,3}
 {\pgfmathtruncatemacro{\mylabel}{\lstadd[\X-1]}
 \draw[purple,-latex,thick] (mat-1-\X.north west) -- (mat-3-\Y.south east)
 node[pos=1.1] (LL-\X) {\mylabel};
 \pgfmathtruncatemacro{\mylabel}{\lstsub[\X-1]}
 \draw[purple,-latex,thick] (mat-3-\X.south west) -- (mat-1-\Y.north east)
 node[pos=1.1] (LU-\X) {\mylabel};
 }
 \draw[line width=1mm,purple,latex-,shorten >=1cm,shorten <=1cm]
 (LU-3.east) -- ++ (3,0) node[right] {Subtract these products};
 \draw[line width=1mm,purple,latex-,shorten >=1cm,shorten <=1cm]
 (LL-3.east-|LU-3.east) -- ++ (3,0) node[right] {Add these products};
\end{tikzpicture}

\end{document}

打扰一下,我总是遇到这个问题:我该如何编译我所写的内容~

感谢您的帮助!

相关内容