as_latex.spar {spork} | R Documentation |
Convert One Spork to Latex
Description
Converts one spork to latex.
See description for as_spork
.
By default, unrecognized tokens are returned
literally. However, Greek symbols and latex
metacharacters are escaped.
See latexToken
.
Usage
## S3 method for class 'spar'
as_latex(
x,
newline = getOption("latex_newline", "\n"),
unrecognized = getOption("latex_unrecognized", spork::latexToken),
token_open = getOption("latex_token_open", "\\textrm{"),
token_close = getOption("latex_token_close", "}"),
math_open = getOption("latex_math_open", "\\mathrm{"),
math_close = getOption("latex_math_close", "}"),
label_open = getOption("latex_label_open", "\\("),
label_close = getOption("latex_label_close", "\\)"),
enforce_math = getOption("latex_enforce_math", TRUE),
script_size = getOption("latex_script_size", c("", "\\scriptsize ", "\\tiny ")),
...
)
Arguments
x |
spar |
newline |
value to replace |
unrecognized |
function to process unrecognized tokens: default |
token_open , token_close |
these wrap text-like portions of the label; the defaults try to give upright characters (non-italic); also passed to |
math_open , math_close |
these wrap math-like portions of the label; the defaults try to give upright characters (non-italic) which may not work for Greek symbols; also passed to |
label_open , label_close |
these wrap the entire label; defaults invoke traditional math mode |
enforce_math |
whether to enforce math mode for nested expression: |
script_size |
three character values, one of which will be appended to token_open for unnested, nested, and multiply-nested contexts |
... |
passed to |
Details
Experimental support is implemented for
the newline character ('\n'
).
Default behavior is to introduce literal
newline characters into the resulting
tex. This may have no effect on the
typeset result. It may be possible
to achieve other effects by using
non-default values of helper arguments
and perhaps additional latex packages.
Value
latex
See Also
Other interface:
as.expression.plotmath()
,
as_html.spar()
,
as_html.spork()
,
as_latex.spork()
,
as_plotmath.spar()
,
as_plotmath.spork()
,
as_previews.spork()
,
as_spork.character()
,
htmlToken()
,
latexToken()
,
plotmathToken()
Other latex:
[.latex()
,
[[.latex()
,
as_latex.greek()
,
as_latex.spork()
,
as_latex()
,
concatenate.latex()
,
latexToken()
Examples
library(magrittr)
'V_c./F' %>% as_spork %>% as_latex
'AUC_ss' %>% as_spork %>% as_latex
'C_max_ss' %>% as_spork %>% as_latex
'var^eta_j' %>% as_spork %>% as_latex
'& % $ # \\_ { } ~ \\^ \\' %>% as_spork %>% as_latex
'one joule (Omega) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_latex
'one joule (`Omega`) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_latex
'one joule (\\`Omega\\`) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_latex