[oXygen-user] Displaying LaTeX in XML documents

Michael Boudreau mboudreau at uchicago.edu
Thu Apr 22 09:24:50 CDT 2021


Thanks, Radu!

--
Michael R. Boudreau
Electronic Publishing Technology Manager
The University of Chicago Press
1427 E. 60th Street
Chicago, IL 60637
www.journals.uchicago.edu<http://www.journals.uchicago.edu>


From: oXygen-user <oxygen-user-bounces at oxygenxml.com> on behalf of "Oxygen XML Editor Support (Radu Coravu)" <support at oxygenxml.com>
Reply-To: "oxygen-user at oxygenxml.com" <oxygen-user at oxygenxml.com>
Date: Thursday, April 22, 2021 at 12:39 AM
To: "oxygen-user at oxygenxml.com" <oxygen-user at oxygenxml.com>
Subject: Re: [oXygen-user] Displaying LaTeX in XML documents


Hi Michael,

The plugin is Javascript based:

https://github.com/oxygenxml/wsaccess-javascript-sample-plugins/blob/master/latex-images-support/wsAccess.js<https://urldefense.com/v3/__https:/github.com/oxygenxml/wsaccess-javascript-sample-plugins/blob/master/latex-images-support/wsAccess.js__;!!BpyFHLRN4TMTrA!tD_JomHTrO0SM9nkqJ8Jjr9aSSeDGc4aiO850hbJdt-kqE84UdmgyTxQY14w-QYxF1Lg$>

and has this condition to identify XML elements that it should render:
return "latex" == nodeContext.getNodeName() || ("foreign" == nodeContext.getNodeName() && "embed-latex" == nodeContext.getAttributeValue("outputclass"));
I think in your case the condition should be:
return "tex-math" == nodeContext.getNodeName() && "MathJax" == nodeContext.getAttributeValue("version");
You probably also need to modify the CSS Oxygen uses to edit JATS content to hide the text content from the element, probably something like:
tex-math[version=MathJax]{
    display:inline !important;
    white-space: -oxy-trim-when-ws-only !important;
}
tex-math[version=MathJax] * {
    display:none !important;
    white-space:normal !important;
}


Regards,

Radu

Radu Coravu

Oxygen XML Editor
On 4/21/21 22:15, Michael Boudreau wrote:
Hello,

The blog post at https://blog.oxygenxml.com/topics/adding-latex-equation-support-dita.html<https://urldefense.com/v3/__https:/blog.oxygenxml.com/topics/adding-latex-equation-support-dita.html__;!!BpyFHLRN4TMTrA!tD_JomHTrO0SM9nkqJ8Jjr9aSSeDGc4aiO850hbJdt-kqE84UdmgyTxQY14w-TLmHLWz$> refers to a plugin that will create an image from LaTeX to display in Author mode.

I downloaded the ‘latex-images-support’ folder and installed it in my plugins folder. The math expression in the sample file—


<?xml-stylesheet type="text/css" href="sample.css"?>
<root>
    A document containing LaTeX :
    <latex>$x=\frac{1+y}{1+2z^2}$</latex>
</root>

is rendered correctly as an image when I view it in Author mode (using Oxygen 23.0).

I’d like to be able to use the plugin with JATS XML documents, which can contain LaTeX inside a <tex-math> element, like so:

<tex-math notation="LaTeX" version="MathJax">$x=\frac{1+y}{1+2z^2}$</tex-math>
or

<tex-math notation="LaTeX" version="MathJax"><![CDATA[$x=\frac{1+y}{1+2z^2}$]]></tex-math>



Is there a way to configure or modify the plugin to handle this?

--
Michael R. Boudreau
Electronic Publishing Technology Manager
The University of Chicago Press
1427 E. 60th Street
Chicago, IL 60637
www.journals.uchicago.edu<http://www.journals.uchicago.edu>




_______________________________________________

oXygen-user mailing list

oXygen-user at oxygenxml.com<mailto:oXygen-user at oxygenxml.com>

https://www.oxygenxml.com/mailman/listinfo/oxygen-user<https://urldefense.com/v3/__https:/www.oxygenxml.com/mailman/listinfo/oxygen-user__;!!BpyFHLRN4TMTrA!tD_JomHTrO0SM9nkqJ8Jjr9aSSeDGc4aiO850hbJdt-kqE84UdmgyTxQY14w-X9xz7NN$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20210422/b7fb1593/attachment.html>


More information about the oXygen-user mailing list