Repository navigation
Handle blocked tlmgr more gracefully when producing pdfs #2612
Description
At our work computers, executing tlmgr is blocked via a Windows group policy. This makes converting Rmd to pdf with default options fail with a rather unhelpful error message.
Contents of test.Rmd:
---
title: "A test document"
---
# Test
Hello world!> library(rmarkdown)
> render("test.Rmd", pdf_document())
Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten.
Error in if (fig_crop) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In system2("tlmgr", args, ...) :
running command '"tlmgr" --version' had status 1
This appears to be caused by the default of fig_crop="auto" implicitly used by pdf_document(), when it tries to figure out if the pdfcrop command is available.
Setting fig_crop to FALSE is a functioning workaround and produces a pdf as expected:
> render("test.Rmd", pdf_document(fig_crop=FALSE))
Incidentally, fig_crop=TRUE gives a slightly different, but equally unhelpful, error than the one for the default fig_crop="auto":
> render("test.Rmd", pdf_document(fig_crop=TRUE))
Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten.
Error in if (year < 2023 && warn) warning("TeX Live version too low. Please consider upgrading, e.g., via tinytex::reinstall_tinytex().") :
missing value where TRUE/FALSE needed
In addition: Warning message:
In system2("tlmgr", args, ...) :
running command '"tlmgr" --version' had status 1
Maybe it would be possible to detect this case where tlmgr cannot be executed, and then change the default fig_crop from "auto" to FALSE (with a corresponding warning or info message being printed)?
Output from xfun::session_info()
> xfun::session_info("rmarkdown")
R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)
Locale:
LC_COLLATE=German_Germany.utf8 LC_CTYPE=de_DE.UTF-8
LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C
LC_TIME=German_Germany.utf8
Package version:
base64enc_0.1.3 bslib_0.10.0 cachem_1.1.0 cli_3.6.5
digest_0.6.39 evaluate_1.0.5 fastmap_1.2.0 fontawesome_0.5.3
fs_1.6.6 graphics_4.5.1 grDevices_4.5.1 highr_0.11
htmltools_0.5.9 jquerylib_0.1.4 jsonlite_2.0.0 knitr_1.51
lifecycle_1.0.5 memoise_2.0.1 methods_4.5.1 mime_0.13
R6_2.6.1 rappdirs_0.3.4 rlang_1.1.7 rmarkdown_2.30
sass_0.4.10 stats_4.5.1 tinytex_0.58 tools_4.5.1
utils_4.5.1 xfun_0.55 yaml_2.3.12
Pandoc version: 3.4
Checklist
When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:
-
formatted your issue so it is easier for us to read?
-
included a minimal, self-contained, and reproducible example?
-
pasted the output from
xfun::session_info('rmarkdown')in your issue? -
[-] upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
(note: R and RStudio can't be updated with user permissions on our work computers; but packages can and are up to date) -
installed and tested your bug with the development version of the rmarkdown package using
remotes::install_github("rstudio/rmarkdown")?
Activity
suppress warnings in case tlmgr cannot be executed: rstudio/rmarkdown…
yihui commentedon Mar 20, 2026
Should be fixed now. Thanks for the report!
fix rstudio/rmarkdown#2612: if tlmgr exists but cannot be executed, h…
github-actions commentedon Sep 23, 2026
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.