R Studio is not recognizing Miktex download

When I type in > sys.which('pdflatex') in Rstudio console

I get this error message
Error in sys.which("pdflatex") : could not find function "sys.which"

Even though I have downloaded Miktex and Tinytex.

It seems like R studio can't find either, and I tried downloading and re-downloading and have really gotten myself in a mess :frowning:

Has anyone been in this situation before and could help?

Hi Hayley, your problem might just stem from a simple typo. Rather annoyingly, the Sys.which function name is capitalized, and your call to it has a lower case s.

Try running it again with a capital S in the function name, and you'll get a different result.

Sys.which("pdflatex")
1 Like

That definitely could be part of the problem! :slight_smile:

When I caps the "S", I get this response:

pdflatex
""
And when I try to "Knit" an R Markdown, I'm getting the message that no LaTex installation detected.

Have you added MikTeX to PATH?

I guess you're on Windows. There, the steps to add to PATH are:

  1. Search path on from Start menu.
  2. Open Edit system environment variables
  3. Select Environment variables
  4. Click Path
  5. Click Edit
  6. Add the full location of \miktex\bin
  7. Click OK 3 times for each dialogue boxes.

It's recommended to use tinytex. Why don't you use it?

You just need to do the following:

install.packages('tinytex')
tinytex::install_tinytex()
1 Like

Thank you Yarnabrina and Hlynur!

I was trying to install TinyTex in R, which wasn't working.

When I installed in R Studio (and messed around with quite a bit), it worked!

Miktex still wasn't working, not sure why.

Thanks for the help!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.