Missing $ inserted
TeX Output
./example.tex:3: Missing $ inserted.
l.3 Variable x_
1 is not in math mode.
Explanation
TeX encountered a character or macro that is only valid inside math mode while operating in horizontal (text) mode. Common culprits include:
- Subscripts (
_) or superscripts (^) written outside$ ... $(e.g.file_name.txtor10^5). - Greek letters or math symbols like
\alpha,\sum,\inftyin regular prose. - Math operators (
\to,\times,\le) without surrounding$delimiters.
How to Fix
- If mathematical: wrap the expression in inline math delimiters
$ ... $:Variable $x_1$ is in math mode. - If an underscore is intended in text: escape it with
\_(or wrap file paths in\texttt{...}/\url{...}):The file name is \texttt{file\_name.txt}.
[!NOTE] If this error occurs during
\printbibliographyor\bibliography, the unescaped underscore or missing dollar sign is inside a.bibdatabase field. See Troubleshooting Bibliography Errors for automated diagnosis withlatex_it.