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

Spacing in asciimath #743

Closed
adius opened this issue Feb 17, 2014 · 8 comments

Comments

Projects
None yet
3 participants
@adius
Copy link

commented Feb 17, 2014

Asciimath seems to lack proper spacing in several cases.

For example:

  • M = {n | n > 0} produces almost no spacing around the |, which looks really bad.
  • M = {n "mit" n > 0} lacks spacing around the "mit" as well. At least in this case you can fix it with M = {n " mit " n > 0}

Is this supposed behavior? Is there an easy way to fix it?
Thanks for your help!

@pkra

This comment has been minimized.

Copy link
Member

commented Feb 18, 2014

This is off-topic but @adius you should stop by https://plus.google.com/u/0/events/c9l2t1g57kkkjokh2o49701f3vg/114096530864036991751 -- Peter Jipsen and David Lippman will be there.

As for the problem, that looks like expected behavior to me, i.e., an upstream problem in asciimath -- except that there's no upstream, see my comment on #431. Definitely something to talk about on Friday.

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 18, 2014

The HTML-CSS and SVG output use spacing rules based on TeX's typesetting model, which works a bit differently from MathML. In TeX's model, the | is an "ordinal", not an operator, so that things like |x|+y are displayed properly. TeX has a separate means of producing the vertical bar for sets: \mid, as in \{\,n \mid n>0\,\}.

AsciiMath doesn't have two separate versions of the vertical bar, and so you run into the difficulty that you are having.

Fortunately, MathJax has a setting that tells it to use MathML spacing rules rather than TeX ones. If you add

<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("mml Jax Ready",function () {
  MathJax.ElementJax.mml.mo.prototype.useMMLspacing = 0x80;
});
</script>

to your page before the script that loads MathJax.js itself, this will cause MathJax to use MathML spacing rules rather than TeX spacing rules.

As for using "mit", this produces a <mtext>mit</mtext> and that (correctly) does not include any spacing around it; only operators (<mo>...</mo>) get spacing automatically. So you are right that " mit " is the correct way to get what you want.

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 18, 2014

We should probably make a useMMLspacing option for the AsciiMath input jax, like the one for the MathML input jax. In light of this example, the default should probably be true.

@dpvc dpvc added the Accepted label Feb 18, 2014

@pkra

This comment has been minimized.

Copy link
Member

commented Feb 18, 2014

@dpvc Thanks for correcting me.

We should probably make a useMMLspacing option for the AsciiMath input jax, like the one for the MathML input jax. In light of this example, the default should probably be true.

Makes perfect sense.

@dpvc dpvc added this to the Bugfix Version milestone Feb 19, 2014

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 20, 2014

@pkra, I've added the useMathMLspacing option, and set it to true. Note, however, that this means the output for existing pages may change. Not sure if you want that in the bug fix release or not. I could change the default to false for now and go to true on the next feature release. Or we could consider the current spacing a "bug" that this fixes (with the option for people to go to the old display by setting this value to false).

@pkra

This comment has been minimized.

Copy link
Member

commented Feb 21, 2014

I'm ok with true. It seems like a bug to me. (If at some point we add an asciimath-to-tex converter, we could introduce a TeX-spacing option.)

dpvc pushed a commit to dpvc/MathJax that referenced this issue Feb 21, 2014

@dpvc

This comment has been minimized.

Copy link
Member

commented Feb 21, 2014

=> Merged.

@dpvc dpvc closed this Feb 21, 2014

@dpvc dpvc added Merged and removed Ready for Review labels Feb 21, 2014

dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Apr 21, 2014

@dpvc

This comment has been minimized.

Copy link
Member

commented Apr 21, 2014

=> In Test Suite

@dpvc dpvc added v2.4 and removed Merged labels Jun 30, 2014

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.