Skip to content

Allow addition of footnotes without supplying any locations#925

Merged
rich-iannone merged 14 commits into
masterfrom
tab-footnote-no-location
Apr 22, 2022
Merged

Allow addition of footnotes without supplying any locations#925
rich-iannone merged 14 commits into
masterfrom
tab-footnote-no-location

Conversation

@rich-iannone

Copy link
Copy Markdown
Member

We sometimes find that notes in the footnotes section can be without reference to any particular part of the table. Most often, these notes without marks precede those that do contain marks (it would be confusing to mix the marked and unmarked notes together in any other way, especially if they appear in paragraph form).

This PR makes it so that the default locations parameter is NULL and a footnote (still a required argument) will have no reference to a table cell. The order of tab_footnote() calls is still preserved but is split between location-based footnotes and the non-location variety (which always appears first).

Here is an example:

library(gt)

exibble %>%
  gt() %>%
  tab_footnote(footnote = "A footnote.") %>%
  tab_footnote(
    footnote = "A location note. Appears after the first two notes",
    locations = cells_body(1, 1)
  ) %>%
  tab_footnote(footnote = "A second footnote.") %>%
  opt_footnote_marks(marks = letters) %>%
  tab_options(footnotes.multiline = FALSE)

tab_footnote_pr

Fixes: #879

@rich-iannone rich-iannone changed the title Allow addition of footnotes with supplying any locations Allow addition of footnotes without supplying any locations Apr 15, 2022
@rich-iannone rich-iannone marked this pull request as ready for review April 15, 2022 19:31
@rich-iannone rich-iannone requested a review from jcheng5 April 15, 2022 19:32
Comment thread R/utils_render_latex.R Outdated
@rich-iannone rich-iannone merged commit 1c44483 into master Apr 22, 2022
@rich-iannone rich-iannone deleted the tab-footnote-no-location branch April 22, 2022 21:41
rich-iannone added a commit that referenced this pull request Apr 27, 2022
* master: (36 commits)
  Update documentation
  `devtools::document()` (GitHub Actions)
  Improve layout of examples in documentation (#933)
  Allow addition of footnotes without supplying any `locations` (#925)
  Increment version number to 0.5.0.9000 (#932)
  v0.5.0 Release Candidate (#931)
  Fix for adding summary row styles and footnotes (#924)
  Update _pkgdown.yml
  Rename as `fmt_partsper()`; refactor
  Enhance the `cols_merge_uncert()` function (#888)
  Allow summary rows to be generated in the case of all-`NA` columns (#887)
  Add several testthat tests
  Make corrections/additions to RTF marks
  Update help files using roxygen
  Update documentation
  Update help files using roxygen
  Update _pkgdown.yml
  Update NAMESPACE
  Rename function
  Renumber formatter functions
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow adding footnotes without a location parameter

2 participants