# Convert math model to latex

**URL:** https://discourse.julialang.org/t/convert-math-model-to-latex/87266
**Category:** General Usage
**Tags:** question
**Created:** [September 14, 2022, 9:53am UTC](https://discourse.julialang.org/t/convert-math-model-to-latex/87266 "2022-09-14T09:53:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)
#### Post date: [September 14, 2022, 9:53am UTC](https://discourse.julialang.org/t/convert-math-model-to-latex/87266/1 "2022-09-14T09:53:59Z")

</div>

Hello,  
I have a model based on a set of ordinary differential equations, wrapped in a function. Is it possible to convert it into latex?

For instance,

```julia
function X!(du, u, p, t)
    A = p[:a] # parameter a
    B = p[:b] # parameter b

    du[1] = (A*u[1]*(1/B)
    du[2] = (B*u[2]*(1/A)
end

```

Thank you

---

<div class="post-metadata">

### Author: ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)
#### Post date: [September 14, 2022, 11:11am UTC](https://discourse.julialang.org/t/convert-math-model-to-latex/87266/2 "2022-09-14T11:11:19Z")

</div>

If you can define it using [ParameterizedFunctions’ @ode\_def](https://diffeq.sciml.ai/stable/analysis/parameterized_functions/), then the Latexify package can convert that into nice-looking LaTeX. See [the Readme section](https://github.com/korsbo/Latexify.jl#use-with-differentialequationsjl) and [the docs page](https://korsbo.github.io/Latexify.jl/stable/tutorials/parameterizedfunctions/).

---

<div class="post-metadata">

### Author: ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)
#### Post date: [September 14, 2022, 11:41am UTC](https://discourse.julialang.org/t/convert-math-model-to-latex/87266/3 "2022-09-14T11:41:57Z")

</div>

And if you want to roll your own, you can do

```julia
using Latexify 
@latexify du = [A/B B/A]*u

```

or

```julia
@latexify [du_1, du_2] = [A*u_1/B, B*u_2/A]

```
