This is a package for generating LaTeX maths from julia objects.
This package utilises Julias homoiconicity to convert expressions to LaTeX-formatted strings. Latexify.jl supplies functionalities for converting a range of different Julia objects, including:
- Expressions,
- Strings,
- Numbers (including rationals and complex),
- Symbolic expressions from SymEngine.jl,
- ParameterizedFunctions and ReactionNetworks from DifferentialEquations.jl,
- Other types for which a user recipe has been defined
as well as arrays or dicts of supported types.
To extend Latexify to work with your own type, you define a recipe using the
@latexrecipe
macro. See the documentation.
using Latexify
ex = :(x/(y+x)^2)
latexify(ex)
This generates a LaTeXString (from LaTeXStrings.jl) which, when printed looks like:
$\frac{x}{\left( y + x \right)^{2}}$
And when this LaTeXString is displayed in an environment which supports the tex/latex MIME type (Jupyter and Pluto notebooks, Jupyterlab and Hydrogen for Atom) it will automatically render as:
Latexify.jl is equipped to convert a whole range of types to latex formatted
maths. This includes primitive types such as Symbol
s and Complex
, but also
of containers such as Array
s and Dict
s.
using Latexify
print(latexify("x+y/(b-2)^2"))
outputs:
$x + \frac{y}{\left( b - 2 \right)^{2}}$
arr = ["x/y" 3//7 2+3im; 1 :P_x :(gamma(3))]
latexify(arr)
The GitHub website does not really support rendering of equations in the README file, so I th