ぱるちのものおき2.0

主にLaTeXや数学のお話をするブログです。

TikZでサラス

ただただLaTeXのTikZを用いてサラスの規則を書いてみようというもの。なお齋藤正彦先生の『線形代数入門』にある図を参考にして作成しました。

f:id:f_d0123:20200624144321p:plain
こんな感じ。
ソースコードは以下。

\begin{tikzpicture}
    \foreach \i in {1,2,3}
        \foreach \j in {1,2,3}
            \node (\i\j) at (\j,-\i) {$a_{\i\j}$};
    \draw (11.north west)--(31.south west) (13.north east)--(33.south east);
    \draw[color=red] (11)--(22)--(33);
    \begin{scope}[rounded corners=1cm,color=red]
        \draw (13)--(5,-3)--(3.5,-4.5)--(32)--(21);
        \draw (12)--(23)--(4,-3)--(2.5,-4.5)--(31);
    \end{scope}
    \draw[dashed,color=blue] (13)--(22)--(31);
    \begin{scope}[dashed,rounded corners=1cm,color=blue]
        \draw (11)--(-1,-3)--(0.5,-4.5)--(32)--(23);
        \draw (12)--(21)--(0,-3)--(1.5,-4.5)--(33);
    \end{scope}
\end{tikzpicture}

それだけ。