TinyTex isn't working and can't generate pdf file in rmarkdown

Pleas I use PC (Windows 10), R version 3.6.2, Rstudio 1.2.1335.

First, I've read all the issues listed here, some of issues are really similar to mine, but none of them can solve my problem. So I started investigating by trying different possible solution.

First of all, in order to clear out all the Tex issue, I uninstall all the tex software (e.g, CTEX, MIKTEX, TEXSTUDIO, TEXTWORK, etc.) then open RStudio to install TinyTex.

  1. install r-package "tinytex" done
  2. install the LaTex distribution via R

tinytex::install_tinytex(TRUE) This step gave me some issues but I don't know why. after running this, R console remind me to close my rstudio, reopen, and try " tinytex:::is_tinytex() " (See blog below).

TinyTeX installed to C:\Users\abc\AppData\Roaming/TinyTeX

Please quit and reopen your R session and IDE (if you are using one, such as RStudio or Emacs) and check if tinytex:::is_tinytex() is TRUE.
Warning messages:
1: Detected an existing tlmgr at C:\Users\abc\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat. It seems TeX Live has been installed (check tinytex::tinytex_root()). You are recommended to uninstall it, although TinyTeX should work well alongside another LaTeX distribution if a LaTeX document is compiled through tinytex::latexmk().
2: In file.remove("TinyTeX/install-tl.log") :
cannot remove file 'TinyTeX/install-tl.log', reason 'No such file or directory'

Somehow the system always said "FALSE", but it is fixed by using "tinytex:::install_prebuilt()".

Then, I've tried 2 commands:
tinytex::tinytex_root()

The system gave:
[1] "C:\Users\abc\AppData\Roaming\TinyTeX"

Then update LaTeX packages
tinytex::tlmgr_update()

The system gave:

Setting up xz with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work

xz (XZ Utils) 5.2.4
liblzma 5.2.4

tlmgr.pl: package repository http://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable)

Cool, you see xz (XZ Utils) 5.2.4 and liblzma 5.2.4 first showed up.

Then I did what yihui suggested on the tinytex webpage to install all necessary packages:

tinytex:::install_yihui_pkgs().

Everything went well and then the xz.exe didn't work showed again.

Setting up xz with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work
xz (XZ Utils) 5.2.4
liblzma 5.2.4

TLPDB::_install_package: unsupported container format xz

TLPDB::_install_package: unsupported container format xz
TLPDB::_install_package: unsupported container format xz
xz (XZ Utils) 5.2.4
liblzma 5.2.4

Then, I knit my Rmarkdown file. The system gave a lot of 'Can't spawn "cmd.exe" message' and eventually halt my file compiling process.

here is the part of what I get.

Setting up tar with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/tar.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\tar.exe didn't work
GNU tar 1.11.8 + 2.2(WIN32)

Setting up wget with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/wget/wget.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\wget\wget.exe didn't work
GNU Wget 1.20.1 built on mingw32.

Setting up xz with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work

xz (XZ Utils) 5.2.4
liblzma 5.2.4

tlmgr.pl: package repository http://ctan.math.illinois.edu/systems/texlive/tlnet (not verified: gpg unavailable)
[1/2, ??:??/??:??] install: lm-math [369k]
[2/2, 00:00/00:00] install: unicode-math [42k]
TLPDB::_install_package: unsupported container format xz
TLPDB::_install_package: unsupported container format xz
tlmgr.pl: package log updated: C:/Users/abc/AppData/Roaming/TinyTeX/texmf-var/web2c/tlmgr.log
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/W32TeX) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
tlmgr search --file --global "/unicode-math.sty"
Setting up xz with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work
! LaTeX Error: File `unicode-math.sty' not found.

! Emergency stop.
<read *>

Error: LaTeX failed to compile gtap_summary_report_final.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See gtap_summary_report_final.log for more info.

Execution halted

OK. I guess I may not have 'unicode-math.sty' and I went to website, download it, then I don't know where I should put to the Tinytex subfolder, since I've already removed all the CTEX, MIKTEX, TEXTWORK software from my pc.

2nd thought: I reinstall CTEX in which MIKTEX basic and textwork are both included.

Need your help to solve the problem.

I don't have a clue. Sounds like the (random) CTAN mirror from which you installed TinyTeX was somehow corrupted or not fully synced with the main repository. I'd blindly try tinytex:::install_prebuilt().

BTW, this was cross-posted at https://github.com/yihui/tinytex/issues/180.

Hi yihui: Sorry for the cross-posting! I've posted on the issue first but haven't received any feedback then I try my luck here.

I've asked multiple friends knit pdf from Rmarkdown file from their computer. Most of them are good to go.

Any possible reason that it is caused by the Rmarkdown version (Earlier than 1.18 should work).

What should I do to start over and find the root cause?

What I did:

  1. remove everything related to Tex and just purely rely on TinyTex installed by RStudio (Doesn't work)

  2. install Tex Live ISO version (3.3 GB) locally, hoping some missing .sty could be installed (Doesn't work).

  3. uninstall R 3.62 and reinstall R 3.5.2 or older version (doesn't work).

  4. uninstall both R and Rstudio and reinstall them (doesn't work).

It seems like my PC still have some leftover once I reinstall everything back (same old error message, even just install TinyTex) .

It always told me that -

Setting up xz with C:/Users/abc/AppData/Roaming/TinyTeX/tlpkg/installer/xz/xz.exe as C:\Users\abc\AppData\Roaming\TinyTeX\tlpkg\installer\xz\xz.exe didn't work
xz (XZ Utils) 5.2.4
liblzma 5.2.4

Do you know can I go somewhere to download TinyTex to my local drive and reinstall?

Thanks,

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

I don't understand this error message about xz.exe, either. Since TeX Live 2020 has been released last month, you might try tinytex::reinstall_tinytex(), and see if the newer version works.

BTW, I asked you to try tinytex:::install_prebuilt() in the previous reply, but I don't know if you also tried that.

1 Like