! Missing $ inserted appears when you use something only valid in math mode — a subscript _, a superscript ^, a Greek letter like \alpha — in ordinary text. TeX guesses you forgot to open math and inserts a $, often cascading into further errors. The fix is to enter math mode, or escape the character.
When it happens
Common triggers: _ or ^ in prose (a filename data_set, or x^2 written straight into text), Greek letters or math operators, or \frac outside math. For example, the following errors because _ is math-only (for reading errors, see “Reading errors & debugging”):
The value x_1 and \alpha are positive. % ← _ も \alpha も数式専用 / math-onlyThe fix
Wrap math in $ … $ (inline) or \[ … \] / an equation environment (display): $x_1$, $\alpha$, $x^2$. But if you actually want a literal underscore (filenames, identifiers), write \_ (or load the underscore package so _ is safe in text). For a literal caret, use \textasciicircum.
The value $x_1$ and $\alpha$ are positive. % 数式モードで / in math mode
data\_set.csv % 素のアンダースコア / a literal underscoreRelated pitfalls
An unbalanced $ causes the same or cascading errors — opening math and forgetting to close it, an extra $, or a $ that closes a formula too early. When you see a flood of math errors, the real cause is usually a single missing or extra $ somewhere earlier. Check that every $ is paired.