Not that uses MathJax (that I know of). If you are using something
like Safari, you could use AppleScript to automate it to some degree,
but a browser would still be needed, and that wouldn't work out too
well with your shell script requirement, I would expect. Similarly,
you might be able to use javscript itself to automate the process in
other browsers, though saving the results might be an issue. (I know
that things like TiddlyWiki let you save local files to disk, but I
don't know the mechanism they use.)
There are other TeX to MathML processors that might do more what you
want. Google "TeX to MathML" for links.
MathJax is not really designed to be used as a batch processor for
files in this way. The TeX input processor is all in one place,
however (the MathJax/unpacked/jax/input/TeX/jax.js file) so it might
be possible to pull that out (together with the core libraries from
MathJax.js itself) and either run it in a javascript interpreter
(e.g., rhino) or perhaps convert it to another language like perl or
python. That is not something we are likely to do, however, but we
could answer questions if you wanted to undertake that yourself,
especially if you would contribute the result to the MathJax open
source project in the end.
Davide
Can you quantify this at all? My experience is that the TeX to MathML
conversion is pretty fast (hardly the bottleneck for MathJax), but I
haven't actually separated it out to see exactly what it costs. Also,
the code for the MathML input processor is smaller than that of the
TeX input processor, so you might be counting the download time for
that as part of your conversion time. While that may be reasonable in
the sense that the user does have to wait for that, it is not really
the conversion that is the cause in that case.
> What I'd like to see is some
> way of pre-processing the files with MathJax to do the conversion and
> place the MathML in with the TeX, thus saving both and allowing the
> end-user to have the MathML for faster rendering and also the TeX
> source but have the TeX source wrapped with a tag to hide it and not
> be processed the next time it is opened.
There is no current mechanism for that now, but it is something to
consider for the future.
As you probably know, even with the TeX source, the user can have
MathML output for fast rendering (by selecting the MathML renderer in
the settings item of the MathJax contextual menu). You can also
configure your page to select that automatically when the browser
supports MathML. So the only real advantage to this is the slight
speed gain by not having to do the TeX conversion in the browser. I'm
not sure it's worth it (note also that your HTML pages will become
much longer with the additional MathML, so will take longer to
download, which somewhat offsets your savings).
> Having both versions might
> help "future proof" the data somewhat and give some more flexibility
> in later reuse situations.
OK, I can see that.
Davide
You use the MathJax.Hub.Queue method to run a command that signals you
in whatever way you need. It will not be run until after MathJax has
finished all the other queued functions (which includes the initial
typesetting run). For example
MathJax.Hub.Queue(function () {
... (Your code here -- it won't run until after MathJax has
finished typesetting) ...
});
See
http://www.mathjax.org/docs/1.1/queues.html#the-mathjax-processing-queue
for more details, and
http://www.mathjax.org/docs/1.1/synchronize.html
for more about synchronizing with MathJax in general.
Davide