I want to create a block matrix of this form:
But Block A should be a diagonal matrix with 1 on the diagonal, the other blocks should be B, C and D like in the picture. But the size of each block should be equal.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI want to create a block matrix of this form:
But Block A should be a diagonal matrix with 1 on the diagonal, the other blocks should be B, C and D like in the picture. But the size of each block should be equal.
If you put A in a box you can use its size in the other three quadrants:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\sbox0{$\begin{matrix}1&2&3\\0&1&1\\0&0&1\end{matrix}$}
%
C=\left[
\begin{array}{c|c}
\usebox{0}&\makebox[\wd0]{\large $B$}\\
\hline
\vphantom{\usebox{0}}\makebox[\wd0]{\large $C$}&\makebox[\wd0]{\large $D$}
\end{array}
\right]
\]
\end{document}
Here is a solution with {bNiceArray}
of nicematrix
.
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
$M =
\begin{bNiceArray}{ccc|ccc}[margin,columns-width=auto]
1 & 2 & 3 & \Block{3-3}<\Large>{B} & & \\
0 & 1 & 1 \\
0 & 0 & 1 \\
\hline
\Block{3-3}<\Large>{C}
& & & \Block{3-3}<\Large>{D} & & \\
\\
\\
\end{bNiceArray}$
\end{document}