# Aligning a variable in a matrix

I want to put a matrix in a matrix, more precisely what I wanna reach is basically this:

I'm using the pmatrix-environment. How can I do this?

Edit: Sorry, I wasn't precise - what I actually wanna do, is replacing the a's here by a matrix A which is aligned in the middle of the 4 rows and the 5 columns. The example above seems to be easier since the number of rows/columns of A_1 is odd.

$\begin{pmatrix} a & a & a & a & 1 \\ a & a & a & a & 2 \\ a & a & a & a & 3 \\ a & a & a & a & 4 \\ \end{pmatrix}$

• you should show what you tried, and if it has an error someone could fix, there doesn't seem to be anything special needed simply use \vdots & A_{1} as the third row, you may think of it as a nested matrix but TeX doesn't need to know that Jan 11, 2020 at 12:25
• The picture above is from a book, not from me. I didn't try anything because I don't know how.... but yes, your hint works, thanks. How would I do it if I wanted only one column (the right one) in the matrix and the A_1 to stand for a 4x4 matrix on the left of the column?
– ATW
Jan 11, 2020 at 12:30
• you could still have made a test document even if it just has a basic pmatrix, I am not sure I understand your second request but perhaps make the first row be * & \cdots & * then you can make the later row A_1 & &  so the A comes under the left * Jan 11, 2020 at 12:34
• I edited the question.
– ATW
Jan 11, 2020 at 12:43

Nest matrix inside pmatrix:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\begin{pmatrix} \alpha_{11} & \begin{matrix} * & \dots & * \end{matrix} \\ \begin{matrix} 0 \\ \vdots \\ 0 \end{matrix} & A_{11} \end{pmatrix}$

\end{document}


Like this?

With use of the nicematrix package:

\documentclass[margin=3mm]{standalone}
\usepackage{bm}
\usepackage[table]{xcolor}
\usepackage{nicematrix}

\begin{document}
$\begin{pNiceArray}{CCCC} \alpha_{11} & * & \dots & * \\ 0 & \Block{3-3}<\huge\bm>{A_1} & & \\ \vdots & & & \\ 0 & & & \end{pNiceArray}$
\end{document}


or

\documentclass[margin=3mm]{standalone}
\usepackage{bm}
\usepackage{nicematrix}

\begin{document}
$\begin{pNiceArray}{CCCC} \alpha_{11} & * & \Cdots & * \\ 0 & \Block{3-3}<\huge\bm>{A_1} & & \\ \Vdots & & & \\ 0 & & & \end{pNiceArray}$
\end{document}


Shoved result you will obtain after two compilation of above MWE.