[R-pkg-devel] katex

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Tue Apr 25 13:39:23 CEST 2023


On 25 April 2023 at 11:02, Ivan Krylov wrote:
| On Mon, 24 Apr 2023 18:17:22 +0200
| Göran Broström <gb using ehar.se> wrote:
| 
| >    cannot open file '/usr/lib/R/doc/html/katex/katex.js': No such
| > file or directory
| 
| > I still get the error with R CMD check --as-cran. What am I
| > missing? Obviously /usr/lib/R/doc/html/katex/katex.js (no 'doc'), but
| > ...
| > 
| > I am installing R via apt.
| 
| Thank you for mentioning this detail!
| 
| At least in Debian packages, R's copy of KaTeX lives in /usr/share: per
| Debian policy, "share" is for human-readable files like KaTeX, and
| "lib" is for shared libraries, compiled code and the like.

Yes, that is a distribution-wide preference other Linux distributions have
too, and that was turned on many, many years ago in Debian (glancing at
changelog: one reference to 1999 when Doug was still maintainer; otherwise
mostly in 2006 it seems).

It does make R depart from the 'everything below RHOME' model, but the
relevant changes have mostly been caught.
 
| For a copy of R built from source, it's not a problem:
| file.path(R.home(), 'doc', 'html') does point to where KaTeX lives.
| 
| For a copy of R packaged into *.deb, the right path can be obtained
| using file.path(R.home("doc"), "html"):
| 
| --- src/library/tools/R/utils.R (revision 84280)
| +++ src/library/tools/R/utils.R (working copy)
| @@ -1788,7 +1788,7 @@
|      ctx <- NULL
|      function() {
|          if(is.null(fun) && requireNamespace("V8", quietly = TRUE)) {
| -            dir <- file.path(R.home(), "doc", "html")
| +            dir <- file.path(R.home("doc"), "html")
|              ctx <<- V8::v8("window")
|              ctx$source(file.path(dir, "katex", "katex.js"))
|              ## Provides additional macros:

Nice catch. In favour. Would you mind filing a bugzilla report to make sure
this persists and makes it into R 4.3.1 or 4.4.0 or ... ?
 
| This path is also valid for an R build launched from source (without
| "make install"). I don't know whether this would break a
| differently-packaged build of R, though.

I would not expect it to.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list