When it comes to using tidyverse in non-American contexts it gets often a little bit tricky. The last time I encountered a problem was when I tried to show the Euro-sign (€) in a PDF created with quarto and the gt-package.

Using html as output format everything was fine, but when I tried to create a PDF the Euro-sign was replaced by EUR.

There’s already an open issue at github ([ https://github.com/rstudio/gt/issues/1345]). But it’s getting pushed further and further down on the list of expected release versions.

So I had to find a workaround. The easiest way for me was to use fmt_number() followed by text_transfor() instead of fmt_currency().

So I format the columns with fmt_number() and then add the Euro-sign using paste0() and the unicode for the Euro-sign (\u20AC).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data %>%
  gt() %>%
  fmt_number(
    columns = c(some_currency_column, another_currency_column),
    sep_mark = ".",
    dec_mark = ",",
  ) %>% 
  text_transform(
    fn = function(x) paste0(x, " \u20AC"),
    locations = cells_body(
      columns = c(some_currency_column, another_currency_column)
    )