Search code examples
rlatexmarkdownformulahat

R - Markdown "! Missing { inserted. <to be read again> " mistake


When I try to export in pdf a R Markdown file I get the following mistake:

! Missing { inserted. <to be read again> 

The concerned line is this one:

$$
AIC = ln \hat{\sigma}^{2}_\hat{u_t} + \frac{2n_k}{T}
$$

I do not get what is wrong with the way I structure the formula. FYI when I export in .doc it works fine, so all the problems start when I try no knit on pdf!

Anyone has suggestions??


Solution

  • It's having trouble with your complicated subscript, \hat{u_t} -- try enclosing that entire term in { }.