Re: [R-pkg-devel] katex

2023-04-25 Thread Ivan Krylov
On Tue, 25 Apr 2023 06:39:23 -0500
Dirk Eddelbuettel  wrote:

> 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 ... ?

Thanks for the review! Filed the report at
.

-- 
Best regards,
Ivan

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] katex

2023-04-25 Thread Viechtbauer, Wolfgang (NP)
Yeah, I know -- like I said, hack / not recommended / should handle this 
properly.

I spent a few hours yesterday rebuilding my package library because I build all 
packages from source -- really should start using r2u (thanks!) -- so once I 
got that issue, I was just trying to move on to get some work done.

Best,
Wolfgang

>-Original Message-
>From: Dirk Eddelbuettel [mailto:e...@debian.org]
>Sent: Tuesday, 25 April, 2023 13:50
>To: Viechtbauer, Wolfgang (NP)
>Cc: Göran Broström; Ivan Krylov; R-package-devel@r-project.org
>Subject: Re: [R-pkg-devel] katex
>
>On 25 April 2023 at 11:39, Viechtbauer, Wolfgang (NP) wrote:
>| I ran into the same issue (on Ubuntu 20.04).
>|
>| I just copied everything from /usr/share/R/doc to /usr/lib/R:
>|
>| A bit of a hack but then everything works fine.
>
>That is rather bad as you create lots of 'orphan' files your package manager
>does not know about.  We really should not be advertise this in public
>without strong disclaimers (which you added, so thanks).
>
>This whole thread would have been well at home on r-sig-debian.
>
>Dirk
>
>--
>dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] katex

2023-04-25 Thread Dirk Eddelbuettel


On 25 April 2023 at 11:39, Viechtbauer, Wolfgang (NP) wrote:
| I ran into the same issue (on Ubuntu 20.04).
| 
| I just copied everything from /usr/share/R/doc to /usr/lib/R:
| 
| A bit of a hack but then everything works fine.

That is rather bad as you create lots of 'orphan' files your package manager
does not know about.  We really should not be advertise this in public
without strong disclaimers (which you added, so thanks).

This whole thread would have been well at home on r-sig-debian.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] katex

2023-04-25 Thread Viechtbauer, Wolfgang (NP)
I ran into the same issue (on Ubuntu 20.04).

I just copied everything from /usr/share/R/doc to /usr/lib/R:

A bit of a hack but then everything works fine.

Best,
Wolfgang

>-Original Message-
>From: R-package-devel [mailto:r-package-devel-boun...@r-project.org] On Behalf 
>Of
>Göran Broström
>Sent: Tuesday, 25 April, 2023 12:02
>To: Ivan Krylov
>Cc: R-package-devel@r-project.org
>Subject: Re: [R-pkg-devel] katex
>
>On 2023-04-25 10:02, Ivan Krylov wrote:
>> On Mon, 24 Apr 2023 18:17:22 +0200
>> Göran Broström  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.
>>
>> For a copy of R built from source, it's not a problem:
>
>Thanks. I have now built R from source and can confirm that everything
>works nicely. Can't remember when and why I stopped building R from
>source, probably not a good idea.
>
>Göran
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] katex

2023-04-25 Thread Dirk Eddelbuettel


On 25 April 2023 at 11:02, Ivan Krylov wrote:
| On Mon, 24 Apr 2023 18:17:22 +0200
| Göran Broström  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 | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] katex

2023-04-25 Thread Göran Broström




On 2023-04-25 10:02, Ivan Krylov wrote:

On Mon, 24 Apr 2023 18:17:22 +0200
Göran Broström  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.

For a copy of R built from source, it's not a problem:


Thanks. I have now built R from source and can confirm that everything 
works nicely. Can't remember when and why I stopped building R from 
source, probably not a good idea.


Göran

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] katex

2023-04-25 Thread Ivan Krylov
On Mon, 24 Apr 2023 18:17:22 +0200
Göran Broström  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.

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:

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.

-- 
Best regards,
Ivan

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] katex

2023-04-25 Thread Göran Broström
I upgraded to 4.3.0 and rebuilt and checked a package with --as-cran, 
receiving


* checking PDF version of manual ... OK
* checking HTML version of manual ...Warning in file(con, "r") :
  cannot open file '/usr/lib/R/doc/html/katex/katex.js': No such file 
or directory

Error in file(con, "r") : cannot open the connection
Execution halted

Never heard of 'katex' but googled and found it interesting to try, so I 
installed the R package katex and, on my ubuntu system:


$ sudo apt install katex

but 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.

Thanks, Göran

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel