我想突出显示矩阵中的某些元素,并用箭头将它们链接到矩阵侧给出的定义(如下图所示)。我知道使用 TikZ 可以突出显示矩阵中的元素,但是是否可以在侧面使用框、箭头和文本(数学符号)?最简单的方法是什么?不使用 TikZ 可以做到这一点吗?
这是我目前的代码:
\documentclass[twocolumn]{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\begin{document}
\begin{eqnarray}
\mathbf{N} &=& \begin{pmatrix}
n_{11} & 0 & n_{13} & n_{14} \\
n_{21} & n_{22} & n_{23} & n_{24} \\
n_{31} & n_{32} & n_{33} & 0 \\
n_{41} & n_{42} & n_{43} & n_{44}
\end{pmatrix}\\
&=& \begin{pmatrix}
\sqrt{\beta_x} & 0 & n_{13} & n_{14} \\
-\frac{\alpha_x}{\sqrt{\beta_x}} & n_{22} & n_{23} & n_{24} \\
n_{31} & n_{32} & \sqrt{\beta_y} & 0 \\
n_{41} & n_{42} & -\frac{\alpha_y}{\sqrt{\beta_y}} & n_{44}
\end{pmatrix}
\end{eqnarray}
\end{document}
感谢您的帮助!
答案1
这是用 TikZ 做的,请原谅我。
问题在于您要绘制的内容对于双列文档中的一列来说太大。
这里有两种可能的解决方案:在一列中,描述的位置不同,或者在两列中。
\documentclass[twocolumn]{article}
\usepackage{mwe}% <--- for testing purpose only
\usepackage{cuted}
\usepackage{tikz}
\usetikzlibrary{matrix, fit}
\usetikzlibrary{arrows.meta}
\tikzset{mymatrixstyle/.style={matrix of math nodes,
ampersand replacement=\&,
left delimiter=(,
right delimiter=),
inner sep=0pt,
outer sep=0pt,
row sep=2pt, column sep=10pt},
myarrow/.style={-{Straight Barb[angle=60:3pt 3]}}}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\begin{document}
\blindtext % <--- for testing purpose only
In one column:
%\begin{eqnarray} see https://tex.stackexchange.com/a/197/101651
\begin{align}
\mathbf{N} &= \begin{pmatrix}
n_{11} & 0 & n_{13} & n_{14} \\
n_{21} & n_{22} & n_{23} & n_{24} \\
n_{31} & n_{32} & n_{33} & 0 \\
n_{41} & n_{42} & n_{43} & n_{44}
\end{pmatrix}\\
&= \begin{tikzpicture}[baseline]
\matrix[mymatrixstyle] (mymatr) {
\sqrt{\beta_x} \& 0 \& n_{13} \& n_{14} \&[-7pt]\\
-\dfrac{\alpha_x}{\sqrt{\beta_x}} \& n_{22} \& n_{23} \& n_{24} \\
n_{31} \& n_{32} \& \sqrt{\beta_y} \& 0 \\
n_{41} \& n_{42} \& -\dfrac{\alpha_y}{\sqrt{\beta_y}} \& n_{44}\\};
\node[draw, fit=(mymatr-3-1)(mymatr-3-2)] (n3132) {};
\node[draw, fit=(mymatr-4-1)(mymatr-4-2)] (n4142) {};
\node[draw, fit=(mymatr-1-3)(mymatr-1-4)] (n1314) {};
\node[draw, fit=(mymatr-2-3)(mymatr-2-4)] (n2324) {};
\draw[myarrow, overlay] (n3132) -- ++(-1.8,0) -| +(0,-1.6) node[anchor=north] {$\zeta_y=n_{31}+in_{32}$};
\draw[myarrow] (n4142) -- +(0,-1.8) node[anchor=north] {$\tilde{\zeta}_y=n_{41}-in_{42}$};
\draw[myarrow, overlay] (n1314) -- ++(2,0) -| +(0,-3.6) node[anchor=20] {$\zeta_y=n_{13}-in_{14}$};
\draw[myarrow, overlay] (n2324) -- ++(1.4,0) -| +(0,-2.1) node[anchor=20] {$\tilde{\zeta}_y=n_{23}-in_{24}$};
\end{tikzpicture}
\end{align}
\blindtext[7] % <--- for testing purpose only
In two columns:
\begin{strip}
\begin{align}
\mathbf{N} &= \begin{pmatrix}
n_{11} & 0 & n_{13} & n_{14} \\
n_{21} & n_{22} & n_{23} & n_{24} \\
n_{31} & n_{32} & n_{33} & 0 \\
n_{41} & n_{42} & n_{43} & n_{44}
\end{pmatrix}\\
&= \begin{tikzpicture}[baseline]
\matrix[mymatrixstyle] (mymatr) {
\sqrt{\beta_x} \& 0 \& n_{13} \& n_{14} \&[-7pt]\\
-\dfrac{\alpha_x}{\sqrt{\beta_x}} \& n_{22} \& n_{23} \& n_{24} \\
n_{31} \& n_{32} \& \sqrt{\beta_y} \& 0 \\
n_{41} \& n_{42} \& -\dfrac{\alpha_y}{\sqrt{\beta_y}} \& n_{44}\\};
\node[draw, fit=(mymatr-3-1)(mymatr-3-2)] (n3132) {};
\node[draw, fit=(mymatr-4-1)(mymatr-4-2)] (n4142) {};
\node[draw, fit=(mymatr-1-3)(mymatr-1-4)] (n1314) {};
\node[draw, fit=(mymatr-2-3)(mymatr-2-4)] (n2324) {};
\draw[myarrow, overlay] (n3132) -- +(-1.8,0) node[anchor=east] {$\zeta_y=n_{31}+in_{32}$};
\draw[myarrow, overlay] (n4142) -- +(-1.8,0) node[anchor=east] {$\tilde{\zeta}_y=n_{41}-in_{42}$};
\draw[myarrow, overlay] (n1314) -- +(1.8,0) node[anchor=west] {$\zeta_y=n_{13}-in_{14}$};
\draw[myarrow, overlay] (n2324) -- +(1.8,0) node[anchor=west] {$\tilde{\zeta}_y=n_{23}-in_{24}$};
\end{tikzpicture}
\end{align}
\end{strip}
\blindtext[7] % <--- for testing purpose only
\end{document}
题外话:不要使用eqnarray
,原因请参见此处:https://tex.stackexchange.com/a/197/101651