[Rd] tools::parseLatex() crashes on "\\verb{}"

Antoine Fabri @nto|ne@|@br| @end|ng |rom gm@||@com
Fri Jul 21 17:34:29 CEST 2023


Do I understand correctly that we don't want Rd files to be valid latex ?
This seems odd to me.
I see that `tools::parse_Rd()` doesn't like `\verb!foo!` so maybe roxygen2
is actually doing the right thing (as opposed to just trying to) ?

`parse_Rd() ` is probably what I need indeed, for some reason I hadn't
found it, so that should fix my own issue here thanks a lot.

Le ven. 21 juil. 2023 à 16:18, Ivan Krylov <krylov.r00t using gmail.com> a écrit :

> В Fri, 21 Jul 2023 15:14:09 +0200
> Antoine Fabri <antoine.fabri using gmail.com> пишет:
>
> > On a closer look it seems like roxygen2 introduces those, when using
> > markdown backtick quoting, if the quoted content is not syntactic. For
> > instance:
> >
> > #' `c(c(1)`
> > #' `c(c(1))`
> >
> > Will convert the first line to `\verb{c(c(1)}` and the second to
> > `\code{c(c(1))}`.
>
> roxygen2 tries to do the right thing here. As defined in "Parsing Rd
> files" [*], \code{} blocks are supposed to contain syntactically valid
> R code. When something that is not valid R is given in a Markdown code
> block, roxygen2 should not output \code{}, so it outputs \verb{}.
>
> Also, unlike in LaTeX as understood by tools::parseLatex(), \verb{}
> blocks use the {} braces in R documentation, and are understood
> correctly by tools::parse_Rd(). Perhaps you also need tools::parse_Rd()?
>
> --
> Best regards,
> Ivan
>
> [*] https://developer.r-project.org/parseRd.pdf
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list