我曾尝试blockarray
过
\begin{align*}
B=
\left[\begin{blockarray}{ccccc}
a_{s_0} & a_{s_0+1} & \cdots &\cdots &a_{s_0+n}\\
%\begin{blockarray}{cccccc}
%\begin{block}{ccccc|c}
\begin{block}{cccc|c}
\cline{1-4}
a_{s_0+1} & a_{s_0+2}&\cdots &\cdots &a_{s_0+n+1}\\
\vdots & \vdots & & & \\
0 & 0 &\cdots & 0 & b \\
\vdots & \vdots & & & \\
a_{s_0+n} &a_{s_0+n+1} &\cdots &\cdots & a_{s_0+2n}\\
%\end{block}
%\end{blockarray}
\end{block}
\end{blockarray}\right]
\end{align*}
但我无法处理垂直线。
答案1
你真的不需blkarray
要这样做:普通的array
就可以了:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
B=
\left[\begin{array}{c|ccc|c}
a_{s_0} & a_{s_0+1} & \cdots & \multicolumn{1}{c}{\cdots} &a_{s_0+n}\\
\cline{1-4}
a_{s_0+1} & a_{s_0+2}&\cdots &\cdots &a_{s_0+n+1}\\
\vdots & \vdots & & & \vdots \\
0 & 0 &\cdots & 0 & b \\
\vdots & \vdots & & & \vdots \\
\cline{2-5}
\multicolumn{1}{c}{a_{s_0+n}} &a_{s_0+n+1} &\cdots &\cdots & a_{s_0+2n}\\
\end{array}\right]
\end{align*}
\end{document}
答案2
这是使用 Ti 的解决方案钾Z:
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
$B$ = \begin{tikzpicture}[baseline=(current bounding box.center)]
\matrix [matrix of math nodes,
nodes in empty cells,
left delimiter = [,right delimiter={]},
align = center,
text width = 2.5em,
text depth = 0.25em,
](m){
a_{s_0+1} & a_{s_0+2}&\cdots &\cdots &a_{s_0+n+1}\\
\vdots & \vdots & & & \\
0 & 0 &\cdots & 0 & b \\
\vdots & \vdots & & & \\
a_{s_0+n} &a_{s_0+n+1} &\cdots &\cdots & a_{s_0+2n}\\
};
% Drawing the lines
\draw[draw, thick] (m-1-1.north east) -- (m-4-1.south east); % Left vertical
\draw[draw, thick] (m-1-4.south east) -- (m-5-4.south east); % Right vertical
\draw[draw, thick] (m-1-1.south west) -- (m-1-4.south east); % Upper horizontal
\draw[draw, thick] (m-4-1.south east) -- (m-4-5.south east); % Lower horizontal
\end{tikzpicture}
\end{document}