Edit: Based on @Clara's answer I've been able to get close to the solution I want. The new code is appended and I've added the output, now that I get output! But there are still issues -- see after the new code.
Original Question:
I've used inline mathmode ($, $) without any problems inside a tikzpicture environment in nodes, but the following code gives a 'missing $' error:
\documentclass[11pt,reqno]{amsbook}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\[
X = \left[ \begin{matrix} X_1 \\ X_2 \\ \ldots \\ X_n \end{matrix} \right],
\]
\end{tikzpicture}
\end{document}
The expression inside the tikz environment compiles fine outside it. What am I missing?
In the interest of full disclosure I'm trying to put three expressions side by side. I figured if I put them in three stacked tikzpictures it would do the job, but then I ran into this problem. Perhaps there's a more elegant way to achieve my goal, and I'm open to that, but I'd also like to know (for the future) what's wrong with the above. BTW, based on a post here I tried putting the tikzpicture inside the \[, \] but that didn't help.
New code:
\documentclass[11pt,reqno]{amsbook}%
%
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\begin{document}
\[
f_\mathbf{X}= \frac{1}{2\pi}|\Sigma|^{-1} e{-(A^\textup{T} \Sigma^{-1}A)},
\]
\vspace{0.5cm}
where \\
\begin{tikzpicture}
\draw(0,0) node{$\mathbf{X} = \left[ \begin{matrix} X_1 \\
X_2 \\ \ldots \\ X_n \end{matrix} \right],$};
\end{tikzpicture}
\begin{tikzpicture}
\draw(0,0) node{$A=\left[\begin{matrix} x_1-\mu_1[![enter image description here][1]][1] \\
x_2-\mu_2 \\
\ldots \\ x_n-\mu_n \end{matrix} \right]$, and};
\end{tikzpicture}
\begin{tikzpicture}
\draw(0,-4) node{$
\Sigma = \left[ \begin{matrix} \sigma_{11} & \sigma_{12} & \ldots & \sigma_{1n} \\
\sigma_{21} & \sigma_{22} & \ldots & \sigma_{2n} \\
\sigma_{31} & \sigma_{32} & \ldots & \sigma_{3} \\
\hspace{2cm} \ldots \\
sigma_{n1} & \sigma_{n2} & \ldots & \sigma_{nn}
\end{matrix} \right].$};
\end{tikzpicture}
\end{document}
How do I align the images. I've tried using the vertical coord on the third picture to no avail. Also, while the third picture is most out of whack, the others aren't great either.[![enter image description here][2]][2]
tikzpicture
? It just seems unnecessarytikzpicture