gt fmt_percent to PDF not rendering in chosen font

Hello,
I am writing a report that I wish to be able to publish to html and pdf. I would like to use some of the numeric color formatting options in gt. However, when I format percents on a janitor :: tabyl after the gt(), the percent column does not render in the chosen font. The percent column renders in the chosen font if I use the janitor::adorn_functions. But that changes the column to a charachter vector before the gt(), making the gt color options (e.g. data_color) not workable. Any ideas to get the font to print correctly after the gt ::fmt_percent()? I've tried gt: as_latex and that didn't help.

title: "Untitled"
format: pdf
includes:
      in_header: 'gt_packages.sty'
editor: visual
monofont: Roboto
mainfont: Roboto
______
library(tidyverse)
library(janitor)
library(gt)

With gt formatting:


pizza1 <- pizzaplace %>% 
  tabyl(name) %>% 
  gt() %>%
fmt_percent(columns = "percent", decimals = 2)

with tabyl formating

pizza <- pizzaplace %>% 
  tabyl(name) %>% 
  adorn_pct_formatting(digits = 2) %>% 
  gt() 

Rendering PDF
running xelatex - 1
This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode

Can you format your code example correctly ?

This will be easier for us to run the example and see what is happening.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.