xslt-2.0xsl-foapache-fopmathmloxygenxml

Issue with Summation Symbol Rendering in MathML using XSL-FO Apache FOP


I am rendering MathML equations in PDF using XSL-FO with Apache FOP. While most equations render correctly, I’ve noticed an issue with the summation symbol — specifically, the lower limit appears broken into two lines in the output PDF.

Is there a way to prevent line wrapping for this element? Alternatively, can this issue be resolved through a tagging update?

I tested this in the latest version of the Oxygen XML Editor (Author mode). When I changed display="block" to display="inline" in the MathML, the equation displayed correctly within the editor. However, after generating the PDF using Oxygen with Apache FOP, the issue still persists in the output.

Please advise if there’s a workaround or recommended fix.

Oxygen XML Editor View:
enter image description here

Input MathML:

<disp-formula id="FD5">
<label>(5)</label>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block" id="M144">
<mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mn>1940</mml:mn></mml:mrow></mml:msub><mml:mo>&#x2002;</mml:mo><mml:mo>=</mml:mo><mml:mo>&#x2002;</mml:mo><mml:munder><mml:mo stretchy='true'>&#x2211;</mml:mo><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced><mml:mo>&#x003C;</mml:mo><mml:mn>64</mml:mn></mml:mrow></mml:munder><mml:mrow><mml:msub><mml:mo>&#x00B5;</mml:mo><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced></mml:mrow></mml:msub><mml:mo>&#x2002;</mml:mo><mml:mo>&#x00D7;</mml:mo><mml:mo>&#x2002;</mml:mo><mml:msub><mml:mrow><mml:mi mathvariant="normal">RR</mml:mi></mml:mrow><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mn>1930</mml:mn></mml:mrow></mml:msub><mml:mo>&#x2002;</mml:mo><mml:mo>+</mml:mo><mml:mo>&#x2002;</mml:mo></mml:mrow><mml:munder><mml:mo stretchy='true'>&#x2211;</mml:mo><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced><mml:mo>&#x003E;</mml:mo><mml:mn>64</mml:mn></mml:mrow></mml:munder><mml:mrow><mml:msub><mml:mi>&#x03B3;</mml:mi><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced></mml:mrow></mml:msub><mml:mo>&#x2002;</mml:mo><mml:mo>&#x00D7;</mml:mo><mml:mo>&#x2002;</mml:mo><mml:msub><mml:mrow><mml:mi mathvariant="normal">RR</mml:mi></mml:mrow><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mn>1930</mml:mn></mml:mrow></mml:msub><mml:mo>&#x2002;</mml:mo><mml:mo>+</mml:mo><mml:mo>&#x2002;</mml:mo><mml:msub><mml:mi>&#x03B5;</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mn>1930</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:mrow>
</mml:math>
</disp-formula>

Required MathML Equation Output:
enter image description here

Generated MathML Equation Output:
enter image description here

XSL Template:

<xsl:template match="mml:math">
    <xsl:choose>
        <xsl:when test="display='block'">
            <fo:block>
                <fo:instream-foreign-object>
                    <xsl:element name="{local-name()}" xmlns="http://www.w3.org/1998/Math/MathML">
                        <xsl:copy-of select="@*"/>
                        <xsl:apply-templates/>
                    </xsl:element>
                </fo:instream-foreign-object>
            </fo:block>
        </xsl:when>
        <xsl:otherwise>
            <fo:instream-foreign-object>
                <xsl:element name="{local-name()}" xmlns="http://www.w3.org/1998/Math/MathML">
                    <xsl:copy-of select="@*"/>
                    <xsl:apply-templates/>
                </xsl:element>
            </fo:instream-foreign-object>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

Could you please suggest anyone how we can solve this issue?


Solution

  • Remove the stretchy='true' on the sigma.

    This screenshot from Antenna House Formatter V7.4 GUI shows the same equation with one stretchy='true' removed:

    Same equation with "stretchy='true'" removed from second sigma.


    Change mml:munder to mml:msub:

    Equation with msub instead of munder.