I want to write a function that transforms a string of TeX equation to a DOM (<span>) object, but this seems almost impossible because most, if not all, of MathJax's interface that relates to rendering is asynchronous. I would like to ask:
What are the reasons for the asynchrony?
Is there any way to manage the must-asynchronous part and use the rest synchronously, which might make the life of a library writer hundred times easier?
2.1. I found that
MathJax.InputJax.prototype.Processmight be synchronous, but it takes an undocumented 'state' argument which is for 'internal use'. Since it is listed in the APIs, I assume that it makes sense to use it, so how?
I know it is said in the documentation:
Actions such as loading files, loading web-based fonts, and creating stylesheets all happen asynchronously within the browser ...
but these tasks do not seem to tangle with typesetting, which should be synchronous.
Thanks.