Code Monkey home page Code Monkey logo

rlatexmath's Introduction

R build status License: GPL v3 Codecov test coverage Lifecycle: experimental

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

library(rlatexmath)
translate_latexmath(pi)

π

# 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|

related projects

Acknowledgements

rlatexmath's People

Contributors

yiluheihei avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.