r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
8 stars 2 forks source link

LaTeX error while building PDF manual: `! You can't use macro parameter character #' in horizontal mode` #431

Closed roaldarbol closed 2 weeks ago

roaldarbol commented 2 weeks ago

I'm running into an issue where the documentation of my package doesn't render to a PDF due to a LaTeX issue. The failed building process is here: https://github.com/r-universe/roaldarbol/actions/runs/9459715427/job/26057277779 The relevant part of the log here:

Build complete!
Installation OK but failed to build PDF manual:
Converting Rd files to LaTeX 
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  : 
  Running 'texi2dvi' on 'Rd2.tex' failed.
LaTeX errors:
! You can't use `macro parameter character #' in horizontal mode.
l.63 #
      # Not run: 
Here is how much of TeX's memory you used:
 9732 strings out of 476194
Output:

Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  : 
  Running 'texi2dvi' on 'Rd2.tex' failed.
LaTeX errors:
! You can't use `macro parameter character #' in horizontal mode.
l.63 #
      # Not run: 
Here is how much of TeX's memory you used:
 9732 strings out of 476194
Output:

Error in running tools::texi2pdf()

Looking through the .Rd files, I can't figure out what the issue really is, as there are no #' in those files: https://github.com/roaldarbol/r-pixi/tree/main/man

jeroen commented 2 weeks ago

Can you try adding this line to your DESCRIPTION file:

Roxygen: list(markdown = TRUE)

And then run roxygen2::roxygenize() or similar. See also this section on turning-on-markdown-support.

jeroen commented 2 weeks ago

Ah I see the real bug now: your documentation for add has a \dontrun{} fragment, but this is only allowed within an @examples block.

roaldarbol commented 2 weeks ago

Aaaaah. Can see that I got a warning locally, but it didn't fail here. Are there different requirements for r-universe, are warnings not tolerated?

jeroen commented 2 weeks ago

Aaaaah. Can see that I got a warning locally, but it didn't fail here. Are there different requirements for r-universe, are warnings not tolerated?

No, I was getting the same error locally when running R CMD Rd2pdf pixi, that is how I debugged the problem.

roaldarbol commented 2 weeks ago

Ah, fair enough. Thanks a bunch for the help, really appreciate it!