Render Math/Latex in Kivy

1,025 views
Skip to first unread message

Paul Royik

unread,
Dec 1, 2015, 10:41:45 AM12/1/15
to Kivy users support
Is it possible to render latex/mathjax or something else in kivy, so that math formulas are rendered correctly?

I tried RstDocument with a^2+b^2=c^2 but it doesn't work.

Alexander Taylor

unread,
Dec 1, 2015, 2:24:41 PM12/1/15
to Kivy users support
I haven't seen anyone do this. One option might be to find a way to render the formulae to png and display them inline. This must be possible as emacs has a mode that does it, and it's probably the basis for some of the latex -> html converters.

Thomas Chen

unread,
Dec 1, 2015, 7:08:50 PM12/1/15
to Kivy users support
Here is an open source tex2png converter written in c++: http://www.nawouak.net/?cat=informatics.tex2png+lang=en

I imagine you could wrap this with cython to create a "TeX Labels" class. Sounds like a project for kivy.garden.

Thomas Chen

unread,
Dec 1, 2015, 7:12:34 PM12/1/15
to Kivy users support
Oooh, better yet, here's one for python: https://pypi.python.org/pypi/tex2pix

Paul Royik

unread,
Dec 2, 2015, 6:11:56 AM12/2/15
to Kivy users support
What about this post?

I tried it but got following errors:
import error to android.runnable
and can't find android.webkit.WebView

Arash GM

unread,
May 26, 2016, 4:17:06 PM5/26/16
to Kivy users support
dear Alexander,

what i just need, is to be able to write O2 such that 2 is a subscript, could you help please?

tnx,
Arash

ZenCODE

unread,
May 27, 2016, 12:36:54 PM5/27/16
to Kivy users support
Have you considered just using a specialized maths font and specifying the characters? e.g. Asana maths has a huge amount of maths symbols...

https://www.ctan.org/tex-archive/fonts/Asana-Math/?lang=en

Thomas Chen

unread,
May 27, 2016, 12:54:36 PM5/27/16
to Kivy users support
I think the issue is that you might want to type out a math document similar to how you would write an html file and you want kivy to render that document correctly.

I'll eventually need math type in my app in this manner and I'm looking into using mathjax to produce SVG that can then be displayed in Kivy, however, I'm waiting for SVG to stabilize in Kivy before I get too far in my attempt.

ZenCODE

unread,
May 28, 2016, 1:38:10 AM5/28/16
to Kivy users support
Well, it really depends on your need. Arash GM stated he "just" need a subscript, in which case a font is perfectly acceptable. It would be ideal to have a full maths render, but that is far from simple. Often we just need a solution for the immediate problem, not ideal solutions. I was just replying to that...:-)
Reply all
Reply to author
Forward
0 new messages