Skip to content

akoutmos/ratex

Repository files navigation

Ratex Logo

Generate SVGs and PNGs of mathematical expressions using RaTeX

Hex.pm GitHub Workflow Status (master) Coveralls master branch Support the project


Contents

Installation

Available in Hex, the package can be installed by adding ratex to your list of dependencies in mix.exs:

def deps do
  [
    {:ratex, "~> 0.2.0"}
  ]
end

Documentation can be found at https://hexdocs.pm/ratex.

Example Output

After setting up Ratex in your application you can use the Ratex functions in order to generate images of mathematical expressions:

Example 1

Ratex.render_png!(~S"y = mx + b")

Equation 1

Example 2

Ratex.render_png!(~S"x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}")

Equation 2

Example 3

Ratex.render_png!(~S"\frac{d}{dx}\left[\frac{x^2 \sin(x)}{e^x}\right] = \frac{e^x(2x\sin(x) + x^2\cos(x)) - x^2\sin(x)\,e^x}{e^{2x}}")

Equation 3

Example 4

Ratex.render_png!(~S"\int_{0}^{\infty} \frac{\sqrt[3]{x}}{(1+x)^2} \, dx = \frac{2\pi}{3\sqrt{3}}")

Equation 4

Example 5

Ratex.render_png!(~S"\nabla f(\mathbf{x}) = \sum_{k=1}^{n} \frac{\partial}{\partial x_k} \left[ \int_{0}^{x_k} e^{-t^2} \, dt \right] \hat{e}_k = \begin{pmatrix} e^{-x_1^2} \\ e^{-x_2^2} \\ \vdots \\ e^{-x_n^2} \end{pmatrix}")

Equation 5

Supporting Ratex

If you rely on this library help you debug your Ecto/SQL queries, it would much appreciated if you can give back to the project in order to help ensure its continued development.

Checkout my GitHub Sponsorship page if you want to help out!

Gold Sponsors

Support the project

Silver Sponsors

Support the project

Bronze Sponsors

Support the project

Attribution

  • The Ratex library leans on the Rust library RaTeX for compiling LaTeX math expressions.

About

Ruslter wrapper around the RaTeX library

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors