0

I'm trying to knit Rmd file to pdf. I get the following error:

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
In addition: Warning message:
In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  '"pdflatex"' not found
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

When I try tinytex::install_tinytex(), I get:

trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
Content type 'text/html' length 4305 bytes
downloaded 4305 bytes

Error in system2("tlmgr", args, ...) : '"tlmgr"' not found
In addition: Warning message:
In extract(pkg, exdir = path.expand(target)) :
  error 1 in extracting from zip file

Trying tinytex::reinstall_tinytex(), gets me:

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

Trying tinytex::uninstall_tinytex() gets me:

Error in tinytex::uninstall_tinytex() : 
  TinyTeX does not seem to be installed.

Please help because I need to compile my Rmd to pdf.

UPDATE: Added this section (see comment thread for more info)

xfun::session_info()

Returns:

R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363), RStudio 2021.9.0.351

Locale:
  LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
  LC_NUMERIC=C                           LC_TIME=English_United States.1252    

Package version:
  base64enc_0.1.3 compiler_4.1.2  digest_0.6.28   evaluate_0.14   fastmap_1.1.0   glue_1.4.2      graphics_4.1.2  grDevices_4.1.2 highr_0.9      
  htmltools_0.5.2 jquerylib_0.1.4 jsonlite_1.7.2  knitr_1.36      magrittr_2.0.1  methods_4.1.2   rlang_0.4.12    rmarkdown_2.11  stats_4.1.2    
  stringi_1.7.5   stringr_1.4.0   tinytex_0.35    tools_4.1.2     utils_4.1.2     xfun_0.27       yaml_2.2.1   

Thank you!

fkn_ez
  • 55
  • 1
  • 9
  • Is that the complete output you get? Have you tried restarting R? Maybe try `tinytex::install_tinytex(force=TRUE)` after a restart? – MrFlick Nov 11 '21 at 01:16
  • 2
    I don't know why the download failed, but you can download TinyTeX via your web browser: https://yihui.org/tinytex/TinyTeX-1.zip Then pass the downloaded file path to `tinytex:::install_prebuilt()` to install it. – Yihui Xie Nov 11 '21 at 03:12
  • @YihuiXie when I try `tinytex:::install_prebuilt()` I get the following error: ```Error in system2("tlmgr", args, ...) : '"tlmgr"' not found In addition: Warning message: In extract(pkg, exdir = path.expand(target)) : error 1 in extracting from zip file ``` – fkn_ez Nov 12 '21 at 16:38
  • @KJ I am working on a windows 10 system – fkn_ez Nov 12 '21 at 16:52
  • @YihuiXie I have also tried `install.packages("tlmgr")` and get this warning: Warning in install.packages : package ‘tlmgr’ is not available for this version of R A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages – fkn_ez Nov 12 '21 at 16:54
  • What's the file size of TinyTeX-1.zip that you downloaded? – Yihui Xie Nov 12 '21 at 19:33
  • @YihuiXie 102,507 KB – fkn_ez Nov 12 '21 at 19:58
  • That sounds about right. Are you able to unzip it? – Yihui Xie Nov 15 '21 at 16:45
  • @YihuiXie yep. Could you provide an example of how the file path should look like for a windows user? I tried to look for documentation for `tinytex:::install_prebuilt()` but could not find anything. – fkn_ez Nov 15 '21 at 19:36
  • Okay, if you are able to unzip it, then move the extracted files/folders to the directory `tinytex:::default_inst()` (make sure the `bin` dir is directly under this directory), and you should be all set. BTW, could you please also provide your `xfun::session_info()` in your post? – Yihui Xie Nov 15 '21 at 22:28
  • @YihuiXie thank you for your help. TinyTex is finally installed! – fkn_ez Nov 19 '21 at 00:32

0 Answers0