rstudio/rmarkdown-cookbook

Print LaTeX command in HTML

cderv opened this issue · 0 comments

cderv commented

See rstudio/rmarkdown#2420

```{r}
#| label: html-specific
#| echo: false
#| include: false
#| eval: true

latexString <- if (knitr::is_html_output()) {
  r"($\mathrm{\LaTeX{}}$)"
} else {
  r"(\LaTeX{})"
}
```

Then use `r latexString` in the text.