Search code examples
rlatexr-markdownequationtinytex

Equation Function `$` not registering in R-Markdown


I am currently learning the basics of R and I cannot figure out why, when I try to insert equations, I am getting the error message:

trying to insert an equation into R Markdown

I have installed and put in the library the packages tinyverse, DT, tinytex, here, knitr, and janitor for the rest of the notebook. I was trying to do troubleshooting yesterday and it said that tinytex could be wrong, so I uninstalled it and reinstalled it and even tried tinytex::install_prebuild and that also did not work. I get the error message:

after putting tinytex:: install_tinytex()

Now if I do tinytex::tinytex_root(): I get "/Users/robinsonpa17/Library/TinyTex" which is weird because that is a different path then found in my folder (see below)path to TinyTex in my computer

Any help would be greatly appreciated.


Solution

  • Instead of

    ```{r}
    $A=\pi * r^2$
    ```
    

    Try using the equation without the chunk like in the following:

    $A=\pi * r^2$
    

    Put your cursor on the equation and you will see how it will be printed.