escape_latex: Escape Special Characters for Latex

escape_latexR Documentation

Escape Special Characters for Latex

Description

Escapes special characters in Latex context. Operates element-wise, using escape_latex.default or escape_latex.latex depending on whether the element appears to be latex-formatted.

Usage

escape_latex(x, ...)

Arguments

x

typically inherits character

...

passed arguments

Details

An element is considered latex-formatted if it begins with "\(" or "". Note that even though latex-like elements likely have already had reserved characters escaped, escape_latex.latex will attempt to fix certain anticipated escaping issues. The function escape_latex.default performs conventional escaping; the result is prepended with "" as a signal to downstream processes that the text is considered latex-ready (and needn't be escaped again).

Value

character

See Also

Other escape: escape_latex.default(), escape_latex.latex()

Examples

  escape_latex(
    c(
      '',
      ' ',
      '\t',
      '{}a',
      NA,
      '\\()',
      '3%'
    )
  )

tablet documentation built on July 19, 2026, 9:06 a.m.