Why doesn't \begin{center} center my LaTeX?

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}


migrated from stackoverflow.comDec 18 '14 at 1:25

This question came from our site for professional and enthusiast programmers.

• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Dec 18 '14 at 3:21

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:

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