# Latexify/Catalyst introduces extra exponent - issue with mm and hill?

**URL:** https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819
**Category:** New to Julia
**Tags:** question, package, latex, catalyst
**Created:** [August 24, 2025, 11:25pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819 "2025-08-24T23:25:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![orkun\_soyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orkun_soyer/32/218371_2.png) [@orkun\_soyer](https://discourse.julialang.org/u/orkun_soyer)
#### Post date: [August 24, 2025, 11:25pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/1 "2025-08-24T23:25:39Z")

</div>

‘‘‘ ppGppSys1 = @reaction\_network begin

```julia-auto
kin, ∅ --> G6P           

```

hill(G6P,v01,k01,1), G6P → F6P

end

odesys = convert(ODESystem, ppGppSys1; combinatoric\_ratelaws=false, remove\_conserved = true)

latexify(odesys)‘‘‘

produces

\begin{align}  
\frac{\mathrm{d} \mathtt{G6P}\left( t \right)}{\mathrm{d}t} &= \mathtt{kin} + \frac{ - \left( \mathtt{G6P}\left( t \right) \right)^{2} \mathtt{v01}}{\mathtt{k01} + \mathtt{G6P}\left( t \right)} \  
\frac{\mathrm{d} \mathtt{F6P}\left( t \right)}{\mathrm{d}t} &= \frac{\left( \mathtt{G6P}\left( t \right) \right)^{2} \mathtt{v01}}{\mathtt{k01} + \mathtt{G6P}\left( t \right)}  
\end{align}

---

<div class="post-metadata">

### Author: ![orkun\_soyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orkun_soyer/32/218371_2.png) [@orkun\_soyer](https://discourse.julialang.org/u/orkun_soyer)
#### Post date: [August 25, 2025, 8:10am UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/2 "2025-08-25T08:10:25Z")

</div>

I realise that the issue is not with “latexify” but rather the definition of Catalyst.mm and Catalyst.hill.

If I define a “model” with few reactions using these rates and then use the following code to check the ode rate laws:

rxs = reactions(lmodel)

ν = oderatelaw.(rxs)

I can see that the “mm” and ”hill” functions generate substrates to the square in the numerator.

---

<div class="post-metadata">

### Author: ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)
#### Post date: [August 25, 2025, 12:36pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/3 "2025-08-25T12:36:35Z")

</div>

Can you please provide a full MWE that is properly formatted as code in your post so it can be copied and pasted to run?

---

<div class="post-metadata">

### Author: ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)
#### Post date: [August 25, 2025, 12:50pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/4 "2025-08-25T12:50:52Z")

</div>

See [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530) for info on formatting Discourse posts.

---

<div class="post-metadata">

### Author: ![orkun\_soyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orkun_soyer/32/218371_2.png) [@orkun\_soyer](https://discourse.julialang.org/u/orkun_soyer)
#### Post date: [August 26, 2025, 1:54pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/5 "2025-08-26T13:54:33Z")

</div>

Thanks - I figures another way, in which “mm” behaves as expected.

Here is the code to illustrate. The first reaction (M0 to M1) is written, as I understand the “mm” usage from example in the docs and gives be the squared dependency on M0 concentration:

```Julia

mmModel = @reaction_network begin
    
    kin, ∅ --> M0               
    mm(M0,v01,k01), M0 --> M1 #usage implied by Julia example
    mm(v01,k01,M1), M1 --> M2 #usgae that gives expected behavior
    kout, M2 --> ∅ 

end
odesys = convert(ODESystem, mmModel; combinatoric_ratelaws=false, remove_conserved = true)
rxs = reactions(mmModel)
ν = oderatelaw.(rxs)
display(ν)
display(latexify(odesys))

```

---

<div class="post-metadata">

### Author: ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)
#### Post date: [August 26, 2025, 2:30pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/6 "2025-08-26T14:30:20Z")

</div>

It seems like maybe there is a misunderstanding about how Catalyst arrows work. When you use `-->` Catalyst always generates a mass action term for the rate law defined by the substrate stoichiometry that multiplies whatever your “rate” term is. i.e. all the terms that multiply `k` [here](https://docs.sciml.ai/Catalyst/stable/introduction_to_catalyst/introduction_to_catalyst/#introduction_to_catalyst_ratelaws). In your case `k` would be replaced by `kin`, `mm(...)`, or `kout` for each of your four reactions.

So the “rate”, which in your case is the Michaelis-Menten term, gets multiplied by `M0` for the second reaction and `M1` for the third. If you don’t want Catalyst to auto-generate mass action rate law terms you need to use a different arrow type, for example `=>`. See [here](https://docs.sciml.ai/Catalyst/stable/model_creation/dsl_advanced/#dsl_advanced_options_disable_ma).

---

<div class="post-metadata">

### Author: ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)
#### Post date: [August 26, 2025, 2:54pm UTC](https://discourse.julialang.org/t/latexify-catalyst-introduces-extra-exponent-issue-with-mm-and-hill/131819/7 "2025-08-26T14:54:08Z")

</div>

So just to add a concrete example,

```julia
mm(M0,v01,k01), M0 + 2A --> M1 

```

should give the rate law of

```julia
mm(M0,v01,k01) * M0 * (A^2/2)

```

per that page I linked. If you only want the `mm` term you can use

```julia
mm(M0,v01,k01), M0 + 2A => M1 

```

which should just give a rate law of

```julia
mm(M0,v01,k01)

```
