# Spacing in asciimath #743

Closed
opened this issue Feb 17, 2014 · 8 comments

Projects
None yet
3 participants

### adius 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!
Member

### pkra 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.
Member

### dpvc 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   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 mit and that (correctly) does not include any spacing around it; only operators (...) get spacing automatically. So you are right that " mit " is the correct way to get what you want.
Member

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

Member

### pkra 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 pushed a commit to dpvc/MathJax that referenced this issue Feb 20, 2014

 Add useMathMLspacing option to AsciiMath input jax. Resolves issue ma… 
…thjax#743
 4e14368 
Member

### dpvc 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).
Member

### pkra 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

 Merge branch 'issue743' into develop. Issue mathjax#743. 
 e66df30 
Member

### dpvc commented Feb 21, 2014

 => Merged.

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

 Add test for issue mathjax/MathJax#743. 
 e70a59c 
Member

### dpvc commented Apr 21, 2014

 => In Test Suite