align: Return or set text alignment

Description Usage Arguments Value Examples

View source: R/properties.R

Description

These property functions modify or return the text alignment in a hf_line object. Supported options are: 'left', 'right', 'center', and 'split'.

An alignment option of 'split' requires that two text elements are provided in the titles/footnotes hf_line object. The first text element will be aligned on the left and the second on the right.

Usage

1
2
3
4
5
align(x, ...)

align(x) <- value

set_align(x, value)

Arguments

x

hf_line object

...

Additional arguments passed to method dispatch.

value

A string representing the alignment.

Value

For align(), the alignment of the supplied hf_line object. For set_align() and `align<-`(), the modified object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(huxtable)
ht <- huxtable(
  column1 = 1:5,
  column2 = letters[1:5]
)
rtf <- rtf_doc(ht, list(hf_line("aTitle")))

pharmaRTF::align(rtf$titles[[1]])
# Returns "center"

pharmaRTF::align(rtf$titles[[1]]) <- "left"
# Sets alignment to 'left'

pharmaRTF::text(rtf$titles[[1]]) <- c("Left Text", "Right Text")
pharmaRTF::align(rtf$titles[[1]]) <- "split"
# When rtf is printed, "Left Text" will be left aligned, and "Right Text"
# will be right aligned. Both will appear on the same line in the document.

pharmaRTF documentation built on Sept. 28, 2021, 5:08 p.m.