# LaTeX representation of equations

Hi!

from brian2 import *
from sympy import latex
G = NeuronGroup(10, 'dv/dt = -v/(10*ms) : volt')
print(latex(G.equations))
\begin{align*}\mathtt{\text{\textbackslashfrac\{\textbackslashmathrm\{d\}v\}\{\textbackslashmathrm\{d\}t\}}} &= - \frac{v}{10 ms} && \text{(unit of $v$: $\mathrm{V}$)}\end{align*}


renders a bit funny

{{d}v}{{d}t} = ...


Do you have a tip how to make the left part also a fraction?

Thanks,

Sebastian

Um, thanks for letting us know, there’s something weird going on with the backslashes there…
In the meantime, rendering a single equation seems to work, so you can use:

print(latex(G.equations['v']))


which gives

\frac{\mathrm{d}\mathtt{\text{v}}}{\mathrm{d}t} = - \frac{v}{10 ms}


rendering as
\frac{\mathrm{d}\mathtt{\text{v}}}{\mathrm{d}t} = - \frac{v}{10 ms}

I created a github issue. For reference: Escaping problem in LaTeX equations · Issue #1296 · brian-team/brian2 · GitHub