[Tex/LaTex] Why doesn’t \begin{center} center the LaTeX

horizontal alignmentmath-mode

Why doesn't this print out centered?

\begin{center}
    \begin{pmatrix}\mu_{G_i, S}\\
    \mu_{G_j, S}
    \end{pmatrix} &\sim  N
    \begin{bmatrix}
    \begin{pmatrix}
    0\\
    0
    \end{pmatrix}\!\!,&
    \begin{pmatrix}
    1 & \rho \\
    \rho & 1
    \end{pmatrix}
    \end{bmatrix}  
\end{center}

Best Answer

Your input is erroneous. The pmatrix and bmatrix environments require math-mode, which the center environment doesn't provide. The output shows an off-center (left-aligned) equation, which happens as a result of TeX trying to fix the mistake by inserting an inline math-mode switch $.

Here's probably what you're after:

enter image description here

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

\[
  \begin{pmatrix}
    \mu_{G_i, S} \\
    \mu_{G_j, S}
  \end{pmatrix}
  \sim  N
  \begin{bmatrix}
    \begin{pmatrix}
    0 \\
    0
    \end{pmatrix}, &
    \begin{pmatrix}
    1 & \rho \\
    \rho & 1
    \end{pmatrix}
  \end{bmatrix}  
\]

\end{document}

\[...\] marks a display math equation, with content horizontally centred.