# Trouble creating properly aligned matrix within a matrix

I'm trying to insert parentheses around a group of elements creating a matrix within a larger matrix. So far I have this:

$$\begin{bmatrix} \begin{matrix} 0 & 0 \\ 0 & \omega_0 \\ -\omega_0 & 0 \\ 0 & 0 \end{matrix} & \begin{matrix} -\frac{p_1}{2} & -\frac{p_2}{2} & 0 \\ 0 & 0 & \frac{p_2}{2} \\ -\frac{p_2}{2} & \frac{p_1}{2} & 0 \\ \end{matrix} \\ \begin{matrix} 0 & 0 \\ 0 & 0 \\ 0 & 0 \end{matrix} & \omega_0 \mathbf{I}^{-1} \begin{pmatrix} I_{yx} & (I_{yy} - I_{zz}) & 2 I_{yz} \\ (I_{zz} - I_{xx}) & -I_{xy} & -2 I_{xz} \\ -I_{yz} & I_{xz} & 0 \end{pmatrix} \end{bmatrix}$$


Basically, it's four smaller matrices combined into one larger one. However, the elements aren't aligned between these matrices. Sorry there's no picture, I don't have the reputation yet to include one.

\documentclass{article}
\usepackage{amsmath}
\usepackage{scalerel}
\begin{document}

Original:

$$\begin{bmatrix} \begin{matrix} 0 & 0 \\ 0 & \omega_0 \\ -\omega_0 & 0 \\ 0 & 0 \end{matrix} & \begin{matrix} -\frac{p_1}{2} & -\frac{p_2}{2} & 0 \\ 0 & 0 & \frac{p_2}{2} \\ -\frac{p_2}{2} & \frac{p_1}{2} & 0 \\ \end{matrix} \\ \begin{matrix} 0 & 0 \\ 0 & 0 \\ 0 & 0 \end{matrix} & \omega_0 \mathbf{I}^{-1} \begin{pmatrix} I_{yx} & (I_{yy} - I_{zz}) & 2 I_{yz} \\ (I_{zz} - I_{xx}) & -I_{xy} & -2 I_{xz} \\ -I_{yz} & I_{xz} & 0 \end{pmatrix} \end{bmatrix}$$

Revised:

\def\x{\begin{array}{c} x\\x\\x\end{array}}

$$\begin{bmatrix} \begin{array}{c} 0 \\ 0 \\ -\omega_0 \\ 0 \\0 \\0 \\0 \\ \end{array} & \begin{array}{c@{\hspace{0ex}}} 0 \\ \omega_0 \\ 0 \\ 0 \\0 \\0 \\0 \\ \end{array} & \begin{array}{@{\hspace{0ex}}c} \\ \\ \\ \\ \\ \omega_0 \mathbf{I}^{-1} \\ \\ \end{array} \begin{array}{@{\hspace{0ex}}c@{\hspace{0ex}}} \\ \\ \\ \\ \scalerel*[1.8ex]{(}{\x} \\ \end{array} & \begin{array}{@{\hspace{0ex}}c} -p_1/2 \\ 0 \\ -p_2/2 \\ \\ I_{yx} \\(I_{zz} - I_{xx}) \\ -I_{yz} \\ \end{array} & \begin{array}{c} -p_2/2 \\ 0 \\ p_1/2 \\ \\ (I_{yy} - I_{zz}) \\ -I_{xy} \\ -I_{xz} \\ \end{array} & \begin{array}{c@{\hspace{0ex}}} 0 \\p_2/2 \\ 0 \\ \\ 2I_{yz} \\ -2I_{xz} \\ 0 \\ \end{array} & \begin{array}{@{\hspace{0ex}}c@{\hspace{0ex}}} \\ \\ \\ \\ \scalerel*[1.8ex]{)}{\x} \\ \end{array} \end{bmatrix}$$

\end{document}


• As egreg pointed out, I am indeed missing a row in the top right quadrant, but the solution provided by Mr. Segletes should do the trick with a little modification! – user2236918 Apr 7 '13 at 16:12