addLineBreakToCaption: addLineBreakToCaption

addLineBreakToCaptionR Documentation

addLineBreakToCaption

Description

Add line breaks to get prettier captions

Usage

addLineBreakToCaption(
  captions,
  maxLines = reEnv$maxLinesPerLegendCaption,
  width = reEnv$maxWidthPerLegendCaption
)

Arguments

captions

Array of character strings to render

maxLines

Maximum number of lines directly setting the maximum number of line breaks allowed.

width

Maximum number of characters per line desired. Due to 'maxLines', the returned width can be wider than 'width'.

Value

A character vector of wrapped strings with line breaks at sensible places.

Examples

# Use cat to display result of line break character
cat(addLineBreakToCaption("this-is-a-long-sentence-with-dashes", maxLines = 2, width = 25))

cat(addLineBreakToCaption("this is a sentence with spaces", maxLines = 2, width = 25))

cat(addLineBreakToCaption(
  "this_is_a_long_sentence_without_preferential_splits",
  maxLines = 2, width = 25
))

cat(addLineBreakToCaption("this too short to split", maxLines = 3, width = 40))

cat(addLineBreakToCaption("this forces the sentence to use one line", maxLines = 1, width = 5))


Open-Systems-Pharmacology/OSPSuite.ReportingEngine documentation built on March 30, 2024, 4:17 p.m.