Reference:

https://rpruim.github.io/s341/S19/from-class/MathinRmd.html#:~:text=Math%20inside%20RMarkdown,10n%3D1n2.

Notes

eval=TRUE, echo=FALSE,results = “asis” and cat() should be included

No \\ :

cat(“$x = y$”)

\(x = y\)

or a space between \\ and x :

cat(“$\\ x = y$”)

\(\ x = y\)

‘\n\n’ should be used if indented:

cat(“$\\beta = 1$”, ‘\n\n’)

cat(“$a^2+b^2 = c^2$”, ‘\n\n’)

cat(“$\\sum_{n=1}^{\\infty}x_i$”, ‘\n\n’)

cat(“$\\sum_{n=1}^{10} n^2$”, ‘\n\n’)

\(\beta = 1\)

\(a^2+b^2 = c^2\)

\(\sum_{n=1}^{\infty}x_i\)

\(\sum_{n=1}^{10} n^2\)