Utility function to add a reference mark to each element of a character vector or matrix. This is an internal function, not intended to be called by package users.
add_refmark(text, textspec, mark, side, raise)
List with components text
and textspec
. The first will be a
character vector or matrix like input text
, updated to include the
reference mark in each string.
Component textspec
will be a character vector or matrix with the
same shape as text
, and value "plain", "plotmath", or "markdown",
according to the contents of text
after adding the reference mark.
Character vector or matrix of text strings to be marked.
Character vector or matrix, parallel to text
, indicating whether
text already contains a plotmath
expression ("plotmath") or
markdown ("markdown"), or is plain text ("plain").
Character string to be used as the reference mark.
On which side of the text should the reference mark be placed, "before" or "after".
Logical scalar. If TRUE, the reference mark will be displayed as a
superscript, using plotmath
notation.
If raise
is TRUE, every element in the returned text will contain
either plotmath or markdown notation. If a text string was originally
"plain", the default is to use markdown if the package option
allowMarkdown
is TRUE, and plotmath otherwise.
It is an error if a "plain" text string contains newline (\n
)
characters but needs to be converted to plotmath to add a reference mark.
(plotmath
ignores newline characters.)
If raise
is FALSE, the textspec
value for each string is the
same as on input.