\begin{equation*}
U^{k} = \begin{tikzpicture}
\matrix [matrix of math nodes,left delimiter=(,right delimiter=)] (m)
{
z^{k} & 0 & \cdots & s z^{0} & s z^{1} & \cdots & s z^{k-2} & s z^{k-1} \\
z^{k-1} s & \vdots& & -\overline{z} & s^{2} z^{0} & \cdots & s^{2} z^{k-3} & s^{2} z^{k-2} \\
z^{k-2} s & & & & -\overline{z} & s^{2} z^{0} & \cdots & s^{2} z^{k-3} \\
\vdots & & & & & \ddots & \ddots & \vdots \\
z s & \vdots& & & 0 & & -\overline{z} & s^{2} z^{0} \\
s & 0 & \cdots & & & & & -\overline{z} \\
0 & 1 & & 0 & & & & \\
\vdots & & \ddots & & & & 0 & \\
0 & 0 & & 1 & & & & \\
};
\draw (m-2-4.north west) rectangle (m-6-8.south east);
\draw (m-7-2.north west) rectangle (m-9-4.south east);
\end{tikzpicture}
\end{equation*}
这是我的代码和结果
一个矩形太小了。有什么想法吗?并在中间加上“U^k=”?
答案1
要带到U^k=
中间,[baseline={(m.center)}]
请使用选项\begin{tikzpicture}
。要使矩形更大,请(m-6-8.south east-|m-2-8.north east)
使用
\draw (m-2-4.north west) rectangle (m-6-8.south east-|m-2-8.north east);
意思是与 的x
坐标相同m-2-8.north east
并且y
与 的坐标相同m-6-8.south east
。
代码:
\documentclass{article}
\usepackage{tikz,amsmath}
\usetikzlibrary{matrix}
\begin{document}
\begin{equation*}
U^{k} = \begin{tikzpicture}[baseline={(m.center)}]
\matrix [matrix of math nodes,left delimiter=(,right delimiter=)] (m)
{
z^{k} & 0 & \cdots & s z^{0} & s z^{1} & \cdots & s z^{k-2} & s z^{k-1} \\
z^{k-1} s & \vdots& & -\overline{z} & s^{2} z^{0} & \cdots & s^{2} z^{k-3} & s^{2} z^{k-2} \\
z^{k-2} s & & & & -\overline{z} & s^{2} z^{0} & \cdots & s^{2} z^{k-3} \\
\vdots & & & & & \ddots & \ddots & \vdots \\
z s & \vdots& & & 0 & & -\overline{z} & s^{2} z^{0} \\
s & 0 & \cdots & & & & & -\overline{z} \\
0 & 1 & & 0 & & & & \\
\vdots & & \ddots & & & & 0 & \\
0 & 0 & & 1 & & & & \\
};
\draw (m-2-4.north west) rectangle (m-6-8.south east-|m-2-8.north east);
\draw (m-7-2.north west) rectangle (m-9-4.south east);
\end{tikzpicture}
\end{equation*}
\end{document}
答案2
我发现easy
CTAN 中的捆绑包,这是一个很好的测试问题easybmat
包裹。
和往常一样,您需要知道列数和行数。可以为行和列选择不同的对齐方式 (l、c、r)。并且可以在元素之间绘制路径。
\documentclass{article}
\usepackage{amsmath}
\usepackage{easybmat}
\begin{document}
\begin{equation*}
U^{k} = \left(\begin{BMAT}{cccccccc}{ccccccccc}
z^{k} & 0 & \cdots & s z^{0} & s z^{1} & \cdots & s z^{k-2} & s z^{k-1} \\
z^{k-1} s & \vdots& & -\overline{z} & s^{2} z^{0} & \cdots & s^{2} z^{k-3} & s^{2} z^{k-2} \\
z^{k-2} s & & & & -\overline{z} & s^{2} z^{0} & \cdots & s^{2} z^{k-3} \\
\vdots & & & & & \ddots & \ddots & \vdots \\
z s & \vdots& & & 0 & & -\overline{z} & s^{2} z^{0} \\
s & 0 & \cdots & & & & & -\overline{z} \\
0 & 1 & & 0 & & & & \\
\vdots & & \ddots & & & & 0 & \\
0 & 0 & & 1 & & & &
\addpath{(1,0,0)rrruuulllddd}
\addpath{(3,3,0)rrrrruuuuulllllddddd}
\end{BMAT}\right)
\end{equation*}
\end{document}