Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting with $ and <> #236

Merged
merged 4 commits into from
Dec 18, 2023
Merged

Fix formatting with $ and <> #236

merged 4 commits into from
Dec 18, 2023

Conversation

etiennebacher
Copy link
Owner

@etiennebacher etiennebacher commented Dec 18, 2023

Reported in pola-rs/r-polars#605

  • escape the $ in man pages otherwise mkdocs thinks it is a latex equation and doesn't escape symbols between two $
  • add basic code and equation in snapshot test
  • fix wrong replacement for some UTF8 (see the value for 8288)

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 etiennebacher changed the title Patch formatting with $ and <> Fix formatting with $ and <> Dec 18, 2023
@etiennebacher
Copy link
Owner Author

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

@etiennebacher etiennebacher merged commit 5759a64 into main Dec 18, 2023
5 checks passed
@etiennebacher etiennebacher deleted the patch-formatting branch December 18, 2023 17:01
@vincentarelbundock
Copy link
Collaborator

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
Copy link
Owner Author

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
Copy link
Collaborator

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
Copy link
Owner Author

Thanks for the example, I'll fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants