2

I am trying to knit reports to pdf documents in rstudio.

I have successfully installed rtools and added it to my PATH, and also installed rmarkdown and tinytex. However whenever I run tinytex::install_tinytex() the following error about tlmgr is thrown.

Error in system2("tlmgr", args, ...) : '"tlmgr"' not found

xfun::session_info('tinytex')

R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042), RStudio 1.4.1717

Package version: graphics_4.1.0 grDevices_4.1.0 stats_4.1.0
tinytex_0.32 tools_4.1.0 utils_4.1.0 xfun_0.23

I have installed tinytex with mush more relative ease in the past and have now tried this a gazillion times without any joy. Please any help will appreciated on this or at least a great guide on how to render tables in word(.docx) outputs.

  • You're saying that `Sys.getenv("PATH")` includes the directory in which tinytex is allegedly installed? – r2evans Jun 09 '21 at 12:32
  • @r2evans I do not think so, when I run ```.libPaths()``` the location is "C:/R/R-4.1.0/library" this where the package tinytex is, the path is very much different from ```Sys.getenv("PATH")``` returns. – afrologicinsect Jun 09 '21 at 12:51
  • something like this "C:\\R\\rtools40\\\\usr\\bin;C:\\R\\R-4.1.0\\bin\\x64;;C:\\Program Files\\Git\\cmd;C:\\R\\rtools40\\\\usr\\bin\\;C:\\Users\\XYZ\\AppData\\Local\\Microsoft\\WindowsApps;C:\\R\\rtools40\\\\usr\\bin\\;". – afrologicinsect Jun 09 '21 at 13:00
  • I don't see tinytext referenced in there, perhaps your statement *"added it to my PATH"* was premature? Realize that adding it to your PATH has no effect on running applications, so you may need to completely close and restart R *and* RStudio. – r2evans Jun 09 '21 at 13:12
  • `.libPaths()` is for R packages, not executables. `tinytex` the R package installs utilities and such for the R package that are used (outside of R) to download, cache, maintain, etc, the LaTeX dependencies required to render your documents. – r2evans Jun 09 '21 at 13:15
  • I meant added Rtools to my Path. I have also restarted R and RStudio multiple times with no luck. – afrologicinsect Jun 09 '21 at 13:16
  • What does `tinytex:::tinytex_root()` return? – r2evans Jun 09 '21 at 13:20
  • ```tinytex:::tinytex_root()```returns "" – afrologicinsect Jun 09 '21 at 13:24

1 Answers1

1

I don't really know how I did this but let me just mention the obvious steps for anyone who meets such errors in the future.

I deleted everything, R and RStudio folders and emptied all folders from the recycle bin.

  1. Reinstalled R
  2. Reinstalled RStudio
  3. Installed rmarkdown
  4. Then tinytex::install_tinytex()

See the thing is I had done this a thousand times and I don't really know why this works now, but hey it's a free and new program, R.

And I will keep this open incase of any serious explanations and thanks for those that at least tried to help.