Search code examples
rdockertinytextex-live

Strange `tinytex` behavior - `~/.TinyTex` keeps dissapearing?


In my rocker/rstudio-derived docker container, I'm engulfed in a quagmire surrounding the yearly TexLive update and the R package tinytex.

I have gone through a plethora of iterations of tinytex::install_tinytex(), tinytex::uninstall_tinytex(), tinytex::reinstall(), etc.

I have installed the most current version via remotes::install_github("yiuhi/tinytex").

I have experimented with different (up to date) mirrors of CTAN.

When using a up to date mirror and having installed/reinstalled tinytex properly, I keep getting this behavior:

> tinytex::tinytex_root()
[1] "/home/rstudio/.TinyTeX"
> tinytex::pdflatex("<MYFILE>.tex")
tlmgr: package repository http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/systems/texlive/tlnet (verified)
[1/1, ??:??/??:??] install: koma-script [13745k]
running mktexlsr ...
done running mktexlsr.
tlmgr: package log updated: /home/rstudio/.TinyTeX/texmf-var/web2c/tlmgr.log

... 6 more successful package installs ...

tlmgr: package repository http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/systems/texlive/tlnet (verified)
[1/1, ??:??/??:??] install: babel-english [3k]
running mktexlsr ...
done running mktexlsr.
tlmgr: package log updated: /home/rstudio/.TinyTeX/texmf-var/web2c/tlmgr.log
! LaTeX Error: This NFSS system isn't set up properly.

! sh: 1: pdflatex: not found

Error: LaTeX failed to compile <MYFILE>.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See <MYFILE>.log for more info.
In addition: Warning messages:
1: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  error in running command
2: In system2("tlmgr", args, ...) : error in running command
> tinytex::tinytex_root()
[1] ""

After this, ~/.TinyTeX (which was present before) is literally GONE from the file system!?

Can anybody shed light on why 1) tinytex appears to install, 2) it appears to properly process my *.tex file and pulling in the appropriate packages from CTAN and than 3) proceeds in one of those package installations to delete it's entire own installation!?


Solution

  • The observed behavior was a bug in the tinytex R package and has since been resolved (https://github.com/yihui/tinytex/issues/197).

    Until the CRAN-available version is >= 0.21.5, one may remedy the behavior by installing directly from the author's repository by:

    install.packages("remotes")
    remotes::install_github("yihui/tinytex")