Math in CrossRef plugin

Dear friends,
I use OJS 3.1.2 to publish math. journal, where formulas in title and abstract arise very often.
A common approach to handle them is to use LaTeX markup in text and include mathJax javascript library to render it. It works fine for presentation purposes.
But to submit math to CrossRef, MathML is the only accepted format. I do not want to switch to MathML in original metadata since MathML is very complicated to typeset of edit manually (unlike LaTeX).
At the moment, to prepare XML for CrossRef, I need (i) Create XML file with CrossRef export plugin (ii) Add manually link to the needed namespace (iii) Pass the XML file through commandline converter (mathtoweb.jar does the job)
My idea is to modify the plugin code to call external program which would translate LaTeX formulas into MathML and add the necessary header on the fly.
Any ideas how to do that properly? Is it better to filter the whole file or only metadata in title, abstract and citations? Or maybe I missed some better approach?

Regards,
Vasyl

I’m interested in this. @jmacgreg and @jnugent have also had recent engagement with similar questions.

Definitely interested. Vasyl, any chance you could provide us with an example Crossref deposit file - or even one of the “before” and one of the “after”? Also CCing @AhemNason who is our Crossref expert.
This is something we can review with Crossref.

OK, I will to to dig a bit deeper into the plugin code. I follow requirements from CrossRef support
Will report with my progress.

Here is a fragment of XML file test1.xml produced by CrossRef export plugin

</contributors>
<jats:abstract xmlns:jats="http://www.ncbi.nlm.nih.gov/JATS1">
  <jats:p>The main aim of the present paper is to investigate under what conditions the nonnegative solutions blow-up for the  parabolic problem
$\dfrac{\partial u}{\partial t} = - (-\triangle)^{\frac{\alpha}{2}}u + \dfrac{c}{|x|^{\alpha}}u$  in $\mathbb{R}^{d}\times (0 , T)$</jats:p>
</jats:abstract>
<publication_date media_type="online">

And tis is the same fragment from the file produced by
java -jar ~/mathtoweb.jar -ns mml -rep -line -unicode test1.xml

</contributors>
<jats:abstract xmlns:jats="http://www.ncbi.nlm.nih.gov/JATS1">
  <jats:p>The main aim of the present paper is to investigate under what conditions the nonnegative solutions blow-up for the  parabolic problem
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mstyle scriptlevel="0" displaystyle="true"><mml:mrow><mml:mfrac linethickness="1"><mml:mrow><mml:mo>&#x02202;</mml:mo>
<mml:mi>u</mml:mi></mml:mrow><mml:mrow><mml:mo>&#x02202;</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mrow></mml:mstyle><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:msup><mml:mrow><mml
:mo form="prefix">(</mml:mo><mml:mo>-</mml:mo><mml:mi>&#x025B5;</mml:mi><mml:mo form="postfix">)</mml:mo></mml:mrow><mml:mrow><mml:mfrac linethickness="1"><mml:mi>&#x003B1;</mml:mi><mml:mn>2
</mml:mn></mml:mfrac></mml:mrow></mml:msup><mml:mi>u</mml:mi><mml:mo>+</mml:mo><mml:mstyle scriptlevel="0" displaystyle="true"><mml:mrow><mml:mfrac linethickness="1"><mml:mi>c</mml:mi><mml:m
row><mml:mo>|</mml:mo><mml:mi>x</mml:mi><mml:msup><mml:mo>|</mml:mo><mml:mi>&#x003B1;</mml:mi></mml:msup></mml:mrow></mml:mfrac></mml:mrow></mml:mstyle><mml:mi>u</mml:mi></mml:mrow></mml:mat
h>  in <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msup><mml:mi>&#x0211D;</mml:mi><mml:mi>d</mml:mi></mml:msup><mml:mo>&#x000D7;</mml:mo><mml:mrow><mml:mo form="p
refix">(</mml:mo><mml:mn>0</mml:mn><mml:mo>,</mml:mo><mml:mi>T</mml:mi><mml:mo form="postfix">)</mml:mo></mml:mrow></mml:mrow></mml:math></jats:p>
</jats:abstract>
<publication_date media_type="online">

Hello, friends,
Now, I made the first working modification of the crossref import/export plugin to include math LaTeX → MathML conversion. Now I can use LaTeX formulas in the title and abstract, and produce XML which is validated without errors.
I use external java commandline program named mathtoweb (you can easily find it if needed). To see my modifications, download diff and feel free to improve it or include into your code.
Some remarks.

  1. mathtoweb is very slow. Probably, the same can be done with server-side node version of MathJax with better result.
  2. The current version converts math in the “title” and “abstract” fields. Crossref schema also allows for MathML in “unstructured_citation”, which is added by another plugin. Probably, the right idea is to separate all math conversion stuff into dedicated plugin
  3. The code needs improvement. In particular, the function “latexFormulaToMML” contains hardcoded pathes, which should go to some config area

Regards,
Vasyl