v0.2.2
New features
-
The new
opt_table_font()function makes it possible to define a custom font for the entire gt table. The standard fallback fonts are still set by default but the font defined here will take precedence. You could still have different fonts in select locations in the table, and for that you would need to usetab_style()in conjunction with thecell_text()helper function. The newgoogle_font()helper function provides an option for supplying a font available at the Google Fonts service (this is in addition to using system fonts in thefontargument). Using theinfo_google_fonts()function will provide a table with a set of helpful font recommendations from the Google Fonts catalog. The newdefault_fonts()functions provides a helpful vector of system fallback fonts which works well when defining a vector of fonts. (#591) -
The new
opt_css()function makes allows for the addition of custom CSS to a gt table. This CSS will be added after the compiled CSS that gt generates automatically when thegt_tblobject is transformed to an HTML output table. You can supplycssas a vector of lines or as a single string. Thecss()function has been re-exported from htmltools to make it easier to build CSS style declarations. (Also #591) -
Setting the widths of table columns is now easier and more dependable with
cols_width(). Widths can be expressed in units of pixels (easily set by use of thepx()helper function), as percentages (where thepct()helper function is useful), or a mixture of the two. The function takes into consideration whether an overall table width has been provided withtab_options(table.width = ...). Providing pixel widths for all columns serves to override any table width defined (yielding columns with the exact widths specified). (#561) -
There are new options for numeric formatting: (1) using significant figures (with
n_sigfiginfmt_number), and (2) the ability to retain/drop trailing decimal marks (withdrop_trailing_dec_markinfmt_number(),fmt_percent(), andfmt_currency()). Thank you @drolejoel for the suggestion in #535! (#546). -
The new
scale_valuesargument forfmt_percent()makes it easy to use values that are already scaled (and just require the percent mark). Thank you @djohn215 for the suggestion in #559. (#565) -
Font weights expressed as numeric values (e.g.,
400,600, etc.) incell_text()'sweightargument now works properly. (#591)