-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
First of all, thank you really much for your very useful package !
I faced an issue regarding gt_highlight_cols : it produces wrong colorcodes for LateX as shown in the following reprex.
---
title: "Reprex"
format: pdf
editor: visual
---
```{r}
library(gt)
library(gtExtras)
# Define the start and end dates for the data range
start_date <- "2010-06-07"
end_date <- "2010-06-14"
# Create a gt table based on preprocessed
# `sp500` table data
sp500 |>
dplyr::filter(date >= start_date & date <= end_date) |>
dplyr::select(-adj_close) |>
gt() |>
tab_header(
title = "S&P 500",
subtitle = glue::glue("{start_date} to {end_date}")
) |>
fmt_currency() |>
fmt_date(columns = date, date_style = "wd_m_day_year") |>
fmt_number(columns = volume, suffixing = TRUE)|>
gt_highlight_cols("open", alpha= 0.7, fill="#A9A9A9")
If my understanding is right, rendering in PDF fails because colorscode with alpha are replaced by a rgba function that LateX cannot process. For instance, the first line of the gt is turned into :
Mon, Jun 14, 2010 & {\mdseries \cellcolor[HTML]{rgba(169,169,169,0.7)}{\textcolor[HTML]{000000}{\$1,095.00}}} & \$1,105.91 & \$1,089.03 & \$1,089.63 & 4.43B \\ It can be fixed if replaced with a similar HEX code, for instance "#C0C0C0". The following reprex works fine :
---
title: "Reprex"
format: pdf
editor: visual
---
```{r}
library(gt)
library(gtExtras)
# Define the start and end dates for the data range
start_date <- "2010-06-07"
end_date <- "2010-06-14"
# Create a gt table based on preprocessed
# `sp500` table data
sp500 |>
dplyr::filter(date >= start_date & date <= end_date) |>
dplyr::select(-adj_close) |>
gt() |>
tab_header(
title = "S&P 500",
subtitle = glue::glue("{start_date} to {end_date}")
) |>
fmt_currency() |>
fmt_date(columns = date, date_style = "wd_m_day_year") |>
fmt_number(columns = volume, suffixing = TRUE)|>
gt_highlight_cols("open", fill="#C0C0C0") I hope it helps and it isn't redudant with another issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels