
A Ruby wrapper for LaTeXML - apepe
https://github.com/Authorea/latexml-ruby
======
mixedmath
I hadn't heard of LaTeXML before today. I've always simply used MathJax for my
web-math needs.

So I set LaTeXML up and tried using it. I found it to be pretty easy to use,
although I had to update a few things and install some perl modules. It turns
out it is rather easy to convert directly from a .tex document to a MathML
document. [This is using LaTeXML directly --- not through this ruby]

Something I noticed about using LaTeXML out of the box is that the resulting
MathML has the original LaTeX as alt-text. So it is encoded in the page, and
therefore (potentially) searchable. This is in start contrast to most MathML
equations, which (can) look nice but which are neither text-searchable or
easily copy-able.

Now I am a bit less-certain about my preference for MathJax instead of MathML.
I wonder if anyone else has a strong preference and wouldn't mind sharing why
you have that preference?

~~~
dginev
Disclaimer: I'm the author of the wrapper, and a LaTeXML and Authorea
developer.

Indeed, LaTeXML has been producing great presentation MathML, since before
MathJaX was created. But it's also a very different tool and the two projects
are largely complementary, rather than competing. I'm happy to hear your first
experiment went well, and as a note - most components, including and
especially the math output, are highly configurable.

I recently counted [1] а 95% success rate by LaTeXML's math parsing on 350
million LaTeX formulas from arXiv.org. That number should be taken with a
grain of salt, as it is a self-claimed parsing success, which may not
necessarily mean correct+ideal MathML. But it quite often gets the job done
great visually, and there is ongoing work to keep improving the coverage.

That said, MathJax has historically (and until very recently) fully embraced
MathML itself, as MathML was used for its internal representation. The main
problem that had/has to be solved on the web was the lack of _displaying_
MathML support in browsers [2], and MathJax addressed that extremely well, as
you know. But if, for example, you create an HTML5+MathML document with
LaTeXML, and enable MathJax on it, you will get as good a result as using
MathJax on HTM5L+TeX documents.

At Authorea we use both of LaTeXML and MathJax for our formula support, as
well as some alternative renderers such as KaTeX and MathQuill. It's sometimes
a bit too big of a hassle to do something advanced however (see [3]), so there
is still some way to go.

There are certain trade-offs to be considered, but I personally see MathML as
an instrumental part of making math accessible, actionable (as a native part
of the DOM) and interoperable, and am happy that both LaTeXML and MathJax have
embraced it historically. The MathJax team is now officially out of patience
with the browser stalemate in _displaying_ MathML, so they're looking for
alternatives to move forward. Time will show how that goes I suppose...

[1]
[http://prodg.org/talks/mnlp_billion_token_corpora#30](http://prodg.org/talks/mnlp_billion_token_corpora#30)

[2] [http://caniuse.com/#feat=mathml](http://caniuse.com/#feat=mathml)

[3] [http://prodg.org/blog/mathml_please](http://prodg.org/blog/mathml_please)

------
gjtorikian
This looks like it just shells out[1] to a local executable.

It'd be remiss not to mention my own Ruby gem,
[https://github.com/gjtorikian/mathematical](https://github.com/gjtorikian/mathematical).
It does La/TeX conversions by wrapping C code, though admittedly, it only
converts the math portions.

[1]: [https://github.com/Authorea/latexml-
ruby/blob/798795f0631a29...](https://github.com/Authorea/latexml-
ruby/blob/798795f0631a295ae2397718ad5c625eadb3faf3/lib/latexml.rb#L261)

~~~
dginev
If you're using it in daemon mode, it only shells out to boot a conversion
server, and only if necessary.

From that point on it's sending very basic RESTful requests. I wouldn't
recommend using latexml if you're interested in performance-critical math
parsing.

Its best use case is converting entire LaTeX documents/fragments with
arbitrarily complex package dependencies, macro definitions and any other
power latex techniques.

------
xchaotic
This is so complicated, why not just Markdown or straight up authoring in
HTML?

~~~
cwyers
Because actual documents are complicated? A version of Markdown capable of
expressing all possible LaTeX constructs is roughly as complicated as LaTeX.

~~~
JadeNB
More so, I'd imagine, since some LaTeX constructs would almost certainly
require an encoding to avoid confusing them with non-LaTeX Markdown
constructs.

