Skip to content

Conversation

@rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented May 27, 2021

It would seem that the underlying bug that resulted in a LaTeX building error (when subtitle was NULL when calling tab_header()) has been solved (initial testing here confirms it's not a problem in v0.3.0). However, this PR is an opportunity to refactor the HTML and LaTeX rendering functions for the header component.

This guards against a LaTeX error that can occur if an empty string or a string entirely composed of spaces is provided in subtitle. The low-level dt_heading_has_subtitle() function has extra checks for these types of inputs. This also fixes HTML rendering when there's no subtitle since HTML markup with an empty string would be generated, resulting in extra vertical space upon rendering.

Several testthat snapshot tests were added.

Fixes: #463
Fixes: #623

@rich-iannone rich-iannone requested a review from jcheng5 May 30, 2021 00:48
@rich-iannone rich-iannone merged commit 5ff07ff into master Jun 7, 2021
@rich-iannone rich-iannone deleted the empty-latex-subtitle branch June 7, 2021 19:00
rich-iannone added a commit that referenced this pull request Jun 7, 2021
* master:
  Add the `fmt_engineering()` and `fmt_integer()` formatter functions (#758)
  HTML summary row styling fix (#782)
  Refactor and improve rendering of title/subtitle components in HTML/LaTeX tables (#779)
rich-iannone added a commit that referenced this pull request Jun 11, 2021
* master: (24 commits)
  Fix for possible column name duplication when generating summary rows (#792)
  Change the `data` arg to `.data` to avoid partial matching issues (#772)
  Add the `force_sign` arg to several numeric formatters (#793)
  Add the `fmt_engineering()` and `fmt_integer()` formatter functions (#758)
  HTML summary row styling fix (#782)
  Refactor and improve rendering of title/subtitle components in HTML/LaTeX tables (#779)
  LaTeX bugfix for summary rows, and, implementation of grand summary rows (#768)
  Reinstate once failing test
  Include stub var in resolution of visible vars
  Use `seq_len()` instead of `seq()`
  Fix typo in README (#765)
  Increment version number (#762)
  Increase version number
  Documentation fixes (#759)
  Add missing topics to _pkgdown.yml
  Add `accounting` options for `fmt_percent()` and `fmt_number()` (#756)
  Simplify arguments for RTF page numbering
  Add the `fmt_bytes()` formatter function (#750)
  Simplify page numbering text
  Add testthat snapshot tests for RTF page numbering
  ...
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.

Can't get table to knit to pdf when using tab_header() Bug: Detecting a subtitle when none present - fails to knit to latex.

3 participants