Tradeoff between LaTex, MathML, and XHTMLMathML in an iOS app? - ios

I plan to use Xcode to make an app for the iPhone that displays math equations that high school and college students often use. I do all my math with Mathematica, and it allows me to save such equations in three relevant formats. (1) LaTex (.tex); (2) MathML (.mml); (3) XHTMLMathML.
The Mathemactica documentation says the third format is XHTML with embedded MathML. I found some of the examples at this browser test don't look so good on my iPhone. So I will propbably not rely completly on MathML.
I am a total beginner with Xcode and the three file formats that I mention above, but I have some experience with OOP in C++. Assuming Mathematica can do a good job writing the required LaTeX, MathML, XHHTMLMathML needed for whatever equation, what are the tradeoffs between the three file formats? Can I mix the formats in the same app?

I would suggest to use HTML. The "right" way to include mathematical content is MathML -- which is part of HTML5 (but see below for using TeX).
iOS's UIwebview is webkit based and therefore has the same partial MathML support (though on iOS5 it's significantly worse due to a font bug) so I would also suggest to use MathJax (disclaimer: I'm part of MathJax).
MathJax is an open source javascript library which understands TeX and Asciimath input, converts either one to MathML and renders MathML as HTML-CSS or SVG (in any modern browser).
MathJax has no problem mixing these input formats. Additionally, it has better MathML support than webkit (and you can always configure MathJax to use the native MathML support if you want -- say when you know your content should render fine in webkits native support).
To get you started, you can take a look at this open source app to see how MathJax can be integrated in an iOS app.

Related

Limitations of Mathjax: Which Latex features does Mathjax not support?

My question is, which Latex features aren't supported by Mathjax? For example, in Latex I can write $\today$ and it will return the current date. This is not possible in Mathjax.
In KaTeX, a Mathjax alternative, there seem to be more troublesome limitations such as \overrightarrow{AB} not working. I was wondering, what the current limitations of Mathjax are, in terms of latex rendering, before using it in a website instead of converting tex equations to png images and inserting those. I have noticed that Wikipedia uses the tex2png approach instead of Mathjax and was wondering whether they just did not want to depend on Mathjax, whether it's not fully supported by all browsers, whether it's too slow, whether the limited feature set of Mathjax is a problem or just legacy?
First and foremost, Mathjax, as its name suggest, supports mathematics typesetting for the web and is not a web-implementation of general-purpose Latex. Here's what this means most notably feature-wise:
No tables
No tikzpictures
No bibliographies
No support for units, e.g. \SI{10}{\hertz} is not possible (requiring the siunitx package in latex)
No special packages, for example no \uwave from package ulem
Within the math-world, Mathjax is covering almost everything. Here is a list of features that are not supported for mathematics typesetting:
Items that require the mathtools package, for example H \xrightharpoondown[under]{over} I\\.
The other question was, why Wikipedia isn't using Mathjax, but has chosen to convert Equations into a png. I think it's because they already had a working solution when Mathjax got popular and don't really have an incentive to switch to Mathjax. Mathjax especially shines, when you need an out of the box solution for rendering math on the web.

LaTeX for Chemistry on my website

I am programming a website on the subject of chemistry and for obvious reasons I also have to include structural and molecular formulas on that site. I want to have as few images as possible on the side and would therefore like to know how I can compile LaTeX code on my website, so I can show everything I could do in LaTeX itself.
Thanks in advance.
As outlined in a previous comment, Chemistry.SE has enabled mhchem in MathJax to allow the rendering of simple formula and reaction equations. The MathJax documention actually gives some directions.
As far as structures of organic molecules are concerned, I'm usually draw them using BkChem and export them as the png images.
If I understand you correctly, you would like to avoid the images themselves and not just the act of drawing. Therefore, the idea to generate the drawings from a linear representation (InChi, SMILES) using openbabel will probably not convince you.
As a matter of fact, it is possible to create structure in LaTeX using chemfig and there have been requests to support this package in MathJax. However, it seems that so far, the strong dependance of chemfig on TikZ has prevented this.

MathML support in Adobe Digital Editons for EPUB

I am using MathPlayer to render MathML in an XML file. I am creating an EPUB. The ebook reader which I am using is Adobe Digital Editions. But it is not rendering the mathematical equations properly. Does ADE support MathML? Is there a way to do it?
ADE doesn't support MathML. If you are dependent on using ADE, your best bet is to use PNG graphics in your EPUB. This will enable your EPUB + Math to work on many more readers, since MathML is not well supported either inside or outside the browsers.
Some EPUB readers have incorporated the MathJax javascript library into their implementations. You can see which readers have MathJax support here: http://www.mathjax.org/resources/epub-readers/
Hope this helps.
Best regards,
Jean K.

Is there a Way to localize an Application on Various Platforms

We are developing an Application which runs on various plattforms (Windows, Windows RT, MacOSX, iOS, Android).
The Problem is how to manage the different localizations on the different Platforms in an Easy Way. The Language Files on the different platforms have various formats (some are xml based, others are simple key-value pairs and others are totally crazy formats like on MacOS)
I'm sure, we aren't the first company with this problem, but I wasn't able to find an easy to use solution o achive the possibility to have one "datasource" where the strings are collected in different languages (the best would be an User Interface for the translators) and then can export it to the different formats for the different platforms.
Does anybody has a solution for this problem?
Greetings
Alexander
I recommend using GNU Gettext toolchain for management and at runtime use either
some alternate implementation for runtime reading like Boost.Locale,
own implementation (the .mo format is pretty trivial) or
use Translate Toolkit to convert the message catalogs to some other format of your liking.
You can't use the libintl component of GNU Gettext, because it is licensed under LGPL and terms of both Apple AppStore and Windows Live Store are incompatible with that license. But it is really trivial to reimplement the bit you need at runtime.
The Translate Toolkit actually reimplements all or most of GNU Gettext and supports many additional localization formats, but the Gettext .po format has most free tools for it (e.g. poedit for local editing and Weblate for online editing) so I recommend sticking with it anyway. And read the GNU Gettext manual, it describes the intended process and rationale behind it well.
I have quite good experience with the toolchain. The Translate Toolkit is easy to script when you need some special processing like extracting translatable strings from your custom resource files and Weblate is easy to use for your translators, especially when you rely on business partners and testers in various countries for most translations like we do.
Translate Toolkit also supports extracting translatable strings from HTML, so the same process can be used for translating your web site.
I did a project for iPhone and Android which had many translations and I think I have exactly the solution you're looking for.
The way I solved it was to put all translation texts in an Excel spreadsheet and use a VBA macro to generate the .string and .xml translation files from there. You can download my example Excel sheet plus VBA macro here:
http://members.home.nl/bas.de.reuver/files/multilanguage.zip
Just recently I've also added preliminary Visual Studio .resx output, although that's untested.
edit:
btw also my javascript xcode/eclipse converter might be of use..
you can store your translations on https://l10n.ws and get it via they API
Disclaimer: I am the CTO and Co-Founder at Tethras, but will try to answer this in a way that is not just "Use our service".
As loldop points out above, you really need to normalize your content across all platforms if you want to have a one-stop solution for managing your localized content. This can be a lot of work, and would require much coding and scripting and calling of various tools from the different SDKs to arrive at a common format that would service the localization needs of all the various file formats you need to support. The length and complexity of my previous sentence is inversely proportional to the amount of work you would need to do to arrive at a favorable solution for all of this.
At Tethras, we have built a platform that alleviates the need for multi-platform software publishers to have to do this. We support all of the native formats from the platforms you list above, and can leverage translations from one file format to another. For example, translate the content in Localizable.strings from your iOS app into a number of languages, then upload your equivalent strings.xml file from Android or foo.resx from Windows RT to the system, and it will leverage translations for you automatically. Any untranslated strings will be flagged and you can order updates for these strings.
In effect, Tethras is a CMS for localized content across many different native files formats.

What's a solid, full-featured open rich text representation usable on the Web?

I'm looking for an internal representation format for text, which would support basic formatting (font face, size, weight, indentation, basic tables, also supporting the following features:
Bidirectional input (Hebrew, Arabic, etc.)
Multi-language input (i.e. UTF-8) in same text field
Anchored footnotes (i.e. a superscript number that's a link to that numbered footnote)
I guess TEI or DocBook are rich enough, but here's the snag -- I want these text buffers to be Web-editable, so I need either an edit control that eats TEI or DocBook, or reliable and two-way conversion between one of them and whatever the edit control can eat.
UPDATE: The edit control I'm thinking of is something like TinyMCE, but AFAICT, TinyMCE lacks footnotes, and I'm not sure about its scalability (how about editing 1 or 2 megabytes of text?)
Any pointers much appreciated!
FCKeditor has a great API, supports several programming languages (considering it is javascript this isn't hard to achieve), can be loaded through HTML or instantiated in code; but most of all, allows easy access to the underlying form field, so having a jQuery or prototype ajax buffer shouldn't be terribly difficult to achieve.
The load time is very quick compared to previous versions. I'd give it a whirl.
In my experience a two-way conversion between HTML and XML formats like TEI or DocBook is very hard to make 100% reliable.
You could use Xopus (demo) to have your users directly edit TEI or DocBook XML. Xopus is a commercial browser based XML editor designed specifically for non-technical users. It supports bidi and UTF-8. The WYSIWYG view is rendered using XSLT, so that gives you sufficient control to render footnotes the way you describe.
As TEI and DocBook don't have means to store styling information, those formats will not allow your users to change font face, size and weight. But I think that is a good thing: users should insert headers and emphasis, designers should pick font face and size.
Xopus has a powerful table editor and indentation is handled by nesting sections or lists and XSLT reacting to that.
Unfortunately Xopus 3 will only scale to about 200KB of XML, but we're working on that.
I can't really decide on one of them. IMHO they are all not very good and complete. They all have their advantages and clear disadvantages. If TinyMCE is your favorite then afaik, it also does tables.
This list will probably come in handy: WysiwygEditorComparision.
I've also used FCKEditor and it performed well and was easy to integrate into my project. It's worth checking out.
Small correction to laurens' answer above: As of now (May 2012), Xopus supports UTF8, but not BiDi editing. Right-to-left text is displayed fine if it came from another source, cannot be edited correctly.
Source: I was recently asked to evaluate this, so have been testing it.

Resources