2x2行列を5x5行列に挿入する

2x2行列を5x5行列に挿入する

5x5 行列の 4 行目と 5 行目、および 4 列目と 5 列目に 2x2 行列を均等に挿入する必要があります。コードを調整する必要があります。

\begin{equation*}
    a_1=
    \begin{bmatrix}
        1 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & & {\begin{bmatrix} & b & \end{bmatrix}}\\
        0 & 0 & 0 &
    \end{bmatrix}
\end{equation*}

答え1

あるいは、 を使うかもしれませんnicematrix。追加のパッケージが必要です(これにより、他のもの、特にTiがロードされます)。Z) であっても、列間の間隔は変更されず、外観のすべての側面を完全に制御できます。

\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\begin{document}
\begin{equation*} 
a_1=\begin{bNiceMatrix}[name=mymatrix]
        1 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & 0 & 0\\
        0 & 0 & 0 & \phantom{0} & \phantom{0}\\
        0 & 0 & 0 & \phantom{0} & \phantom{0}
\end{bNiceMatrix}
\begin{tikzpicture}[remember picture,overlay]
\node[fit=(mymatrix-4-4)(mymatrix-5-5),inner sep=-0.2ex,text height=1.2em] (f){$b$};
\draw[thick] ([xshift=0.5ex]f.south west)-| (f.north west) -- ++ (0.5ex,0)
([xshift=-0.5ex]f.south east)-| (f.north east) -- ++ (-0.5ex,0);
\end{tikzpicture}
\end{equation*}
\end{document}

ここに画像の説明を入力してください

答え2

bmatrix2x2 マトリックスの代わりにを使用しましたmatrix。ただし、これは個人的な好みであり、問​​題なく交換できます。

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
    a_1=
    \begin{bmatrix}
        \begin{matrix}  
            1 & 0 & 0\\ 
            0 & 0 & 0 \\
            0 & 0 & 0
        \end{matrix} & 
        \begin{matrix} 
            0 & 0\\
            0 & 0 \\
            0 & 0
        \end{matrix}\\
        \begin{matrix}
            0 & 0 & 0\\
            0 & 0 & 0
        \end{matrix} & 
        \begin{matrix} & b & \end{matrix}\\
    \end{bmatrix}
\end{equation*}

\end{document}

結果matrix:

マトリックス

結果bmatrix:

bマトリックス

答え3

解決策blkarray:

\documentclass{article}
\usepackage{multirow}
\usepackage{blkarray, bigstrut}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
    a_1=
  \left[
   \begin{blockarray}{@{\,}ccccc@{\:}}
\bigstrut[t]
           1 & 0 & 0 & 0 & 0 & \\
            0 & 0 & 0 & 0 & 0 & \\
            0 & 0 & 0 & 0 & 0 & \\
        \begin{block}{@{\,}ccc[\BAmulticolumn{2}{!{}c!{}}@{\:}]}
            0 & 0 & 0 & \multirow{2}{*}{b}\\
           0 & 0 & 0 & \\
        \end{block}
\BAnoalign{\vskip -7ex}
    \end{blockarray}\right]
\end{equation*}

\end{document} 

ここに画像の説明を入力してください

関連情報