答案1
两种变体。我必须使用一个\raisebox
通过反复试验调整的命令,因为blockarray
出于某种原因,环境似乎没有以数学轴为中心。块数组根本没有被提升(0pt
),但可选参数在这里可以欺骗 LaTeX,让它相信环境的内容比实际略高且深度较小:
\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}
\begin{document}
\[ A =
\begin{bmatrix}\raisebox{0pt}[\dimexpr\height + 1ex\relax][\dimexpr\depth- 2ex\relax]{$%
\begin{blockarray}{c c c c}
\begin{block}{[cc]cc}
1 & 2 & 0 & 0 \\
3 & 4 & 0 & 0\\
\end{block}
\begin{block}{cc[c] c}
0 & 0 & {\,3\,} & 0\\
\end{block}
\begin{block}{ccc[c]}
0 & 0 & 0 & \,4\, \\
\end{block}
\end{blockarray} $}\!
\end{bmatrix}
\]
\[ A =
\begin{bmatrix}\raisebox{0pt}[\dimexpr\height + 1ex\relax][\dimexpr\depth- 2ex\relax]{$%
\begin{blockarray}{c c c c}
\begin{block}{[cc\Right{]}{\hskip2.333em \raisebox{-0.4\height}[\height][\depth]{\rlap{\Large 0}}}cc}
1 & 2 & \\
3 & 4 &\\
\end{block}
\begin{block}{cc[c] c}
& & {\,3\,} & \\
\end{block}
\begin{block}{ccc[c]}
\BAmulticolumn{3}{c}{\raisebox{0.2\height}[\height][\depth]{\smash[t]{\llap{\Large 0}}\enspace }} & \,4\, \\
\end{block}
\end{blockarray} $}\!
\end{bmatrix}
\]
\end{document}
答案2
\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[
\left[\begin{blockarray}{cccc}
\begin{block}{[cc]cc}
1 & 2 & \cdot & \cdot\\
3 & 4 & \cdot & \cdot\\
\end{block}
\cdot & \cdot & [3] &\cdot\\
\cdot & \cdot & \cdot & [4]\\
\end{blockarray}\right]
\]
\end{document}
可以使用\circ
代替\cdot
。很好的包 blkarray!
答案3
与。{NiceMatrix}
nicematrix
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[\begin{NiceMatrix}
1 & 2 & 0 & 0 \\
3 & 4 & 0 & 0 \\
0 & 0 & 3 & 0 \\
0 & 0 & 0 & 4
\CodeAfter
\SubMatrix[{1-1}{2-2}]
\SubMatrix[{3-3}{3-3}]
\SubMatrix[{4-4}{4-4}]
\SubMatrix[{1-1}{4-4}][extra-height=2mm,xshift=3pt]
\end{NiceMatrix}\]
\end{document}