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.
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> </mml:mo><mml:mo>=</mml:mo><mml:mo> </mml:mo><mml:munder><mml:mo stretchy='true'>∑</mml:mo><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced><mml:mo><</mml:mo><mml:mn>64</mml:mn></mml:mrow></mml:munder><mml:mrow><mml:msub><mml:mo>µ</mml:mo><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced></mml:mrow></mml:msub><mml:mo> </mml:mo><mml:mo>×</mml:mo><mml:mo> </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> </mml:mo><mml:mo>+</mml:mo><mml:mo> </mml:mo></mml:mrow><mml:munder><mml:mo stretchy='true'>∑</mml:mo><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced><mml:mo>></mml:mo><mml:mn>64</mml:mn></mml:mrow></mml:munder><mml:mrow><mml:msub><mml:mi>γ</mml:mi><mml:mrow><mml:mi>a</mml:mi><mml:mfenced><mml:mi>i</mml:mi></mml:mfenced></mml:mrow></mml:msub><mml:mo> </mml:mo><mml:mo>×</mml:mo><mml:mo> </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> </mml:mo><mml:mo>+</mml:mo><mml:mo> </mml:mo><mml:msub><mml:mi>ε</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:
Generated MathML Equation Output:
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?
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:
Change mml:munder
to mml:msub
: