Page 1 of 1

Non italic math equations

Posted: Sat Apr 24, 2021 7:07 pm
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?

Re: Non italic math equations

Posted: Mon Apr 26, 2021 11:47 am
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

Re: Non italic math equations

Posted: Tue Apr 27, 2021 6:30 pm
by IsleofGough
With the generic installation and no modifications, it outputs italic font. See attachment.
MathItalics.jpg
MathItalics.jpg (175.28 KiB) Viewed 409 times

Re: Non italic math equations

Posted: Tue Apr 27, 2021 6:37 pm
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

Re: Non italic math equations

Posted: Wed Apr 28, 2021 6:47 am
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>

Re: Non italic math equations

Posted: Thu May 06, 2021 2:05 pm
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

Re: Non italic math equations

Posted: Wed May 12, 2021 4:51 am
by IsleofGough
Thank you

Re: Non italic math equations

Posted: Sun May 16, 2021 5:46 pm
by chrispitude
Radu wrote:
Thu May 06, 2021 2:05 pm
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
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.