Search code examples
rlatexknitrr-markdownbeamer

Equation trouble in Rmarkdown


Keep getting a message:

! Missing { inserted. <to be read again> \left l.70 \end{frame}

when running the R markdown file below (in RStudio). I have spent a few hours pulling my hair out trying to figure out why? The equation renders in the preview.

---
title: "Compile Please"
output: beamer_presentation
---

## This Equation is Poison for Rmd

$$ f(x) = \left( 1 + \frac{x}{m - \alpha} \right) ^ \left( x \right) $$ 

Solution

  • It may be picky about spaces there. This "tighter" version with explicit parens to protect that exponentiated works here:

    $$ f(x) = \left( 1 + \frac{x}{m - \alpha} \right)^{\left( x \right)} $$