Using MathML in DITA

863 views
Skip to first unread message

Ivan Lagunov

unread,
Aug 6, 2015, 6:02:14 AM8/6/15
to DITA-OT Users, eki...@contrext.com
I'd like to render MathML formulas using DITA-OT. FOP supports MathML using JEuclid FOP plugin, there is support for both external and inline MathML: http://jeuclid.sourceforge.net/jeuclid-fop/index.html

Has anyone successfully used DITA with MathML? Actually I hope to hear from Eliot Kimber who mentioned he successfully implemented inline MathML scenario: https://github.com/dita-ot/dita-ot/issues/1623

@Eliot, would you consider sharing/open-sourcing your plugin that emits MathML as fo:instream-foreign-object content?

Regards,
Ivan Lagunov

patrick...@gmail.com

unread,
Aug 7, 2015, 1:35:20 PM8/7/15
to DITA-OT Users, eki...@contrext.com
For five years or so now I've been using DITA with MathML for course notes in mechanical engineering subjects at Imperial College London. As Programme Director I was in the comfortable situation of being able to do what I liked, and everyone liked the results -- which were mainly in PDF and WebHelp format, and contained a LOT of math. Now that I've retired, of course, I've got a lot of technology transfer to do for colleagues who are taking on the courses I taught.

I use oXygen (what else) with DITA 1.3 DTDs, including Eliot Kimber's equation domain and plug-in for formatting to HTML.  MathML life is a lot easier than it was with DITA 1.2.  Hopefully oXygen will soon support 1.3 out of the box.

For formatting to PDF I couldn't really get on with FOP. One hitch was an institutional policy to use sans-serif fonts in all course materials, and in sans-serif text serif math looks ugly. RenderX is an excellent formatter but doesn't do MathML. That leaves Antenna House, which now has an excellent MathML formatter to rival TeX. I use the PDF5 stylesheets:  these don't yet fully support equation domain's new elements, but they are excellently maintained and I'm sure they soon will.

Hope these comments are of some use: good luck!
Pat Leevers

Radu Coravu

unread,
Aug 10, 2015, 1:55:48 AM8/10/15
to patrick...@gmail.com, DITA-OT Users, eki...@contrext.com
Hi Patrick,

About Oxygen and it's support for DITA 1.3:
Oxygen 17.1 (autumn this year) will come with experimental DITA 1.3 support including Eliot Kimber's DITA 1.3 DTDs and plugins for MathML and SVG rendering + the latest available DITA Open Toolkit 2.x. You will be able to enable this support as a setting in Oxygen.

Regards,
Radu

--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ivan Lagunov

unread,
Aug 10, 2015, 11:59:23 AM8/10/15
to DITA-OT Users, eki...@contrext.com
I've got the following response from Eliot but it's not shown here for some reason:

This implemented for the DITA 1.8.5 OT in the
https://github.com/dita-community/dita13-dita-ot-1.x-support project.

I'm not sure what the OT 2.x plan is for this but the code should work in
2.x with minor adjustments to reflect changes in the base OT. I haven't
had bandwidth to work on the 2.x stuff myself yet.

Cheers,

Eliot


On Thursday, August 6, 2015 at 12:02:14 PM UTC+2, Ivan Lagunov wrote:

Ivan Lagunov

unread,
Aug 10, 2015, 6:12:26 PM8/10/15
to DITA-OT Users, eki...@contrext.com
The plugins work fine with DITA-OT 1.x, only I had to use develop branch as master branch has several issues under Windows. However, what I really need is to make it work with DITA-OT 2.x. So I've tested it with DITA-OT 2.0.1 and have observed several major issues. I'm struggling to resolve them. Main issues are caused by svgref and mathmlref elements, also there is a minor issue with easy-dita.png image location. As far as I see, svgref/mathmlref issues are closely related to the catalog resolution:

     [xslt]  + [DEBUG] getRefContextNode():   xtrf="C:\workspace\private\dita13-dita-ot-1.x-support\test\dita\domains\topics\mathml-tests.dita"
     [xslt]  + [DEBUG]                      format="mml"
     [xslt]  + [DEBUG]   (not($xtrf) and ($format = ('dita', 'ditamap')))=false
     [xslt]  + [DEBUG]              isPDFMergedMap=true
     [xslt]  + [DEBUG]              mappath=C:\workspace\private\dita13-dita-ot-1.x-support\test\dita\dita13vocabulary-test.ditamap
     [xslt]  + [DEBUG]              mappath_url=file:/C:/workspace/private/dita13-dita-ot-1.x-support/test/dita/dita13vocabulary-test.ditamap
     [xslt]  + [DEBUG]              count=0
Error: The following error occurred while executing this line:
c:\Programs\DITA-OT\plugins\org.dita.pdf2\build.xml:335: Fatal error during transformation using c:\Programs\DITA-OT\plugins\org.dita.pdf2\xsl\fo\topic2fo_shell_fop.xsl: An empty sequence is not allowed as the result of function local:getRefContextNode(); SystemID: file:c:/Programs/DITA-OT/plugins/org.dita-community.dita13.html/xsl/localFunctions.xsl; Line#: 258; Column#: -1

I've added additional debug statements into local:getRefContextNode function:
<xsl:message> + [DEBUG] mappath_url=<xsl:value-of select="relpath:toUrl($mappath)"/></xsl:message>
<xsl:message> + [DEBUG] count=<xsl:value-of select="count(document(relpath:toUrl($mappath)))"/></xsl:message>

