13

Does anyone know if it's possible to use LaTeX markup language to format text for display in an Android application?

For example the text for a TextView can be formatted with HTML to change the font size to small and superscript etc by using the Html.formHtml("String") method:

TextView aTextView=(TextView) findViewById(R.id.textview1);
aTextView.setText(Html.fromHtml("2<small><sup>5</sup></small>"));  

Will display 25 in the TextView.


However what I'd like to something more advanced and format text using perhaps LaTeX to represent Math Function and have that render as a correctly format Math Function in a TextView (or something else).

For example the LaTeX markup "Evaluate the sum $\displaystyle\sum\limits_{i=0}^n i^3" should be rendered to:


(source: artofproblemsolving.com)


If there's some other way to mark up Math Functions so they display correctly in an Android App other than using LaTeX I'm all open to suggestions!

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
EraserheadIRL
  • 1,061
  • 2
  • 12
  • 20

1 Answers1

2

Latex is not written in java so may be hard to get running on the android JLaTexMath is a java port which you may be able to use, but probably not straight out of the box.

One other option maybe to run a service on a server that takes a formula and returns an image, if your formulas get really complex this might even be quicker then rendering the formula.

This will also reduce your reliance on the android platform so you are more likely to be able to port your application to IPhone and Html5.

David Waters
  • 11,979
  • 7
  • 41
  • 76
  • Hi David, thanks for the response and the hint (JLaTexMath), I'll take a look and see what I can do with it, if successful I'll add a comment here. Cheers Carl – EraserheadIRL Jul 13 '11 at 07:13
  • 1
    @CarlO'Donnell Can you please share if you got successful with this? I also need to render latex in textview of my app. – Shumail Sep 29 '15 at 18:45