font {huxtable}R Documentation

Set the font for cell text

Description

Set the font for cell text

Usage

font(ht)
font(ht) <- value
set_font(ht, row, col, value )
map_font(ht, row, col, fn)

Arguments

ht

A huxtable.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

fn

A mapping function. See mapping-functions for details.

value

A character vector or matrix.

Set to NA to reset to the default, which is "NA".

Details

To find out what fonts are on your system, systemfonts::match_font() is useful.

For HTML, you can use comma-separated lists of font names like "Times New Roman, Times, Serif". This is not portable, though.

LaTeX and HTML use different font names. To use the same font names across document formats, see options("huxtable.latex_use_fontspec") in huxtable-options.

Value

font() returns the font property. set_font() returns the modified huxtable.

See Also

Other formatting functions: background_color(), bold(), font_size(), na_string(), number_format(), text_color()

Examples


font(jams) <-  "times"
font(jams)

jams2 <- set_font(jams,
      "arial")
font(jams2)

jams3 <- set_font(jams,
      2:3, 1, "arial")
font(jams3)

jams4 <- map_font(jams,
      by_rows(
        "arial",
        "times")
      )
font(jams4)

[Package huxtable version 5.5.6 Index]