diff --git a/R/style_tt.R b/R/style_tt.R index 0313f690..d91c2772 100644 --- a/R/style_tt.R +++ b/R/style_tt.R @@ -3,7 +3,7 @@ #' @details #' This function applies styling to a table created by `tt()`. It allows customization of text style (bold, italic, monospace), text and background colors, font size, cell width, text alignment, column span, and indentation. The function also supports passing native instructions to LaTeX (tabularray) and HTML (bootstrap) formats. #' -#' Warning: Markdown and Word formats are limited to these styles: italic, bold, strikeout. This is because there is no markdown syntax for the other options, and because we create Word documents by converting a markdown table to .docx via the Pandoc software. +#' Note: Markdown and Word tables only support these styles: italic, bold, strikeout. Moreover, the `style_tt()` function cannot be used to style headers inserted by the `group_tt()` function; instead, you should style the headers directly in the header definition using markdown syntax: `group_tt(i = list("*italic header*" = 2))`. These limitations are due to the fact that there is no markdown syntax for the other options, and that we create Word documents by converting a markdown table to .docx via the Pandoc software. #' #' @param x A table object created by `tt()`. #' @param i Row indices where the styling should be applied. Can be a single value or a vector. `i=0` is the header, and negative values are higher level headers. If `colspan` is used, `i` must be of length 1. diff --git a/man/style_tt.Rd b/man/style_tt.Rd index 14a32848..1e51b8eb 100644 --- a/man/style_tt.Rd +++ b/man/style_tt.Rd @@ -121,7 +121,7 @@ Style a Tiny Table \details{ This function applies styling to a table created by \code{tt()}. It allows customization of text style (bold, italic, monospace), text and background colors, font size, cell width, text alignment, column span, and indentation. The function also supports passing native instructions to LaTeX (tabularray) and HTML (bootstrap) formats. -Warning: Markdown and Word formats are limited to these styles: italic, bold, strikeout. This is because there is no markdown syntax for the other options, and because we create Word documents by converting a markdown table to .docx via the Pandoc software. +Note: Markdown and Word tables only support these styles: italic, bold, strikeout. Moreover, the \code{style_tt()} function cannot be used to style headers inserted by the \code{group_tt()} function; instead, you should style the headers directly in the header definition using markdown syntax: \code{group_tt(i = list("*italic header*" = 2))}. These limitations are due to the fact that there is no markdown syntax for the other options, and that we create Word documents by converting a markdown table to .docx via the Pandoc software. } \section{LaTeX preamble}{ diff --git a/vignettes/tutorial.qmd b/vignettes/tutorial.qmd index ec3a1af6..b4006ad8 100644 --- a/vignettes/tutorial.qmd +++ b/vignettes/tutorial.qmd @@ -701,6 +701,24 @@ tt(dat, theme = "void") |> ``` +## Markdown and Word + +Styling for Markdown and Word tables is more limited than for the other formats. In particular: + +* The only supported arguments are: `bold`, `italic`, and `strikeout`. +* Headers inserted by `group_tt()` cannot be styled using the `style_tt()` function. + +These limitations are due to the fact that there is no markdown syntax for the other options (ex: colors and background), and that we create Word documents by converting a markdown table to .docx via the Pandoc software. + +One workaround is to style the group headers directly in their definition by using markdown syntax: + +```{r} +mtcars[1:4, 1:4] |> + tt() |> + group_tt(i = list("*Hello*" = 1, "__World__" = 3)) |> + print("markdown") +``` + # Plots and images