\overrightarrow and \overleftarrow producting different size arrows

552 views
Skip to first unread message

em...@stanford.edu

unread,
May 9, 2016, 12:51:19 PM5/9/16
to MathJax Users

See the test page at

http://web.stanford.edu/~emma/test2.html

with the code (first paragraph with \overleftarrow/\overrightarrow and second using overset with \leftarrow and \rightarrow

<p>\(\overrightarrow{R} \overleftarrow{R} \leftarrow \rightarrow\)</p>


<p>\(\overset{\rightarrow}{R} \overset{\leftarrow}{R} \leftarrow \rightarrow\)</p>


I'm expecting that the arrows over the R would be the same size instead in both cases I'm seeing a much larger left arrow than right arrow.  If instead I use \longrightarrow and \longleftarrow with overset then the arrows are the same size though bigger than they should be.

I've tested with firefox 45.0.2, Chrome 49.0.2623, Safari 6.2.8 on MacOS 10.8  (I also had a co-worker test on a different mac later OS with the same results)

The test page is using mathjax

<script type="text/javascript"                                                                                                                                         
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

Thoughts?


Many thanks,

Emma




William F Hammond

unread,
May 9, 2016, 9:10:27 PM5/9/16
to mathja...@googlegroups.com

On Mon, May 9, 2016 at 9:51 AM, <em...@stanford.edu> wrote:

I'm expecting that the arrows over the R would be the same size instead in both cases I'm seeing a much larger left arrow than right arrow.  If instead I use \longrightarrow and \longleftarrow with overset then the arrows are the same size though bigger than they should be.

Certainly the difference between \leftarrow and \rightarrow is mysterious.  AFAIK the long versions are not used with single letter symbols.

As a related exercise, I have made my own short document in profiled LaTeX -- XML rendered solely with CSS styling, as outlined in my talk at TUG 2014 -- which appears to render in Firefox and Chrome on par with the Firefox native rendering of the HTML+MathML formatting of the same document.  See
          -- Bill

Davide P. Cervone

unread,
May 12, 2016, 5:05:09 PM5/12/16
to mathja...@googlegroups.com
<p>\(\overrightarrow{R} \overleftarrow{R}\)</p>


I'm expecting that the arrows over the R would be the same size instead in both cases I'm seeing a much larger left arrow than right arrow. 

The reason you are seeing this is a bit complicated, but here's why.  First, MathJax converts the TeX to MathML internal, and the \overrightarrow and \overleftarrow macros produce the MathML

  <mover>
    <mi>R</mi>
    <mo>&#x2192;</mo>
  </mover>
</math>

and

  <mover>
    <mi>R</mi>
    <mo>&#x2190;</mo>
  </mover>
</math>

respectively.  Since the operator dictionary for for these arrows indicates that they are stretchy by default, the arrows will grow in order to match the width of the base (in your case, the R).  In order to stretch a character, MathJax has data about the various sizes available for the particular character, and (when possible), how to construct wider versions from parts (like adding minus signs to the left of the right-arrow to extend its tail).

The default MathJax fonts include the small-sized right arrow (along with the normal-sized one, and the long right arrow) as one the choices for sizes of the right arrow.  This is because this same construction in MathML is used for vectors, which need to smaller arrow.  The vector arrow fits over a single letter, even the capital R, so you get that for \overrightarrow{R} as well as \vec R, since they both produce the same MathML internally.

Unfortunately, the MathJax TeX fonts don't include a small-sized let arrow, so that size is not available for "stretching" the left arrow, and the smallest size available is the standard left arrow size.  That is why you see a difference in the two results.

The STIX fonts do include the small-sized left arrow, but unfortunately, it has not been included in the stretchy data for the left arrow.  I have opened an issue tracker that requests this:


But the CommonHTML output doesn't yet support the STIX fonts, so you would have to use the HTML-CSS or SVG output for that.

Davide


If instead I use \longrightarrow and \longleftarrow with overset then the arrows are the same size though bigger than they should be. 

I've tested with firefox 45.0.2, Chrome 49.0.2623, Safari 6.2.8 on MacOS 10.8  (I also had a co-worker test on a different mac later OS with the same results)

The test page is using mathjax

<script type="text/javascript"                                                                                                                                         
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

Thoughts?


Many thanks,

Emma





--
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.

Reply all
Reply to author
Forward
0 new messages