Hello,
I have encountered some weird issues regarding formatting numbers in a gt::gt()
object, which is knitted to pdf via tinytex and quarto. See this little example:
---
title: "Reprex"
format:
pdf:
mainfont: Arial
sansfont: Times New Roman
---
## A Header in Times New Roman
\```{r}
#| label: theIssue
mtcars[,1:3] |>
head(6) |>
gt::gt() |>
gt::fmt_number(columns = 1, decimals = 3) |>
gt::tab_options(table.font.size = gt::px(6))
\```
Normal text in Arial.
If I look at the output, the non formatted numbers are in standard Arial, while the formatted numbers are in italic style. A closer look on the raw .tex file reveals, that the formatted numbers are converted to math mode - they all are encapsulated in $.
Is there anybody who can guide me into the right direction, how to force gt
to not encapsulate the formatted numbers in math mode but instead just show them in a formatted fashion? Should I transform all numbers to characters beforehand and see if it works (the main issue is, that the number of decimals in my "real" table is different between rows - e.g. the rows in a column are alternating between integers (no decimal needed) and percentages (one digit needed)).
Thanks in advance and kind regards