Skip to content

Commit fe04924

Browse files
authored
Document a font fix for plotmath expressions under ragg (#2913)
1 parent 5bf33a2 commit fe04924

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* `build_site()` gained a `quiet` argument, which is propagated to other functions
44
(e.g., `build_articles()`) and is useful for debugging build errors on GH actions.
5+
* Added documentation explaining how to solve incorrect rendering of plotmath expressions under ragg devices on Linux. (@remlapmot, #2908)
6+
* Improved the LaTeX syntax in one of the math rendering test cases (@remlapmot)
57

68
# pkgdown 2.1.3
79

R/test.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ NULL
287287
#'
288288
#' Multi-line equation (correctly rendered by katex only):
289289
#'
290-
#' \deqn{\mathit{Minimize} \space l \\
291-
#' \mathit{subject \space to} \\
290+
#' \deqn{\text{Minimize } l \\
291+
#' \text{ subject to } \\
292292
#' \sum_{i = 1}^{I} x_i r_{ij} + y_j \geq t_j \forall j \in J \\
293293
#' l \geq \frac{y_j}{t_j} \forall j \in J \\
294294
#' \sum_{i = 1}^{I} x_i c_i \leq B}{

man/test-math-examples.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/customise.Rmd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,21 @@ template:
235235
math-rendering: katex
236236
```
237237

238+
On Linux the default symbol font is _Standard Symbols PS_. Unfortunately, this font does not render plotmath expressions correctly under pkgdown's default graphics device `ragg::png`. There are several simple solutions to this:
239+
240+
* Before building your site, use the systemfonts package to change the symbol font to one which does render plotmath expressions correctly under ragg such as _Liberation Sans_, e.g.:
241+
242+
```r
243+
systemfonts::register_variant("symbol", "Liberation Sans")
244+
```
245+
246+
* Configure pkgdown to use R's `grDevices::png` device by specifying the following in `_pkgdown.yml`:
247+
248+
```yaml
249+
figures:
250+
dev: grDevices::png
251+
```
252+
238253
### Navbar style
239254

240255
When [light-switch](#light-switch) is disabled, the primary navbar colours are determined by HTML classes, not CSS, and can be customized using the `navbar` fields `bg` and `type` which control the background and foreground colours respectively.

0 commit comments

Comments
 (0)