Skip to content

Commit

Permalink
mathjax
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Jan 14, 2024
1 parent f882757 commit 9856a2c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions vignettes/tutorial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,14 @@ tt(x, notes = list(a = "Blah.", b = "Blah blah."))

## Math

In LaTeX and MathJax (for HTML), there are two main ways to enclose mathematical expressions, either between dollar signs or escaped parentheses: `$...$` or `\(...\)`. The first strategy [is discouraged by MathJax,](https://docs.mathjax.org/en/latest/basic/mathematics.html) because dollar signs are very common in non-mathematical context, which can cause rendering errors. In that spirit, `tinytable` will not render dollar-enclosed expressions as mathematical expressions in HTML. Instead, we recommend that you use the other strategy instead:

You can render equations inside tables using the common `$...$` syntax:
In LaTeX and MathJax (for HTML), there are two main ways to enclose mathematical expressions, either between dollar signs or escaped parentheses: `$...$` or `\(...\)`. The first strategy [is discouraged by MathJax,](https://docs.mathjax.org/en/latest/basic/mathematics.html) because dollar signs are very common in non-mathematical contexts, which can cause rendering errors. In that spirit, `tinytable` will not render dollar-enclosed expressions as mathematical expressions in HTML. Following the default MathJax settings, `tinytable` expects users to employ the escaped parentheses strategy:

```{r}
dat <- data.frame(Math = c("\\( x^2 + y^2 = z^2 \\)", "\\( \\frac{1}{2} \\)"))
tt(dat, align = "c")
```

In LaTeX (PDF), you can also use the `mode` inner setting from `tabularray` to render math in tables without $ delimiters (see @sec-tabularray for details on `tabularray`):
In LaTeX (PDF), you can also use the `mode` inner setting from `tabularray` to render math in tables without delimiters (see @sec-tabularray for details on `tabularray`):

```{r, eval = knitr::is_latex_output()}
dat <- data.frame(Math = c("x^2 + y^2 = z^2", "\\frac{1}{2}"))
Expand Down

0 comments on commit 9856a2c

Please sign in to comment.