TinyTex errors within RMarkdown (Local TeX Live (2021) is older than remote repository (2022))

3.8k views Asked by At

I randomly started getting the error messages below while trying to run a RMarkdown document. I am on a Windows, so I deleted the TinyTex subfolder within the AppData folder and reran tinytex::install_tinytex(). That installed but didn't fix the error messages, so I tried tinytex::reinstall_tinytex() but that didn't help.

I know from the error messages I am missing LaTeX packages, so I tried running the code below but it will not run. I assume there is a greater problem at hand, and guidance would be greatly appreciated.

tinytex::parse_install(text = "! LaTeX Error: File `setspace.sty' not found.")

Error messages:

A new version of TeX Live has been released. If you need to install or update any LaTeX packages, you have to upgrade TinyTeX with tinytex::reinstall_tinytex(). If it fails to upgrade, you might be using a default random CTAN mirror that has not been fully synced to the main CTAN repository, and you need to wait for a few more days or use a CTAN mirror that is known to be up-to-date (see the "repository" argument on the help page ?tinytex::install_tinytex).

tlmgr.pl: Local TeX Live (2021) is older than remote repository (2022). Cross release updates are only supported with update-tlmgr-latest(.sh/.exe) --update See https://tug.org/texlive/upgrade.html for details. ! LaTeX Error: File `setspace.sty' not found.

! Emergency stop. <read *>

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

2

There are 2 answers

2
samcarter_is_at_topanswers.xyz On

Two possibilities:

  1. set your mirror to the historic version which still has 2021, e.g.

    tinytex::tlmgr("option repository https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/2021/tlnet-final")
    
  2. install vanilla texlive2022 from https://tug.org/texlive/

(I'd go with the second solution. If you use a complete texlive installation instead of tinytex, you'll never again have to deal with missing packages)

0
Daniel L On

The error messages above should no longer appear for anyone who is trying to knit a pdf with RMarkdown based on the feed at https://github.com/yihui/tinytex/issues/293. TeX Live released their 2022 version on April 3, so there is a window of time where tinytex needs to update.

One could also use @samcarter_is_at_topanswers.xyz recommendations and install TeX Live 2022 themselves (https://tug.org/texlive/acquire-netinstall.html), and update their path within RStudio (How to teach R find the texlive directory when using rstudio?).