etiennebacher / altdoc

Alternative to pkgdown to document R packages
https://altdoc.etiennebacher.com
Other
62 stars 9 forks source link

Fix formatting with `$` and `<>` #236

Closed etiennebacher closed 8 months ago

etiennebacher commented 8 months ago

Reported in https://github.com/pola-rs/r-polars/issues/605

Not very happy because the output in some docs moves from $ to \$.

@vincentarelbundock this fixes it for polars but it would be great if you could check it this has undesirable side effects on your packages

etiennebacher commented 8 months ago

I'm merging this, it's always possible to pin altdoc to the previous commit

vincentarelbundock commented 8 months ago

Hmm, maybe this is fine? I think the recommended math in .Rd file is \eqn{Beta(\alpha c_{i,j} +\beta, c_{i,j}+\beta)}, and I don't see a Roxygen recommendation to use $$ in a quick googling.

etiennebacher commented 8 months ago

I don't understand if you're ok with this change or not. Just to clarify, this modifies the .qmd file, not the .Rd one

vincentarelbundock commented 8 months ago

I thought it was OK, but I just tried it, and it is not:

processing file: marginal_means.qmd
Quitting from lines 508-578 [unnamed-chunk-1] (marginal_means.qmd)
Error in `parse()`:
! <text>:7:4: unexpected '\\'
6: dat <- mtcars
7: dat\
      ^

The corresponding line in the documentation is just a standard use of retrieving a column with the $ operator in code:

\examples{
library(marginaleffects)

# simple marginal means for each level of `cyl`
dat <- mtcars
dat$carb <- factor(dat$carb)
dat$cyl <- factor(dat$cyl)
dat$am <- as.logical(dat$am)
mod <- lm(mpg ~ carb + cyl + am, dat)

So it looks like you are also substituting in the examples.

etiennebacher commented 8 months ago

Thanks for the example, I'll fix this