On 21/07/2023 11:34 a.m., Antoine Fabri wrote:
Do I understand correctly that we don't want Rd files to be valid latex ?
Yes, it needs to be valid Rd format, which is "a simple markup language
much of which closely resembles (La)TeX". For more details see section
2.1 of Writing R Extensions, which includes links to even more detail.
Duncan Murdoch
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.r...@gmail.com> a écrit :
В Fri, 21 Jul 2023 15:14:09 +0200
Antoine Fabri <antoine.fa...@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]]
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel