pgfvalue_value: Parsing Values for PGF Key-Value Pairs

Description Usage Arguments Details Value

Description

The function parses values and key names to be used with PGF key-value pairs by escaping LaTeX special characters, masking output with braces, or checking valid input.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pgfvalue_value(value, mask = FALSE, ...)

## S3 method for class 'character'
pgfvalue_value(value, mask = FALSE, na = NA_character_,
  newlines = FALSE, spaces = FALSE, ...)

## S3 method for class 'pgfvalue_value'
pgfvalue_value(value, mask = FALSE, ...)

## S3 method for class 'logical'
pgfvalue_value(value, mask = FALSE, na = NA_character_,
  ...)

## S3 method for class 'integer'
pgfvalue_value(value, mask = FALSE, na = NA_character_,
  ...)

## S3 method for class 'numeric'
pgfvalue_value(value, mask = FALSE, na = NA_character_,
  ...)

## S3 method for class 'Date'
pgfvalue_value(value, mask = FALSE, na = NA_character_, ...)

## S3 method for class 'POSIXt'
pgfvalue_value(value, mask = FALSE, na = NA_character_,
  time = FALSE, ...)

pgfvalue_key(key)

Arguments

value

value to be parsed, see methods for available classes

mask

if TRUE and value contains "=" or ",", value is masked by curly brackest {...}

...

additional parameter passed to S3 methods

na

character, replacement value for NA characters

newlines

boolean, controls escaping of single new line characters, see details

spaces

boolean, controls behaviour of multiple white spaces, see details

time

boolean, controls return of time part

key

character string, if of length greater one, only first entry will be used

Details

Special characters in character vectors value will be escaped:

  1. backslashes (\) are replaced by \textbackslash

  2. special characters (#, $, %, &, _, {, }) are escaped by prepending a backslash

  3. \textbackslash is appended a pair of curly brackets

  4. tilde (~) and circumflex (^) are replaced by their LaTeX variants \textasciitilde and \textasciicircum

  5. carriage returns are replaced by a new line character

  6. any white spaces are replace by a single space

  7. any leading or trailing spaces will be removed

If spaces = TRUE any multiple spaces are escaped to protected LaTeX spaces (or "control" spaces).

If newlines = TRUE any single line break will be replaces by a LaTeX linebreak (\).

Key names may contain any alpha-numeric characters as well as white spaces (leading and trailing ones will be omitted) and special characters ., _, $, or /. The latter two are used as path separators. Any part of key before the last / or $ is used as path.

Value

an object of class pgfvalue_value; The initial class of value will be, if it does not already contain pgfvalue_value expanded by pgfvalue_value.

Return values that contain equal signs, colons, or new line characters can be masked with curly brackets if mask = TRUE. If mask = TRUE and return value is already masked, not additional braces will be added. If mask = TRUE and return value does not contain special characters, masking braces will be removed.

For value of type pgfvalue_value and mask = FALSE, the return value will remain unchanged.

Numeric values will be returned in "fixed point" decimal notation with decimal mark being a dot.

Date values are returned in ISO 8601 format, see %F formatting string in strptime.

Date time values are returned as date values only if time = FALSE (the default). Otherwise, format will be YYYY-MM-DDThh:mm:ss, see %F and %X formatting string in strptime.

Function pgfvalue_key returns a valid name of the key as an object of class pgfvalue_key. If a path name is included in key, see details, it is set as attribute path.


mlkornexl/pgfKeys documentation built on May 14, 2019, 2:17 p.m.