Skip to content

Commit

Permalink
Merge branch 'main' into issue355
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Dec 13, 2024
2 parents 8d67ac4 + dd0ae48 commit 6961d86
Show file tree
Hide file tree
Showing 174 changed files with 4,622 additions and 3,582 deletions.
5 changes: 2 additions & 3 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ README.qmd
man-roxygen
Makefile
.quarto
vignettes/.*\.qmd$
vignettes/.*\.bib$
vignettes/
docs/
docs
.github
Expand All @@ -20,4 +19,4 @@ tinytable_assets
^man/figures/.*\\.png$
^man/figures/gallery/.*\\.png$
sandbox/

vignettes/
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# produced vignettes
vignettes/*.html
vignettes/*.pdf
sandbox/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth
Expand Down Expand Up @@ -51,8 +52,9 @@ tinytable_assets
cran-comments.md
CRAN-SUBMISSION

sandbox/typst.typ
sandbox/typst.pdf
sandbox/*.typ
sandbox/*.pdf
sandbox/*.tex


!_quarto/_freeze/
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: tinytable
Type: Package
Title: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats
Description: Create highly customized tables with this simple and dependency-free package. Data frames can be converted to 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', or 'Typst' tables. The user interface is minimalist and easy to learn. The syntax is concise. 'HTML' tables can be customized using the flexible 'Bootstrap' framework, and 'LaTeX' code with the 'tabularray' package.
Version: 0.5.0.4
Version: 0.6.1.4
Imports:
methods
Depends:
Expand All @@ -20,6 +20,7 @@ Suggests:
pandoc,
quarto,
rmarkdown,
rstudioapi,
scales,
stringi,
tibble,
Expand All @@ -30,8 +31,8 @@ Suggests:
URL: https://vincentarelbundock.github.io/tinytable/
BugReports: https://github.com/vincentarelbundock/tinytable/issues
Authors@R: c(
person("Vincent", "Arel-Bundock",
email = "[email protected]",
person("Vincent", "Arel-Bundock",
email = "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2042-7063")))
License: GPL (>= 3)
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ installdep: document ## install with Suggests
test: install ## test
Rscript -e "library(tinytable);tinytest::run_test_dir()"

website: install ## render vignettes and website
typst: ## compile typst example
quarto render sandbox/typst.qmd

website: install typst ## render vignettes and website
rm -rf _quarto
rm -rf docs
Rscript -e "altdoc::render_docs(verbose = TRUE, freeze = TRUE, autolink = TRUE)"
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(knitr::knit_print, tinytable)
S3method(print,tinytable)
export(format_tt)
export(group_tt)
Expand Down
32 changes: 27 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,34 @@

## Development

Breaking change:

* `format_tt()` is now stricter, applying no formatting at all by default. Users must specify an argument explicitly or set a global option to change the table.

Bugs:

* `save_tt("file.pdf")` works with colors. Thanks to @olivedv for the report and solution #395.

New:

* `style_tt("notes")` and `style_tt("caption")` can style footnotes and captions. Note: This will only style captions handled by the `caption` argument in `tt()`, and not captions created by Quarto.

Misc:

* Documentation improvements

## 0.6.1

* Bug fix: d-column LaTeX generated an error in some cases.

## 0.6.0

* 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
* Inline display in Quarto and Rmarkdown notebooks. `options(tinytable_print_rstudio_notebook = "inline")` or `"viewer"`

Bugs:

Expand Down Expand Up @@ -79,7 +101,7 @@ MathJax = {
* `format_tt(num_big_mark)` applies to integer columns.
* Use `getOption("viewer")` instead of `rstudioapi::viewer()` for positron support
* `glue::glue()` string is accepted by `format_tt()`. Thanks to @LukasWallrich for report #792 on the `modelsummary` repository.
* Support Github Flavored Markdown (`gfm`) output. Thanks to @kylebutts for contribution #315.
* Support Github Flavored Markdown (`gfm`) output. Thanks to @kylebutts for contribution #315.
* `theme_tt("rotate")` to rotate tables in LaTeX or Typst.
* `save_tt("/path/to/file")` returns the file path invisibly. Thanks to @yjunechoe for issue #328.

Expand Down Expand Up @@ -184,7 +206,7 @@ New features:

* `rbind()` and `rbind2()` can be used to stack `tinytable` objects. `rbind2()` is more flexible than `rbind()`. See `?tinytable::rbind2`
* New output format in `print()`: "dataframe"
* Rename table headers: `colnames(tab) <- c("a", "b", "c")`
* Rename table headers: `colnames(tab) <- c("a", "b", "c")`
* `theme_tt("resize")` gets a `direction` argument with "up", "down", "both" options. Thanks to @MarcoPortmann for feature request #207

Minor:
Expand All @@ -203,7 +225,7 @@ New function `theme_tt()`:

* Function to apply collections of transformations to a `tinytable`.
* Visual themes:
- grid, void, striped, bootstrap, default
- grid, void, striped, bootstrap, default
* `resize`: Insert a LaTeX table in a `resizebox` environment to ensure a table fits the page, or to scale it to a fraction of `\linewidth`
* `placement`: Determine where a LaTeX table float is positioned. Ex: `[H]`, `[htbp]`
* `multipage`: Split long LaTeX tables across multiple pages with (optional) repeated headers/footers. Uses the `longtblr` environment from `tabularray`.
Expand Down Expand Up @@ -271,7 +293,7 @@ Bugfix:

New:

- `Typst` tables are now supported using the `tablex` extension:
- `Typst` tables are now supported using the `tablex` extension:
- https://typst.app/
- https://github.com/PgBiel/typst-tablex
- `escape` argument in `format_tt()` escapes or substitutes special characters in LaTeX or HTML output to prevent compilation and rendering errors.
Expand Down Expand Up @@ -302,7 +324,7 @@ Bug fixes:

Documentation:

- Improved vignette on the package website.
- Improved vignette on the package website.
- Various documentation updates.
- Math in $$ is the new recommendation.

Expand Down
14 changes: 5 additions & 9 deletions R/build_tt.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
build_tt <- function(x, output = NULL) {
output <- sanitize_output(output)


x <- switch(output,
html = swap_class(x, "tinytable_bootstrap"),
latex = swap_class(x, "tinytable_tabularray"),
Expand All @@ -17,22 +18,17 @@ build_tt <- function(x, output = NULL) {

x@output <- output

# apply the style_notes
x <- style_notes(x)
x <- style_caption(x)

for (th in x@lazy_theme) {
fn <- th[[1]]
args <- th[[2]]
args[["x"]] <- x
x <- do.call(fn, args)
}

# groups must increment indices here
for (idx in seq_along(x@lazy_group)) {
l <- x@lazy_group[[idx]]
x@nrow <- x@nrow + length(l$i)
if (length(l$j) > 0) {
x@nhead <- x@nhead + 1
}
}

tab <- x@table_dataframe

# strip ANSI from `tibble`/`pillar`; keep for markdown
Expand Down
Loading

0 comments on commit 6961d86

Please sign in to comment.