When I knit in R Markdown, LaTeX fails to compile and I get the error: ! Undefined control sequence

Viewed 301

I am writing my thesis in R markdown and I get the following error when I try to knit:

! Undefined control sequence.
l.404 ... We reject the null hypothesis of (r \eq 0) at a 1% level of
Error: LaTeX failed to compile Thesis_Draft.tex.

The R markdown file includes tables, graphs, code chunks and math equations. What could be causing the problem with knitting?

1 Answers

The issue I was having came from incorrectly typing $r \eq 0$ instead of $r \geq 0$. Once I fixed this, I had no more issues knitting. If you get a similar error (! Undefined control sequence), check that any inline mathematical notation in the text chunks is valid.

Related