Skip to content

Commit

Permalink
word faq
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Nov 14, 2024
1 parent 4f2e5a7 commit 6fdc84e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
5 changes: 1 addition & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

## Development


Misc:

* `theme_tt("spacing")`: Change the row and column spacing to create more compact or airy tables. LaTeX and HTML only. Thanks to @statzhero for feature request #353.
* Major refactor of the style internals. HTML, LaTeX, and Typst documents should be much more concise and efficient.
* `theme_tt("spacing")`: Change the row and column spacing to create more compact or airy tables. LaTeX and HTML only. Thanks to @statzhero for feature request #353.
* `style_tt()`: the `i` and `j` indices are now consistent in all formats. They refer to rows *after* the insertion of row groups.
* `save_tt()` respects `options(tinytable_save_overwrite=TRUE)`
* LaTeX: Guard header rows when using `style_tt(align="d")`. Issue #367
Expand Down
2 changes: 1 addition & 1 deletion README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## What?

`tinytable` is a small but powerful `R` package to draw beautiful tables in a variety of formats: HTML, LaTeX, Word, PDF, PNG, Markdown, and Typst. The user interface is minimalist and easy to learn, while giving users access to powerful frameworks to create endlessly customizable tables.
`tinytable` is a small but powerful `R` package to draw beautiful tables in a variety of formats: HTML, LaTeX, Word^[Styling options in Word are somewhat limited. See the FAQ page and the `style_tt()` documentation for details.], PDF, PNG, Markdown, and Typst. The user interface is minimalist and easy to learn, while giving users access to powerful frameworks to create endlessly customizable tables.

<https://vincentarelbundock.github.io/tinytable/>

Expand Down
34 changes: 34 additions & 0 deletions vignettes/faq.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,37 @@ These arguments are already implemented in the form of "pseudo-spans", meaning t
One alternative would be to remove line segments in finalize_grid(). I tried this but it is tricky and the results were brittle, so I rolled it back. I'm open to considering a PR if someone wants to contribute code, but please discuss the feature design in an issue with me before working on this.



## Word (`.docx`)

Word document documents are created in two steps:

1. Generates a markdown table.
2. Call the external [Pandoc software](https://pandoc.org/) to convert the markdown table to a Word document.

This workflow limits the range of styling options available in Word. Indeed, many arguments in the `style_tt()` function do not have formal markdown notation to represent them, and are thus not available. For example, while `italic`, `bold`, and `strikeout`, are supported, `color` and `background` are not.

Note that other `tinytable` functions such as `group_tt()` and `format_tt()` and `plot_tt()` should work as expected in Word.

Users who want full styling capabilities in Word can save tables as image files and insert them in their documents. Here is an example Quarto notebook illustrating this workflow.

````verbatim
---
format: docx
---
```{r}
#| out-width: "50%"
library(tinytable)
options(tinytable_save_overwrite = TRUE)
tt(mtcars[1:10, 1:5]) |>
style_tt(j = 2:3, background = "black", color = "white") |>
save_tt("table_01.png")
knitr::include_graphics("table_01.png")
```
````


0 comments on commit 6fdc84e

Please sign in to comment.