-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix all AMS mathord symbols #618
Conversation
@edemaine thanks for the PR. How did you determine the list of broken chars? Is it just all mathords? |
It is all symbols in symbols.js of font "ams" and type "textord". |
utils.contains(mainitLetters, value)) { | ||
// For greek capitals, we have a choice, but Math-Italic | ||
// seems closer to LaTeX. | ||
//|| utils.contains(greekCapitals, value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code supposed to be commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to ask you about this. Yes, it seems so:
Greek capital letters are in both fonts, Main-Italic
and Math-Italic
. So which should we use? The master code claims to use Main-Italic
for Greek capital letters. But if you try the demo with \mathit{\Omega\imath}
, and inspect, you'll see that the \Omega
gets class mathit
while \imath
gets mainit
:
<span class="mord mathit" style="margin-right: 0.05017em;">Ω</span>
<span class="mord mainit">ı</span>
In fact, the master code ends up calling mathit()
with a single-unicode-character string (Ω
), while greekCapitals
is defined in terms of the macro name ("\Omega"
). When my code fixed this, I ended up changing Greek capital letters to use Main-Italic
font, which caused some tests to fail. I confirmed with texcmp
that Math-Italic
seems slightly closer, so kept it there.
Let me know if you'd like this code changed at all...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, can you remove the commented out code? TBH, I'm not sure why we have the same glyphs duplicated in different fonts. It would be nice if we could avoid this and save a few bytes. I'm curious to find out why the rendering looks different even though the glyphs are the same. Maybe the advance or skew metrics for the Greek capitals are differ between fonts. I think it's safe to investigate this separate from this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove the list of greekCapitals as well? It's currently commented out (to prevent lint from complaining).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
return { | ||
fontName: "Math-Italic", | ||
fontClass: "mathit" | ||
}; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the doc string for mathit
now that it no longer creates a symbol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
@edemaine a few minor nits and this'll be ready to merge. Thanks for fixing all of these symbols. |
Cool! I just merged with master and moved to ES2016 style. |
@edemaine thanks for cleaning up the commented out code. ^_^ |
Here is a fix for #600 (and #609 and #512 and #374). In fact, all AMS textord symbols were similarly broken. Here is a complete list of symbols fixed by this PR:
\hslash, \triangledown, \lozenge, \circledS, \circledR, \measuredangle, \nexists, \mho, \Finv, \Game, \Bbbk, \backprime, \blacktriangle, \blacktriangledown, \blacksquare, \blacklozenge, \bigstar, \sphericalangle, \complement, \eth, \diagup, \diagdown, \square, \Box, \Diamond, \yen, \checkmark, \beth, \daleth, \gimel, \digamma, \varkappa, \varnothing, \maltese
Basically, in
buildCommon.js
,mathsym
had logic for choosing between font familiesMain-Regular
andAMS-Regular
, but this applies to typesrel, bin, open, close, inner, punct
only.makeOrd
is used specifically formathord
andtextord
, and needed similar logic. To complicate things,makeOrd
was also losing track of the original macro name and thus AMS vs. Main, replacing it with the unicode symbol. So I had to refactor code a bit so thatmathDefault
could figure it out.