When writing for publication, I greatly prefer the tikzDevice
functionality of knitr
, as it renders my plots in the same font as the document (among other things). I see that Quarto does this nicely in the PDF rendering. Here's a MWE:
---
title: "Untitled"
format:
pdf: default
html: default
editor: visual
---
See the example in @fig-example
```{r, dev = 'tikz'}
#| label: fig-example
#| fig-cap: Example figure.
library(ggplot2)
p <- ggplot(mtcars, aes(wt, mpg))
p + geom_point()
```
But when rendering to html, it tries to embed the PDF of the figure in a window:
In bookdown, I could do something like dev = if(knitr::is_latex_output()){'tikz'}}
but that doesn't seem to work in Quarto. I can also set the device with the global
chunk option
knitr:
opts_chunk:
dev: 'tikz'
But this seems to apply to both PDF and html as well.