sds_character: Render a special character in either html or latex as...

View source: R/sds_character.R

sds_characterR Documentation

Render a special character in either html or latex as appropriate.

Description

Given a character from a special unicode or other font, translate it into a tex command if needed.

Usage

sds_character(
  char,
  show = FALSE,
  format = ifelse(knitr::is_latex_output(), "latex", "html")
)

Arguments

char

the character, as a quoted string

show

if TRUE, return a vector showing the available characters. Not intended for use in documents, just to help identify when a character you want to use is missing.

format

either "html" or "latex". Default uses knitr::is_latex_output()

Details

The point of this function is to let you use native characters in html mode, but avoid characters that latex doesn't recognize by using the corresponding latex command when in latex mode. Why not just use the latex command in both cases. That's not a bad practice, but it causes problems when trying to create a Kindle edition, since Kindle doesn't process latex.

Examples

sds_character("♣", format = "latex")
sds_character(show = TRUE)


dtkaplan/SDSdata documentation built on June 28, 2022, 8:09 a.m.