Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two vector symbols above symbol (tensor notation) #877

Closed
kapet3 opened this issue Jul 21, 2014 · 6 comments

Comments

Projects
None yet
2 participants
@kapet3
Copy link

commented Jul 21, 2014

I have problems with two vector symbols which I frequently use to denote a tensor quantity, for example \vec{\vec{a}} . The second vector arrow above the symbol is substantially larger and it does not look good, especially when compared to the TeX/LaTeX result. Tested with Firefox 24, 30, and Chrome 35.

MathJax:
vec2

LaTeX:
vec2latex

@dpvc

This comment has been minimized.

Copy link
Member

commented Jul 21, 2014

The \vec macro is implements using MathML that puts a right arrow (U+2192) over its argument, rather than the combining right arrow above (U+20D7). Apparently this is the preferred notation (using combining characters in this way is frowned upon). MathJax uses a heuristic to replace the arrow with the combining arrow when the argument is a letter, so that \vec works as expected in that case. But if the argument is not a single letter, it uses the arrow, which is larger.

I suppose it might be better to check for an embellished letter as the base, as that would handle this case as well.

In the meantime, you could use

<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
  MathJax.InputJax.TeX.Definitions.macros.vec[1] = "20D7";
});
</script>

just before the script that loads MathJax.js. This will change the arrow used by \vec to being the combining arrow rather than the regular arrow.

If you don't manage the page where you want to enter this, it gets to be a bit harder. You could use

\mathop{\vec{a}}^{\mmlToken{mo}{⃗}}

or

\def\vvec#1{\mathop{\vec{#1}}^{\mmlToken{mo}{⃗}}}
\vvec{a}

but this is a bit awkward.

@kapet3

This comment has been minimized.

Copy link
Author

commented Jul 22, 2014

That StartupHook is helpfull, just a small imperfection occurs with a greek letter like \tau or \delta, for example, where the upper arrow is shifted left slightly.
vec_vec_tau
Thanks a lot.

@dpvc

This comment has been minimized.

Copy link
Member

commented Jul 22, 2014

The positioning of accents gets italic correction only when the base is a single character, which it isn't when it is \vec\tau for the second \vec. When I fix the issue with the base as an embellished operator, I will check to see if I can do the italic correction in that case as well.

@dpvc dpvc added Accepted labels Jul 29, 2014

@dpvc dpvc added this to the Next Release milestone Aug 19, 2014

dpvc pushed a commit to dpvc/MathJax that referenced this issue Aug 19, 2014

Davide P. Cervone
Move CoreParent, CoreText, remap, and remapChars to element jax (sinc…
…e shared among the output jax), and fix positioning of double accents like \vec{\vec{x}}. Resolves issue mathjax#877.
@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 19, 2014

The issue877 branch of my fork of MathJax includes a fix for the multiple-accent problem.

dpvc pushed a commit to dpvc/MathJax that referenced this issue Aug 19, 2014

Davide P. Cervone
Move CoreParent, CoreText, remap, and remapChars to element jax (sinc…
…e shared among the output jax), and fix positioning of double accents like \vec{\vec{x}}. Resolves issue mathjax#877.

dpvc pushed a commit to dpvc/MathJax that referenced this issue Aug 20, 2014

@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 20, 2014

=> Merged.

@dpvc dpvc closed this Aug 20, 2014

@dpvc dpvc added Merged and removed Ready for Review labels Aug 20, 2014

dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Jan 16, 2015

@dpvc dpvc added Test Available and removed Test Needed labels Jan 16, 2015

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 16, 2015

==> In Testsuite

LaTeXToMathML/above-below/issue877.html

@dpvc dpvc added Fixed v2.5 and removed Merged labels Jan 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.