# why do I have a Missing $inserted error in this document Can someone help me understand this error message and how to fix it? I don't understand why it thinks it needs to insert a$. The error message is given below.

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

$\neg x_1 \wedge \neg x_2 \wedge x_3 \wedge \neg x_4 = \Tree[.\wedge [.\wedge [.\wedge [.\wedge \top [.\neg x_1 ] ] [.\neg x_2 ] ] x_3 ] [.\neg x_4 ] ]$

\end{document}


Here is the error message.

! Missing $inserted. <inserted text>$
l.8 ...wedge [.\wedge [.\wedge \top [.\neg x_1 ] ]
[.\neg x_2 ] ] x_3 ] [.\n...


Probably the nodes of the tree is set in text mode (even if the tree is inside a math environment), so you need $..$ throughout.
\documentclass{article}
$\neg x_1 \wedge \neg x_2 \wedge x_3 \wedge \neg x_4 = \Tree[.\wedge [.\wedge [.\wedge [.\wedge \top [.\neg x_1 ] ] [.\neg x_2 ] ] x_3 ] [.\neg x_4 ] ]$