Skip to content

Commit

Permalink
math in $$ is the new recommendation
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Jan 24, 2024
1 parent c3f26a8 commit c053800
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: tinytable
Type: Package
Title: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', and 'PNG' Formats
Description: Create highly customized tables with this simple and dependency-free package. Data frames can be converted to 'HTML', 'LaTeX', 'Markdown', 'Word' or 'PNG' tables. The user interface is minimalist and the syntax concise. 'HTML' tables can be customized using the flexible 'Bootstrap' framework, and 'LaTeX' code with the 'tabularray' package.
Version: 0.0.1.9000
Version: 0.0.1.9001
Depends:
R (>= 4.1.0)
Enhances:
Expand Down
1 change: 1 addition & 0 deletions README.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


<p align="center">
<img src="man/figures/gallery/tinytable_gallery.gif" height = "250" class = "center">
<br>
Expand Down
6 changes: 3 additions & 3 deletions vignettes/tutorial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,12 @@ 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 contexts, which can cause rendering errors. In that spirit, `tinytable` will not render dollar-enclosed strings as mathematical expressions in HTML. Following the default MathJax settings, `tinytable` expects users to employ the escaped parentheses strategy:
To insert LaTeX-style mathematical expressions in a `tinytable`, we enclose the expression in dollar signs: `$...$`. The expression will then rendered as a mathematical expression by MathJax (for HTML), LaTeX, or Pandoc. Do not forget to double escape any backslashes.

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

0 comments on commit c053800

Please sign in to comment.