Non italic math equations

Having trouble installing Oxygen? Got a bug to report? Post it all here.
IsleofGough
Posts: 34
Joined: Fri Dec 02, 2016 9:55 pm

Non italic math equations

Post by IsleofGough »

Is there a way to modify the xls transform for doc book to pdf so that mathml equations are displayed as regular rather than italic font?
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Non italic math equations

Post by Radu »

Hi,

With a stock installation of Oxygen 23.1 I take this DocBook small file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathmlsvg.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0"
    xmlns:xlink="http://www.w3.org/1999/xlink">
    <title>MathML</title>
    <equation>
        <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block">
            <mml:mrow>
                <mml:msub>
                    <mml:mi>Some text here</mml:mi>
                </mml:msub>
                <mml:mo>=</mml:mo>
                <mml:mfrac>
                    <mml:mn>1</mml:mn>
                    <mml:msqrt>
                        <mml:mn>5</mml:mn>
                    </mml:msqrt>
                </mml:mfrac>
            </mml:mrow>
        </mml:math>
    </equation>
</article>
and publish it using the "DocBook PDF" predefined transformation scenario, the equation in the output PDF does not have the "Some text here" in italics, it's in plain text.
Did you set any publishing parameters which might have interfered with this?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
IsleofGough
Posts: 34
Joined: Fri Dec 02, 2016 9:55 pm

Re: Non italic math equations

Post by IsleofGough »

With the generic installation and no modifications, it outputs italic font. See attachment.
MathItalics.jpg
MathItalics.jpg (175.28 KiB) Viewed 1867 times
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Non italic math equations

Post by Radu »

Hi,

Can you also post the DocBook XML content for such an equation so that I can try the same thing on my side?
You are on Windows, right?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
IsleofGough
Posts: 34
Joined: Fri Dec 02, 2016 9:55 pm

Re: Non italic math equations

Post by IsleofGough »

I am on a Mac (Mac Pro 2019 running OS X 11.3). Here is a paragraph from the docbook:

Code: Select all

 <para>When a loop crosses over itself - termed a &quot;riding turn&quot; - the capstan effect becomes important. At the point of crossing, the loop will exert force down on the underlying suture. If the free end is pulled just to the point of slippage, the force pulling will be equal and opposite to the frictional force of the suture. </para>
 <para><inlineequation>
 <math xmlns="http://www.w3.org/1998/Math/MathML">
 <msub>
 <mi>T</mi>
 <mrow class="MJX-TeXAtom-ORD">
 <mi>l</mi>
 <mi>o</mi>
 <mi>a</mi>
 <mi>d</mi>
 </mrow>
 </msub>
 <mo>=</mo>
 <mi>&#x03BC;<!-- μ --></mi>
 <mo>&#x00D7;<!-- × --></mo>
 <mi>N</mi>
 <mi>o</mi>
 <mi>r</mi>
 <mi>m</mi>
 <mi>a</mi>
 <mi>l</mi>
 </math>
 </inlineequation> , but also, <inlineequation>
 <math xmlns="http://www.w3.org/1998/Math/MathML">
 <msub>
 <mi>T</mi>
 <mrow class="MJX-TeXAtom-ORD">
 <mi>l</mi>
 <mi>o</mi>
 <mi>a</mi>
 <mi>d</mi>
 </mrow>
 </msub>
 <mo>=</mo>
 <msub>
 <mi>T</mi>
 <mrow class="MJX-TeXAtom-ORD">
 <mi>h</mi>
 <mi>o</mi>
 <mi>l</mi>
 <mi>d</mi>
 </mrow>
 </msub>
 <msup>
 <mi>e</mi>
 <mrow class="MJX-TeXAtom-ORD">
 <mi>&#x03BC;<!-- μ --></mi>
 <mi>&#x03B8;<!-- θ --></mi>
 </mrow>
 </msup>
 </math>
 </inlineequation>
 </para>
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Non italic math equations

Post by Radu »

Hi,

Sorry for the delay.
I can reproduce the problem on my side, somehow at least in my case when I have those consecutive <mi> elements:

Code: Select all

        <mi>l</mi>
                    <mi>o</mi>
                    <mi>a</mi>
                    <mi>d</mi>
they are rendered as italic as if you have only one <mi> element like this:

Code: Select all

<mi>load</mi>
it' rendered as plain.
It's quite strange so I looked at the MathML specs:

https://www.w3.org/Math/draft-spec/math ... 3_presm.mi
Specifies the logical class of the token. The default is "normal" (non-slanted) unless the content is a single character, in which case it would be "italic".
so the PDF renderer seems to obey the specs, if you have one character inside an <mi> it's rendered in Italic font because the specs says so :)

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
IsleofGough
Posts: 34
Joined: Fri Dec 02, 2016 9:55 pm

Re: Non italic math equations

Post by IsleofGough »

Thank you
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Non italic math equations

Post by chrispitude »

Radu wrote: Thu May 06, 2021 2:05 pmIt's quite strange so I looked at the MathML specs:

https://www.w3.org/Math/draft-spec/math ... 3_presm.mi
Specifies the logical class of the token. The default is "normal" (non-slanted) unless the content is a single character, in which case it would be "italic".
so the PDF renderer seems to obey the specs, if you have one character inside an <mi> it's rendered in Italic font because the specs says so :)

Regards,
Radu
Hi Radu,

I always thought <mi> was a "math-italic" element, which led to lots of confusion when I ran into this same behavior! It turns out that <mi> is a "math-identifier" element instead.

For future searchers that find this thread, there are two ways to make multi-character content italic:
  • wrap each character with <mi>
  • Use the mathvariant="italic" attribute
The "right" answer is probably the one that your equation editor uses.
Post Reply