8

I've seen a lot on this website that has helped me get started, but I have one last problem: how do I align the 0s in the first row to the matrix below them?

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage [american]{babel}
\begin{document}
\begin{equation*}
\left[ 
\begin{array}{cc}
\begin{matrix}
0 
\end{matrix} & \begin{matrix}
0 & 0 & 0 
\end{matrix} \\
\begin{matrix}
0 \\
0 \\
0 \\
\end{matrix}
 & \begin{bmatrix}
n_1 & 0 & 0 \\
0 & n_2 & 0 \\
0 & 0 & n_3
\end{bmatrix}^{-1}
\end{array}\right]
\end{equation*}
\end{document}

2 Answers 2

3

How about manually adding the spacing?

\left[ 
  \begin{array}{cc}
  \begin{matrix}
0 
\end{matrix} & \begin{matrix}
~0~~ & 0~~ & 0~~  & \\ 
\end{matrix} \\
\begin{matrix}
0 \\
0 \\
0 \\
\end{matrix}
 & \begin{bmatrix}
n_1 & 0 & 0 \\
0 & n_2 & 0 \\
0 & 0 & n_3
\end{bmatrix}^{-1}
\end{array}\right]
1
  • I didn't know you could do this! Thank you! Dec 16, 2015 at 18:32
3

With {bNiceMatrix} of nicematrix (≥ 5.18 of 2021-07-15).

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$\begin{bNiceMatrix}[right-margin=1.5em]
0 & 0   & 0   & 0 \\
0 & n_1 & 0   & 0 \\
0 & 0   & n_2 & 0 \\
0 & 0   & 0   & n_3 
\CodeAfter
  \SubMatrix[{2-2}{4-4}]^{\!-1}
\end{bNiceMatrix}$

\end{document}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .