Create a paragraph representation by concatenating formatted text or images. The result can be inserted in a Word document or a PowerPoint presentation and can also be inserted in a block_list() call.

All its arguments will be concatenated to create a paragraph where chunks of text and images are associated with formatting properties.

fpar supports ftext(), external_img(), run_* functions (i.e. run_autonum(), run_seqfield()) when output is Word, and simple strings.

Default text and paragraph formatting properties can also be modified with function update().

fpar(..., fp_p = fp_par(), fp_t = fp_text_lite(), values = NULL)

# S3 method for fpar
update(object, fp_p = NULL, fp_t = NULL, ...)

Arguments

...

cot objects (ftext(), external_img())

fp_p

paragraph formatting properties, see fp_par()

fp_t

default text formatting properties. This is used as text formatting properties when simple text is provided as argument, see fp_text().

values

a list of cot objects. If provided, argument ... will be ignored.

object

fpar object

See also

Examples

fpar(ftext("hello", shortcuts$fp_bold()))
#> $chunks #> $chunks[[1]] #> text: hello #> format: #> size italic bold underlined color shading fontname fontname_cs #> 1 10 FALSE TRUE FALSE black transparent Arial Arial #> fontname_eastasia fontname.hansi vertical_align #> 1 Arial Arial baseline #> #> #> $fp_p #> values #> text.align left #> padding.top 0 #> padding.bottom 0 #> padding.left 0 #> padding.right 0 #> shading.color transparent #> borders: #> width color style #> top 0 black solid #> bottom 0 black solid #> left 0 black solid #> right 0 black solid #> #> $fp_t #> size italic bold underlined color shading fontname fontname_cs #> 1 NA NA NA NA NA NA NA NA #> fontname_eastasia fontname.hansi vertical_align #> 1 NA NA baseline #> #> attr(,"class") #> [1] "fpar" "block"
# mix text and image ----- img.file <- file.path( R.home("doc"), "html", "logo.jpg" ) bold_face <- shortcuts$fp_bold(font.size = 12) bold_redface <- update(bold_face, color = "red") fpar_1 <- fpar( "Hello World, ", ftext("how ", prop = bold_redface ), external_img(src = img.file, height = 1.06/2, width = 1.39/2), ftext(" you?", prop = bold_face ) ) fpar_1
#> $chunks #> $chunks[[1]] #> [1] "Hello World, " #> #> $chunks[[2]] #> text: how #> format: #> size italic bold underlined color shading fontname fontname_cs #> 1 12 FALSE TRUE FALSE red transparent Arial Arial #> fontname_eastasia fontname.hansi vertical_align #> 1 Arial Arial baseline #> #> $chunks[[3]] #> [1] "/opt/R/4.1.1/lib/R/doc/html/logo.jpg" #> attr(,"class") #> [1] "external_img" "cot" "run" #> attr(,"dims") #> attr(,"dims")$width #> [1] 0.695 #> #> attr(,"dims")$height #> [1] 0.53 #> #> attr(,"alt") #> [1] "" #> #> $chunks[[4]] #> text: you? #> format: #> size italic bold underlined color shading fontname fontname_cs #> 1 12 FALSE TRUE FALSE black transparent Arial Arial #> fontname_eastasia fontname.hansi vertical_align #> 1 Arial Arial baseline #> #> #> $fp_p #> values #> text.align left #> padding.top 0 #> padding.bottom 0 #> padding.left 0 #> padding.right 0 #> shading.color transparent #> borders: #> width color style #> top 0 black solid #> bottom 0 black solid #> left 0 black solid #> right 0 black solid #> #> $fp_t #> size italic bold underlined color shading fontname fontname_cs #> 1 NA NA NA NA NA NA NA NA #> fontname_eastasia fontname.hansi vertical_align #> 1 NA NA baseline #> #> attr(,"class") #> [1] "fpar" "block"
img_in_par <- fpar( external_img(src = img.file, height = 1.06/2, width = 1.39/2), fp_p = fp_par(text.align = "center") )