Dila
Dila

Reputation: 689

How to print LaTeX in Julia?

In Python, I have LaTeX code that I print as:

print('Lane-Emden Equation')
display(Latex(r'$'\
              r'\dfrac{\text{d}}{\text{d}\xi}'\
              r'\left( \xi^2 \dfrac{\text{d}\theta}{\text{d}\xi} \right)'\
              r'='\
              r'-\xi^2\theta^n'\
             r'$'))

How would I print the same thing in Julia?

Upvotes: 2

Views: 1248

Answers (1)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42244

You could try this code (note \text does not work and you need to use \mathrm instead):

using LaTeXStrings

lat = L"""\dfrac{\mathrm {d}}{\mathrm {d}\xi} \left( \xi^2 \dfrac{\mathrm {d}\theta}{\mathrm {d}\xi} \right) = -\xi^2\theta^n"""

using PyPlot
PyPlot.cla()
PyPlot.text(0.5,0.5,lat)

enter image description here

Upvotes: 1

Related Questions