I've run into this issue a couple times now, but whenever I try to include both inline LaTeX and inline R code in my Rmd file, I get Pandoc error 43. Never been able to find a workaround other than just manually adding in what the R code would have been.
---
title: "HW4"
date: "2/23/2018"
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
output:
pdf_document
---
```{r}
x_bar <- 4
```
The blue line above is the true $\lambda = 4$, and the red line is our
$\hat{\lambda}_{MLE} = \bar{x} = $ `r x_bar`.
Error:
l.192 \$ \hat{\lambda}
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted