Skip to content

Commit

Permalink
math
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Jan 14, 2024
1 parent 093066c commit f882757
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vignettes/tutorial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,13 @@ 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:

```{r}
dat <- data.frame(Math = c("\\(x^2 + y^2 = z^2\\)", "\\(\\frac{1}{2}\\)"))
tt(dat)
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`):
Expand Down

0 comments on commit f882757

Please sign in to comment.