![围绕矩阵元素绘制一个矩形](https://linux22.com/image/355318/%E5%9B%B4%E7%BB%95%E7%9F%A9%E9%98%B5%E5%85%83%E7%B4%A0%E7%BB%98%E5%88%B6%E4%B8%80%E4%B8%AA%E7%9F%A9%E5%BD%A2.png)
答案1
您可以使用tikz matrix
:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning, fit}
\begin{document}
\begin{equation}
\begin{tikzpicture}[baseline=-1ex]
\matrix[%
matrix of math nodes,
nodes in empty cells,
left delimiter={[},right delimiter={]},
inner xsep=2pt, column sep=8pt,
] (m)
{%
\mathbf {c_0}& & & \\
&\mathbf {c_1 }& & \\[-8pt]
& & \ddots & \\
&& &\mathbf {c_{r-1}} \\[4pt]
&& &\\
};
\node[font=\scriptsize, above right= -5pt and 4pt of m.south east] {$(n+1)(r+1)\times4r$};
\node[rectangle, draw, fit={(m-1-1) (m-2-1)}, inner sep=0pt, text width=22pt] {};
\node[rectangle, draw, fit={(m-2-2) (m-3-2)}, inner sep=0pt, text width=22pt] {};
\node[rectangle, draw, fit={(m-4-4) (m-5-4)}, inner sep=0pt, text width=22pt] {};
\end{tikzpicture}
\end{equation}
\end{document}