# 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.

• Welcome to TeX.sx! :). As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. Apr 2, 2013 at 16:30
• Are seven rows on the left side and only six on the right side correct? Apr 2, 2013 at 16:42
• Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. Apr 2, 2013 at 16:50

\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! Apr 7, 2013 at 16:12