简体   繁体   中英

R studio on Mac, how to knit to pdf?

I have some trouble with the knit function on R studio. It looks like it's finished with the "100%"? but then an error message shows as the below, and asks me to install Latex. I followed the guideline and just successfully installed MacTex. However the same message showed up again.
I was wondering probably I missed some steps? cause I didn't do anything else after installing, should I connect it with r studio/loading it like a library? thank you!


! sh: pdflatex: command not found

Error: LaTeX failed to compile 6501-hw1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See 6501-hw1.log for more info.
In addition: Warning message:
In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  error in running command
Execution halted

No LaTeX installation detected (LaTeX is required to create PDF output). You should install a LaTeX distribution for your platform: https://www.latex-project.org/get/

  If you are not sure, you may install TinyTeX in R: tinytex::install_tinytex()

  Otherwise consider MiKTeX on Windows - http://miktex.org

  MacTeX on macOS - https://tug.org/mactex/
  (NOTE: Download with Safari rather than Chrome _strongly_ recommended)

  Linux: Use system package manager

[enter image description here][1][1]: https://i.stack.imgur.com/BnBaf.png

If you try running "tinytex::install_tinytex()", close RStudio, re-open it and knit should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM