Convert julia objects to LaTeX equations, arrays or other environments. .

Build Status Build status codecov Coverage Status


This is a package for generating LaTeX maths from julia objects.

This package utilises Julias homoiconicity to convert expressions to LaTeX-formatted strings. This package supplies functionalities for converting a range of different Julia objects, including:

  • Expressions,

  • Strings,

  • Numbers (including rationals and complex),

  • Symbolic expressions from SymEngine.jl,

  • ParameterizedFunctions from DifferentialEquations.jl

as well as arrays of any supported types.

Latexify.jl supplies a few functions:

  • latexraw, a function that all other eventually uses. This latexifies objects and returns a string which does not contain a surrounding \LaTeX environment.

  • latexify, calls latexraw but converts the output to a LaTeXString which is automatically rendered in Jupyter or Hydrogen, and which surrounds the output string with $ $.

  • latexalign, generates a latex align environment.

  • latexarray, generates a latex array.


latexifying expressions

using Latexify
ex = :(x/(y+x)^2)
latexstring = latexify(ex)

results in:


latexifying strings

using Latexify


x + \frac{y}{\left( b - 2 \right)^{2}}

use with ParameterizedFunctions

ParameterizedFunctions is a part of the DifferentialEquations.jl suite. The ability to latexify an ODE is pretty much what lured me to create this package.

using DifferentialEquations
using Latexify

f = @ode_def positiveFeedback begin
    dx = v*y^n/(k^n+y^n) - x
    dy = x/(k_2+x) - y
end v=>1.0 n=>1.0 k=>1.0 k_2=>1.0

print( latexalign(f) )


\frac{dx}{dt} =&  \frac{v \cdot y^{n}}{k^{n} + y^{n}} - x \\
\frac{dy}{dt} =&  \frac{x}{k_2 + x} - y \\

This can be useful for lazy people, like me, who don't want to type out equations. But if you use Jupyter (or Atom with Hydrogen), it can also be useful to get a more clear view of your equations. Since the package uses a string type supplied by LaTeXStrings.jl the output of all functions except latexraw is automatically rendered. This can also be enforced by


I cannot demonstrate this in the README, since github markdown does not support rendering, but for some examples you can see the docs.


This package is registered with METADATA.jl, so to install it you can just run


You can access the functions by

using Latexify

Further information

For further information see the docs.


I would be happy to receive feedback, suggestions, and help with improving this package. Please feel free to open an issue.