Search code examples
rdocumentationroxygen2

Diacritics in R documentation via roxygen & Rdpack


I'm generating documentation using roxygen2 and Rdpack and, when using inline citations, see encoding errors when I build documentation with R CMD Rd2pdf MyPackage --no-clean (per Diagnosing R package build warning: "LaTeX errors when creating PDF version").

! Package textcomp Error: Symbol \textcurrency not provided by
(textcomp)                font family ptm in TS1 encoding.
(textcomp)                Default family used instead.

See the textcomp package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.1523 Wä
            gele et al. (2009);

These appear to arise because non-ASCII characters are being included in .Rd files via \insertCite{}. Can I use this mechanism to cite authors whose names include diacritics?


Here's a minimal documentation section:

#' Sample function
#'
#' Problematic citation to \insertCite{Wagele2009;textual}{MyPackage}
#'
#' @references
#' \insertAllCited{}
#' @encoding UTF-8
Foo <- function (x) x

inst/REFERENCES.bib contains (minimally)

@article{Wagele2009,
  author = {W{\"a}gele, J W and W{\"a}gele, H},
  year = {2009},
}

The DESCRIPTION file includes Encoding: UTF-8.


Solution

  • After some further searching I've found an answer elsewhere that suggests that this is due to Windows' non-native handling of UTF-8 encoding, which [edit] was addressed in R4.0. is being addressed in a future release in the R 4.x series. Unless other readers have further suggestions, it looks like it may have to be a case of "wait a while"...