NOTE: Markdown does not support well for mathematical equations. And some equations not displayed properly in this page, such as $\frac{x}{y}$, $\sqrt[y]{x}$ and $\prod_{i = 1}^{n} x_i$, . See the html vignette for all the correct displayed equations.

Tools for converting R expressions to latex mathematical equations. This project is scratch from the section 21.3 transforms mathematically R code into its LaTeX equivalent.

Usage

Special symbols

π

# quoted object
translate_latexmath_(quote(pi))

π

Known functions

R expression latex math
Binary operators
x + y x + y
x - y x − y
x * y *x**y*
x / y x/y
x %+-% y x ± y
x %/% y x ÷ y
x %*% y x × y
x %.% y x ⋅ y
x
i
xi
x^i xi
Grouping
(x + y) (x+y)
{x y} x + y
Juxtaposition
paste(x, y, z) xyz
Comma separated lists
list(x + y, z) x + y, z
Fractions
frac(x, y) $\\frac{x}{y}$
atop(x, y) $x \\atop y$
Ellipsis
list(x
1
, cdots, x
2
)
x1, ⋯, x2
list(x
1
, ldots, x
2
)
x1, …, x2
Radicals
sqrt(x) $\\sqrt\[\]{x}$
sqrt(x, y) $\\sqrt\[y\]{x}$
Relation
x == y x = y
x != y x ≠ y
x < y x < y
x > y x > y
x >= y x ≥ y
x <= y x ≤ y
x %==% y x ≡ y
x %~~% y x ≈ y
x %=~% y x ≅ y
x %prop% y x ∝ y
Set</>
x %supset% y x ⊃ y
x %supseteq% y x ⊇ y
x %subset% y x ⊂ y
x %notsubset% y x ⊄ y
x %subseteq% y x ⊆ y
x %in% y x ∈ y
x %notin% y x ∉ y
Arrow
x %<->% y x ↔︎ y
x %<-% y x ← y
x %up% y x ↑ y
x %->% y x → y
x %down% y x ↓ y
x %<=>% y x ⇔ y
x %<=% y x ⇐ y
x %dblup% y x ⇑ y
x %=>% y x ⇒ y
x %dbldown% y x ⇓ y
Accent
tilde(x)
hat(x)
widetilde(x)
widehat(x)
bar(x)
Operators
sum(x
i
)
xisum(x
i
, i==1, n)
prod(x
i
)
xi
prod(x
i
, i==1, n)
$\\prod\_{i = 1}^{n} x\_i$
integral(f(x)*{dx}, a, b) abf(x)*d**x*
union(A
i
, i==1, n)
$\\bigcup\_{i = 1}^{n} A\_i$
intersect(A
i
, i==1, n)
$\\bigcup\_{i = 1}^{n} A\_i$
lim(f(x), x %->% infty) limx → ∞f(x)
min(f(x), x >= 0) minx ≥ 0f(x)
max(f(x), x >= 0) maxx ≥ 0f(x)
Typeface
plain(x) x
bold(x) x
italic(x) x
bolditalic(x) x
Delimiters
group(“(”, list(a,b), “]”) (a, b]
bgroup(“
$$", frac(a,b), "$$
”)
$\\left \[ \\frac{a}{b} \\right \]$
abs(x) |x|

Acknowledgements