Peter Ruckdeschel
2025-Jan-16 17:09 UTC
[Rd] UTF-8 encoding issue with R CMD check with install-args="--latex"
Hi, this is to report some minor UTF-8 encoding issue with R CMD check with option --install-args="--latex" (and possibly more install-args). More specifically, in my Windows system (see the cloud link below for details on my system), but also on the Linux machine of my collaborator Matthias Kohl (CC), the following command throws errors: ????? R CMD check --install-args="--latex" <pkg>_<version>.tar.gz I.e., at this command, when checking the pdf version of the manual, pdflatex throws an error of type ==* checking PDF version of manual ... WARNING LaTeX errors when creating PDF version. This typically indicates Rd problems. LaTeX errors found: ! Undefined control sequence. l.37 \inputencoding ?????????????????? {utf8} The control sequence at the end of the top line of your error message was never \def'ed. If you have == This is certainly not an urgent issue. Option --install-args="--latex" can be removed without harm for me, it somehow survived in my set of (Windows) batch files I use to build, check, and install my R packages on Windows, which, admittedly, makes me a rare species in the R ecosystem. Still, it would be nice to understand why this happens, so any hints would be warmly welcome. Some more details on my testing configuration and my first insights into this error can be found here: cloudstorage.uni-oldenburg.de/s/kStWp5PNiwJEqfz Best, Peter Ruckdeschel [[alternative HTML version deleted]]
Ivan Krylov
2025-Jan-16 20:21 UTC
[Rd] UTF-8 encoding issue with R CMD check with install-args="--latex"
? Thu, 16 Jan 2025 18:09:25 +0100 Peter Ruckdeschel via R-devel <r-devel at r-project.org> ?????:> this is to report some minor UTF-8 encoding issue with R CMD check > with option --install-args="--latex" (and possibly more install-args).Thank you for a very detailed report! This doesn't happen on R-4.2.2 or 4.3.1, but it does happen on R-devel. Comparing the calls from R CMD check to R CMD Rd2pdf, I see no difference in the environment variables or any significant difference in the command lines. The command being run ends up being equivalent to R CMD Rd2pdf <package>.Rcheck/<package> ...and the source of the difference is the presence (or absence) of the <package>.Rcheck/<package>/latex directory. If I temporarily move it away during an R CMD check --install-args=--latex run, the command succeeds. Indeed, tools:::.pkg2tex says>> ## First check for a latex dir (from R CMD INSTALL --latex). >> ## Second guess is this is a >= 2.10.0 package with stored .rds >> ## files. >> ## If it does not exist, guess this is a source package. >> latexdir <- file.path(pkgdir, "latex")The individual *.tex files in the latex/ subdirectory of the installed package all do start with an "\inputencoding{utf8}" line. When the latex/ subdirectory doesn't exist, the !dir.exists(latexdir) branch is taken, where Rd2latex(...) is called with writeEncoding FALSE, thus avoiding the problem. -- Best regards, Ivan
Apparently Analagous Threads
- UTF-8 encoding issue with R CMD check with install-args="--latex"
- UTF-8 encoding issue with R CMD check with install-args="--latex"
- UTF-8 encoding issue with R CMD check with install-args="--latex"
- R2HTML doesn't split paragraphs originating from \Sexpr[results=rd]
- Suggestion / patch to support more Unicode characters in R CMD Rd2pdf