Apparently, the ditamap appears invalid when document function performs DTD validation. Somehow it fails to read the ditamap (count=0) when the topic contains svgref or mathmlref. I've checked DTDs and have no ideas how to investigate further.

@Eliot and Radu, you're more experienced here. Maybe if you take a look at my results, you could suggest something to me? It looks like a problem with doctypes or catalogs rather than with xslt.

Best regards,
Ivan Lagunov

Radu Coravu

unread,
Aug 11, 2015, 1:10:07 AM8/11/15
to Ivan Lagunov, DITA-OT Users, eki...@contrext.com
i Ivan,

This looks like the bug I reported:

https://github.com/dita-community/dita13-dita-ot-1.x-support/issues/1

Maybe you could perform the workaround I suggested there.

Regards,
Radu

--

Ivan Lagunov

unread,
Aug 11, 2015, 6:37:35 AM8/11/15
to DITA-OT Users, lag...@gmail.com, eki...@contrext.com
Hi Radu,

That issue was fixed by Eliot and merged into develop branch that I'm using now. The current issue is of different nature, it does not look xsl related. Actually I'm satisfied already with the fact that embedded MathML works fine.

Best regards,
Ivan Lagunov

abasa...@numerix.com

unread,
Jan 6, 2017, 12:07:39 PM1/6/17
to DITA-OT Users, lag...@gmail.com, eki...@contrext.com
Hi Ivan,

It looks like you were successful in using inline MathML with DITA-OT 2.x and FOP, but I'm having trouble with this. I am using DITA-OT 2.2.4 with FOP. I copied the mathml plugin that came with my oXygen to the plugins folder, added 1.3 to the DTD declaration in my DITA files, and put this into my DITA file:

<mathml>
  <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">                   
     <m:mi>x</m:mi>
  </m:math>
 </mathml>


but the equation is not showing up in the generated PDF, though I thought that MathML was supported in DITA 1.3. Could you possibly point me to what I am missing? Based on Eliot's response here for an older version of the OT: https://www.oxygenxml.com/pipermail/oxygen-user/2014-January/004914.html, it sounded like the namespace declaration is needed, which I thought I already covered.

Thanks,
Anna

Ivan Lagunov

unread,
Jan 6, 2017, 12:56:36 PM1/6/17
to DITA-OT Users, eki...@contrext.com
Hi Anna,

Yes, embedded MathML works fine for me with DITA-OT 2.2.x. Please follow these steps:

  1. To add DITA support for MathML:

    1. Download jeuclid-core-3.1.9.jar, jeuclid-fop-3.1.9.jar and put them in DITA-OT/plugins/org.dita.pdf2.fop/fop/lib

    2. Install dita community plugins:

      1. Download the archive:

https://github.com/dita-community/dita13-dita-ot-1.x-support/releases/download/1.0.2/dita13-support-toolkit-plugins-1.0.2.zip

  1. Unpack and copy 3 directories to DITA-OT/plugins/ (doctypes plugin is not needed since DITA-OT 2.2.0):

  • org.dita-community.common.xslt

  • org.dita-community.dita13.html

  • org.dita-community.dita13.pdf

  1. Enable character entities by replacing “IGNORE” with “INCLUDE” on line 81:

DITA-OT/plugins/org.oasis-open.dita.v1_3/dtd/technicalContent/dtd/mathml/mathml3-ditadriver.dtd

<!ENTITY % mathml-charent.module "INCLUDE" >


Please also make sure to correctly embed MathML into your DITA files. I use "equation-figure" element to embed mathml. Here is an example:
<equation-figure>
<mathml>
<m:mi>x</m:mi>
</m:math>
</mathml>
</equation-figure>

Best regards,
Ivan Lagunov

Anna Basanskaya

unread,
Jan 6, 2017, 1:48:11 PM1/6/17
to Ivan Lagunov, DITA-OT Users, eki...@contrext.com

Hi Ivan,

 

Thanks so much for the detailed instructions. This worked perfectly.

 

Best regards,

Anna

 

From: dita-o...@googlegroups.com [mailto:dita-o...@googlegroups.com] On Behalf Of Ivan Lagunov
Sent: Friday, January 06, 2017 12:57 PM
To: DITA-OT Users <dita-o...@googlegroups.com>
Cc: eki...@contrext.com
Subject: Re: [dita-ot] Re: Using MathML in DITA

 

Hi Anna,

 

Yes, embedded MathML works fine for me with DITA-OT 2.2.x. Please follow these steps:

 

1.       To add DITA support for MathML:

a.       Download jeuclid-core-3.1.9.jar, jeuclid-fop-3.1.9.jar and put them in DITA-OT/plugins/org.dita.pdf2.fop/fop/lib

b.       Install dita community plugins:

                                                         i.            Download the archive:

https://github.com/dita-community/dita13-dita-ot-1.x-support/releases/download/1.0.2/dita13-support-toolkit-plugins-1.0.2.zip

       ii.            Unpack and copy 3 directories to DITA-OT/plugins/ (doctypes plugin is not needed since DITA-OT 2.2.0):

·         org.dita-community.common.xslt

·         org.dita-community.dita13.html

·         org.dita-community.dita13.pdf

c.       Enable character entities by replacing “IGNORE” with “INCLUDE” on line 81:

Reply all
Reply to author
Forward
0 new messages