Stretching is not working with integral symbol.

131 views
Skip to first unread message

kalisett...@gmail.com

unread,
Mar 13, 2015, 7:29:11 AM3/13/15
to mathja...@googlegroups.com

Hi I found stretching issue with integral symbol ∫.

Please find the following MathML markup for integral of some fractions. Here the height of the integral symbol does not stretches.

<math>

        <mo>&#160;</mo>

        <mrow>

            <mstyle displaystyle="true" largeop="true" stretchy="true">

                <mrow stretchy="true">

                    <msubsup stretchy="true">

                        <mo>&int;</mo>

                        <mrow>

                            <mrow>

                                <mi>a</mi>

                            </mrow>

                        </mrow>

                        <mrow>

                            <mrow>

                                <mi>b</mi>

                            </mrow>

                        </mrow>

                    </msubsup>

                    <mrow stretchy="true">

                        <mo fence="false" stretchy="true">&#x0028;</mo>

                        <mfrac displaystyle="false">

                            <mstyle scriptlevel="0">

                                <mrow>

                                    <mfrac displaystyle="false">

                                        <mstyle scriptlevel="0">

                                            <mrow>

                                                <mfrac displaystyle="false">

                                                    <mstyle scriptlevel="0">

                                                        <mrow>

                                                            <mi>x1</mi>

                                                        </mrow>

                                                    </mstyle>

                                                    <mstyle scriptlevel="0">

                                                        <mrow>

                                                            <mi>y1</mi>

                                                        </mrow>

                                                    </mstyle>

                                                </mfrac>

                                            </mrow>

                                        </mstyle>

                                        <mstyle scriptlevel="0">

                                            <mrow>

                                                <mfrac displaystyle="false">

                                                    <mstyle scriptlevel="0">

                                                        <mrow>

                                                            <mi>x3</mi>

                                                        </mrow>

                                                    </mstyle>

                                                    <mstyle scriptlevel="0">

                                                        <mrow>

                                                            <mi>y3</mi>

                                                        </mrow>

                                                    </mstyle>

                                                </mfrac>

                                            </mrow>

                                        </mstyle>

                                    </mfrac>

                                </mrow>

                            </mstyle>

                            <mstyle scriptlevel="0">

                                <mrow>

                                    <mfrac displaystyle="false">

                                        <mstyle scriptlevel="0">

                                            <mrow>

                                                <mi>x2</mi>

                                            </mrow>

                                        </mstyle>

                                        <mstyle scriptlevel="0">

                                            <mrow>

                                                <mi>y2</mi>

                                            </mrow>

                                        </mstyle>

                                    </mfrac>

                                </mrow>

                            </mstyle>

                        </mfrac>

                        <mo fence="false" stretchy="true">&#x0029;</mo>

                    </mrow>

                </mrow>

            </mstyle>

            <mo>&InvisibleTimes;</mo>

            <mrow>

                <mi>d</mi>

                <mi>x</mi>

            </mrow>

        </mrow>

    </math>

 When I use another symbol like {,[, or ( instead of &int; is working fine and stretching is fine. But why stretching is not working for &int;

Please find the attachments.

Note:

1.  I am using the latest MathJax version.( http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full)

2.  I am using latest chrome browser (Version 40.0.2214.115 m)

3.  Also tested in Firefox and IE-11.

4.  Searched on Google for the solution but no use.

 

Integral.PNG
WithBrace.PNG
IssueWithIntegralStretching.html

Davide P. Cervone

unread,
Mar 13, 2015, 9:29:41 AM3/13/15
to mathja...@googlegroups.com
The MathJax fonts don't include the needed characters to make a stretched integral sign, so the integral is not one of the characters that MathJax will stretch.  The STIX-Web font does include the needed characters, so you could switch to that font.  Unfortunately, there is an error in the data for the stretchy integral in that font, so you would need to include some configuration to fix that.  You could put

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  "HTML-CSS": {fonts: ["STIX-Web"]},
  "SVG": {fonts: ["STIX-Web"]}
});
(function () {
  function FixStretchyIntegral(renderer) {
    var FONTDIR = "[MathJax]/jax/output/"+renderer+"/fonts/STIX-Web";
    MathJax.Hub.Register.LoadHook(FONTDIR+"/fontdata.js",function () {
      MathJax.OutputJax[renderer].FONTDATA.DELIMITERS[0x222B].dir = "V"; 
    });
    MathJax.Hub.Register.LoadHook(FONTDIR+"/fontdata-extra.js",function () {
      var FONTDATA = MathJax.OutputJax[renderer].FONTDATA;
      FONTDATA.DELIMITERS[0x222B].dir = "V";
      FONTDATA.DELIMITERS[0x222B].stretch.ext = FONTDATA.DELIMITERS[0x222B].stretch.rep;
    });
  }
  FixStretchyIntegral("HTML-CSS");
  FixStretchyIntegral("SVG");
})();
</script>

in your file just before the script that loads MathJax.js itself.  That will correct the data when the font data files are loaded, so that stretchy integrals will stretch properly.

I'm opening an issue tracker for correcting the font data in STIX-Web.

Davide



--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Integral.PNG><WithBrace.PNG><IssueWithIntegralStretching.html>

Kalisetti Rajesh

unread,
Mar 16, 2015, 7:05:42 AM3/16/15
to mathja...@googlegroups.com
Hi Davide,

     This solution is working fine, but it changes font for entire MathML expression. Is there any other solution to apply this only for integral symbol. I mean font for other MathML elements should not be modified.



Thank you,
Rajesh.
  


Thank you,
K.Rajesh.

--
You received this message because you are subscribed to a topic in the Google Groups "MathJax Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathjax-users/CjBTLQwlAOI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathjax-user...@googlegroups.com.

Davide P. Cervone

unread,
Apr 21, 2015, 4:05:14 PM4/21/15
to mathja...@googlegroups.com
> Is there any other solution to apply this only for integral symbol?

Not currently. MathJax is only set up to work with one font set at a time, and there is no mechanism for mixing two different sets. That is something we want to improve, but it is not available at the moment. Since the STIX fonts are the ones that have the requires glyphs for stretchy integrals, you have to use those.

Davide

Julie Mitsdarfer

unread,
Jun 21, 2021, 12:11:27 PM6/21/21
to MathJax Users
I know this email exchange was from years ago, but I just happened to come across this and was wondering if there has been any update since then? We are seeing stretchy single integrals, though they are quite straight/upright. We're also seeing that the integral variants (e.g.,  double, triple, and bounded integrals) are not stretching. Not the end of the world for us, but I just wanted to check to see if what we're seeing is expected output for now, or not. We're using MathJax v2.7.5.

Thanks,
Julie Mitsdarfer

stretchy integrals.docx

Davide Cervone

unread,
Jun 23, 2021, 10:22:38 AM6/23/21
to mathja...@googlegroups.com
I know this email exchange was from years ago, but I just happened to come across this and was wondering if there has been any update since then?

Well, the data for the STIX font has been corrected, so you don't need to do the configuration that I gave at the time.

We are seeing stretchy single integrals, though they are quite straight/upright.

The stretching algorithm works by stacking several individual pieces together vertically.  There is no mechanism for horizontal shifting during that process, and the font don't include slanted extenders in any case.

We're also seeing that the integral variants (e.g.,  double, triple, and bounded integrals) are not stretching.

Again, the fonts don't include the needed pieces to make multi-character assemblies for double or triple integrals, nor for bounded integrals, and there are no Unicode positions for those pieces, in any case.  

I see only two alternatives for you:  (1) scale the integrals to the size you want by hand (ugly as it makes them too heavy, and the scaling factor must be set by hand), and (2) use two adjacent single (upright) integrals for double integrals.

For the first, you could use

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mpadded voffset="-.45em">
  <msubsup>
    <mo stretchy="true" mathsize="3">&#x222C;</mo>
    <mrow>
      <mspace width="-.5em"></mspace>
      <mi>i</mi>
      <mo>=</mo>
      <mn>0</mn>
    </mrow>
    <mrow>
      <mspace width="-.15em"></mspace>
      <mi>&#x221E;</mi>
    </mrow>
  </msubsup>
  </mpadded>
  <mrow>
    <mo>[</mo>
    <mtable>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
    </mtable>
    <mo>]</mo>
  </mrow>
  <mspace width="thinmathspace"></mspace>
  <mrow>
    <mi>d</mi>
    <mi>x</mi>
  </mrow>
</math>

which produces


Here, I've used an <mpadded> element to reposition the integral slightly, since the math axis is also scaled, and so the symbol is not centered on the unscaled math axis.  The integral is clearly too heavy, but is large enough to cover the integrand, and is slanted.

For the second, something like:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mo stretchy="true">&#x222B;</mo>
  <mspace width="-.25em" />
  <msubsup>
    <mo stretchy="true" lspace="0">&#x222C;</mo>
    <mrow>
      <mspace width="-.15em"></mspace>
      <mi>i</mi>
      <mo>=</mo>
      <mn>0</mn>
    </mrow>
    <mi>&#x221E;</mi>
  </msubsup>
  <mrow>
    <mo>[</mo>
    <mtable>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
      <mtr><mtd><mi>x</mi><mo>+</mo><mn>2</mn></mtd></mtr>
    </mtable>
    <mo>]</mo>
  </mrow>
  <mspace width="thinmathspace"></mspace>
  <mrow>
    <mi>d</mi>
    <mi>x</mi>
  </mrow>
</math>

which produces:


might do the trick.  I have added some <mspace> elements to adjust the spacing a bit.

Davide

Julie Mitsdarfer

unread,
Jun 23, 2021, 2:48:41 PM6/23/21
to MathJax Users
Davide- Thanks again for the info! For consistency's sake, I think in this case we may just prefer to force the non-stretchy symbols for all cases (single integral and also double/triple/bounded integrals) by changing our tagging to stretchy="false". I'll pass on your other ideas to my team, though.

Thanks,
Julie 

Reply all
Reply to author
Forward
0 new messages