Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Feb 10, 2024
1 parent 9dc97dd commit 1698a04
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/style_tt.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion man/style_tt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions vignettes/tutorial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1698a04

Please sign in to comment.