我正在尝试让它在 Latex 中工作,这是我正在寻找的输出:
这是我目前拥有的代码,但我没有得到我想要的:
\documentclass{article}
\usepackage{amsmath,mathrsfs}
\usepackage[usenames, dvipsnames,svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{intersections, decorations.pathreplacing,shapes,shapes.geometric,hobby,patterns,babel,matrix,calc}
\DeclareMathOperator{\Mat}{Mat}
\begin{document}
\begin{tikzpicture}[
decoration = {
brace,amplitude=5pt},
baseline = (current bounding box.west),
strip/.style = {
draw=MediumPurple,%color
line width=1.1em, opacity=0.4,
line cap=round ,% only if you like them ...
},
stripp/.style = {
draw=LightSkyBlue,%color
line width=1.8em, opacity=0.4,
line cap=round ,% only if you like them ...
},
]
\matrix (mtrxx) [matrix of math nodes,left delimiter=(,right delimiter=),
column sep=.5em,
nodes={text height=2ex,text width=1.5ex}]
{
1 & 2 \\
3 & 4 \\
5 & 6 \\
};
\begin{scope}[xshift = 6cm]
\matrix (mtrxz) [matrix of math nodes,left delimiter=(,right delimiter=),
column sep=.5em,
nodes={text height=2ex,text width=1.5ex}]
{
-1 & 2 & 0 & 3 \\
1 & 0 & 4 & -1 \\
};
\end{scope}
\begin{scope}[yshift=-2cm]
\matrix {mtrxi} [matrix of math nodes,left delimiter=(,right delimiter=),
column sep=.5em,
nodes={text height=2ex,text width=1.5ex}]
{
$3 \times 2$ & & & & & & & & & $2 \times 4$ \\
};
\end{scope}
\node[color=black] at ([shift={(-12mm,-3mm)}]mtrxx-2-1.north) {$A =$};
\node[color=black] at ([shift={(-12mm,0mm)}]mtrxz-2-1.north) {$B =$};
\end{tikzpicture} \\
\end{document}
任何帮助将不胜感激。
答案1
这里有一个提议,矩阵以无聊的标准方式生成,然后用 Ti 注释钾Z.为此,\tikznode
\tikzmarknode
被使用,希望在不久的将来,当tikzmark
这个命令扩展库时,它将被取代。
\documentclass{article}
\usepackage{amsmath,mathrsfs}
\usepackage[usenames, dvipsnames,svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newcommand{\tikznode}[2]{% from https://tex.stackexchange.com/a/402466/121799
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};%
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\DeclareMathOperator{\Mat}{Mat}
\begin{document}
\begin{align*}
A=&\begin{pmatrix}
1 & 2 \\
3 & 4 \\
\tikznode{5}{5} & \tikznode{6}{6} \\
\end{pmatrix}
&
B=&
\begin{pmatrix}
-1 & 2 & 0 & 3 \\
\tikznode{1}{1} & 0 & 4 & \tikznode{m1}{-1} \\
\end{pmatrix} \\[1cm]
\begin{tikzpicture}[overlay,remember picture]
\draw[latex-latex] ([yshift=-3pt]5.south) -- ([yshift=-3pt]6.south)
node[midway,below](dimA){$3\times2$};
\draw[latex-latex] ([yshift=-3pt]1.south) -- ([yshift=-3pt]m1.south)
node[midway,below](dimB){$2\times4$};
\draw[latex-latex] ([xshift=-6pt]dimA.south east) -- ++(0,-0.3) -|
([xshift=6pt]dimB.south west);
\end{tikzpicture}
=&\begin{pmatrix}
\bullet & \bullet & \bullet & \bullet \\
\bullet & \bullet & \bullet & \bullet \\
\bullet & \bullet & \bullet & \bullet \\
\bullet & \bullet & \tikznode{24}{24} & \bullet \\
\end{pmatrix}
&&%\begin{array}{r@{}l}
\tikznode{AB}{$(AB)_{33}$}%&
=\begin{pmatrix} \tikznode{5p}{5} & \tikznode{6p}{6}
\end{pmatrix} \begin{pmatrix} 0\\\tikznode{4p}{4}\end{pmatrix} %\\
%&
=6\cdot0+6\cdot4=\tikznode{24p}{24}
%\end{array}
\begin{tikzpicture}[overlay,remember picture]
\draw[latex-latex] (24) to[out=-30,in=-150] (AB);
\path (5p.south) -- (6p.south) coordinate[midway] (aux);
\draw[latex-] (4p.south) to[out=-90,in=90] ++ (0.5,-1) node[below right](B3){3rd column of $B$};
\draw[latex-] (aux) to[out=-90,in=90] ++ (-0.5,-1) node[below left](A3){3rd row of $A$};
\end{tikzpicture} \\[0.5cm]
\end{align*}
Some more text.
\end{document}