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

\not a (etc) not italic #2617

Closed
pkra opened this issue Jan 26, 2021 · 8 comments
Closed

\not a (etc) not italic #2617

pkra opened this issue Jan 26, 2021 · 8 comments
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3 v3.1
Milestone

Comments

@pkra
Copy link
Contributor

pkra commented Jan 26, 2021

E.g., $\not a$ comes out normal (u0061) whereas $\not{a}$ comes out math italic (u1D44E).

Screencap from https://www.mathjax.org/#demo

image

@dpvc dpvc added Accepted Issue has been reproduced by MathJax team v3 labels Jan 26, 2021
@dpvc
Copy link
Member

dpvc commented Jan 26, 2021

OK, here's what's happening. The \not a is creating <mi>a&#x338;</mi>, which ends up being a two-character <mi>, so its content is typeset with mathvariant="normal". I could make it be <mi mathvariant="italic">a&#x338;</mi>, but then the slash will also be in italics (that doesn't matter for the MathJax TeX fonts, but the STIX2 fonts do contain an italic U+0338, so that will be used, here). Is that OK? For something like <mi mathvariant="bold">a&#x338;</mi> I would think one would want the slash to be bold, so should the italic mathvariant use the italic one?

The only alternative would be to do two elements, like <mrow><mi>a</mi><mi mathvariant="normal">&#x338;</mi></mrow>, but that has the wrong semantics. Perhaps <mrow data-mjx-texclass="ORD"><mi>a</mi><mo lspace="0" rspace="0">&#x338;</mo></mrow> is better?

@pkra
Copy link
Contributor Author

pkra commented Jan 26, 2021

Ah, I should've thought of that (I had actually looked at the MML). I'll check regarding STIX2 (but this was just a tangential find while working on the unicode-math extension).

@dpvc
Copy link
Member

dpvc commented Jan 26, 2021

I suppose another alternative is to not count combining characters when determining whether the content is one character or not. I'm not sure if that would be against the spec or not. I think it does make sense to consider them as a single glyph, so this might be the best approach. This will become more important when we handle combining characters better during TeX input, for example.

It turns out that v2 accidentally doesn't count the U+0338 because of how it was added on, and so renders using italics.

@pkra
Copy link
Contributor Author

pkra commented Mar 12, 2021

Sorry for dropping the ball on this one. @davidmjones had looked at unicode-math / xelatex behavior and IIRC that was a bit dodgy but MathJax v2's behavior was good with him.

@davidmjones can you comment regarding the italic vs nonitalic slash issue in #2617 (comment)?

@dpvc
Copy link
Member

dpvc commented Mar 12, 2021

OK, I have tested out the following idea: don't count combining characters as part of the length of an <mi>, and drop the italic U+0338 from the STIX2 font data so that <mi>a&#x338;</mi> will get mathvariant="italic" automatically, but the slash will fall back on the normal version, since the italic one is not present. What do you think of that idea?

@dpvc
Copy link
Member

dpvc commented Mar 17, 2021

@pkra, any thoughts on my solution of dropping the italic U+0338 and not counting combining characters when determining the length of the <mi>? I have a branch ready to go if you like the idea.

@pkra
Copy link
Contributor Author

pkra commented Mar 17, 2021

@pkra, any thoughts on my solution of dropping the italic U+0338 and not counting combining characters when determining the length of the <mi>? I have a branch ready to go if you like the idea.

@dpvc I checked with @davidmjones and this sounds good.

@dpvc
Copy link
Member

dpvc commented Mar 17, 2021

OK, I've pushed the issue2617 branch that handles the (non) counting of combining characters, and made an update to the stix2-svg branch to remove the U+0338 character from the italic mathvariant. That should produce better results for \not a.

@dpvc dpvc added this to the 3.1.3 milestone Mar 17, 2021
dpvc added a commit to mathjax/MathJax-src that referenced this issue Mar 19, 2021
Allow 'single-character' mi's to include trailing combining characters (mathjax/MathJax#2617)
@dpvc dpvc added Merged Merged into develop branch Fixed v3.1 and removed Ready for Review Merged Merged into develop branch labels Apr 26, 2021
@dpvc dpvc closed this as completed Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3 v3.1
Projects
None yet
Development

No branches or pull requests

2 participants