Mathml in CSS based PDF output

Post here questions and problems related to editing and publishing DITA content.
MariPe
Posts: 15
Joined: Wed Mar 06, 2019 4:35 pm

Mathml in CSS based PDF output

Post by MariPe »

Hi there,

I want to style the MathML equations in my PDF output (css based, Oxygen 20.1). Am I right with the conclusion that any CSS styling applied to the <math>element is visible in HTML but not in PDF? The merged XML seems just to copy the whole math node without any styling.
I just want to change the font-family and margins but found no way to do so yet. I hope you have a hint for me!

Cheers
Maripe
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Mathml in CSS based PDF output

Post by Costin »

Hello,

Oxygen uses the JEuclid library to render MathML equations in the output and it seems JEuclid uses its own predefined fonts.
However, I logged this in our internal improvements tracking system so we will investigate this limitation and see if we could implement a solution to change the fonts.

We will let you know when/if we will find a way to do that.

However, as a workaround to change the margins, you could wrap the MathML equation (<m:math/> element in DITA) into a codeph or a paragraph and set a custom outputclass on it, so you could then match the outputclass in your customization CSS and apply the required margins or borders.
Unfortunately, this solution does not also work for changing the font-family.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
MariPe
Posts: 15
Joined: Wed Mar 06, 2019 4:35 pm

Re: Mathml in CSS based PDF output

Post by MariPe »

Hi Costin,

thanks for the feedback. Unfortunately the font family is our more important requirement ;-)
But we will wait :)

Cheers!
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Mathml in CSS based PDF output

Post by Dan »

We will try to find a fix. Can you let us know what font do you want to use for the equations?

Many regards,
Dan
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: Mathml in CSS based PDF output

Post by Dan »

Are the mathML equations inline or are stored as separate files?
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Mathml in CSS based PDF output

Post by Costin »

As a workaround, you could wrap your MathML equations in <equation-block/> or <equation-inline/> elements.
Then write a rule in your customization CSS that matches those equations and use the "Courier New" font, add padding, margins, borders or any other styling you want.

For example:

Code: Select all

*[class~="eqn-block"],
*[class~="eqn-inline"]{
font-family: 'Courier New';
padding: 1em;
margin-left: 2em;
border: solid red 1pt;
}
Costin
Costin Sandoi
oXygen XML Editor and Author Support
MariPe
Posts: 15
Joined: Wed Mar 06, 2019 4:35 pm

Re: Mathml in CSS based PDF output

Post by MariPe »

Thanks a lot! That works for us :D
Cheers!
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: Mathml in CSS based PDF output

Post by Radu »

Hi,

We released Oxygen 21.1 and it should have a fix for the original reported problem.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply