-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 LaTeX completions of Greek variants, add \frakI and \frakR #39148
Conversation
It would be good to manually fix the REPL help dictionary in cases like this where there are multiple possible tab-completion options. |
It is redundant with \join
A test checks that all ambiguous cases are handled.
I've added a canonical mapping for ambiguous cases (in Looking at all the duplicates uncovered a few inconsistencies, so I made a few more changes to the completions suggested by the REPL. I generally chose the shorter option, which is often also the more mathematical meaning (e.g. \implies vs \Longrightarrow). Duplicates were found with the following commands: using REPL
ls = REPL.REPLCompletions.latex_symbols; symbols = values(ls)
duplicates = [v for v in unique(symbols) if count(==(v), symbols) > 1]
[(v, REPL.symbol_latex(v)) => findall(==(v), ls) for v in duplicates] Here is the current list of duplicates (including changes from this PR): ("ℜ", "\\Re") => ["\\Re", "\\frakR"]
("⟸", "\\impliedby") => ["\\impliedby", "\\Longleftarrow"], # was \Longleftarrow
("ℑ", "\\Im") => ["\\Im", "\\frakI"]
("√", "\\sqrt") => ["\\surd", "\\sqrt"]
("≥", "\\ge") => ["\\ge", "\\geq"], # was \geq
("♂", "\\male") => ["\\male", "\\mars"], # was \mars
("→", "\\to") => ["\\to", "\\rightarrow"], # was \rightarrow
("⟧", "\\rrbracket") => ["\\openbracketright", "\\rrbracket"]
("♀", "\\female") => ["\\venus", "\\female"]
("∅", "\\emptyset") => ["\\varnothing", "\\emptyset"]
("…", "\\dots") => ["\\dots", "\\ldots"], # was \ldots
("⊻", "\\xor") => ["\\veebar", "\\xor"]
("⟹", "\\implies") => ["\\implies", "\\Longrightarrow"], # was \Longrightarrow
("⟦", "\\llbracket") => ["\\llbracket", "\\openbracketleft"], # was \openbracketleft
("ℎ", "\\planck") => ["\\ith", "\\planck"]
("∇", "\\del") => ["\\del", "\\nabla"], # was \nabla
("̶", "\\sout") => ["\\strike", "\\sout"]
("ε", "\\varepsilon") => ["\\upepsilon", "\\varepsilon"]
("ð", "\\dh") => ["\\eth", "\\dh"]
("⟺", "\\iff") => ["\\Longleftrightarrow", "\\iff"]
("ℯ", "\\euler") => ["\\scre", "\\euler"]
("≤", "\\le") => ["\\le", "\\leq"], # was \leq The left side shows the canonical mapping. Comments show the old one if it was changed by this PR. The duplicate list also revealed that we had both A test is included to check that a canonical mapping is specified for all ambiguous cases. |
I would maybe keep |
Wouldn't a user likely prefer to know that the symbol is available as Just making sure the case for |
|
OK! I've changed the suggestion to |
CI failure is apparently unrelated: |
Yes that looks like #38996. |
…Lang#39148) * Fix LaTeX completions of Greek variants, add \frakI and \frakR * Remove \Join completion It is redundant with \join * Add canonical symbol->LaTeX mapping for ambiguous cases A test checks that all ambiguous cases are handled. * Replace \dots suggestion with \ldots
…Lang#39148) * Fix LaTeX completions of Greek variants, add \frakI and \frakR * Remove \Join completion It is redundant with \join * Add canonical symbol->LaTeX mapping for ambiguous cases A test checks that all ambiguous cases are handled. * Replace \dots suggestion with \ldots
Missing completions
This PR fixes two holes in the
\frak...
alphabet:\frakI
: same as\Im
\frakR
: same as\Re
(Reference: https://www.unicode.org/charts/PDF/U1D400.pdf page 10.)
This is similar to how
\euler
is also mapped to\scre
and\planck
is also mapped to\ith
.Note that this leads to a change in the suggested completions:
becomes
Currently the reverse mapping is a bit random when there are several completions for one symbol, see:
julia/stdlib/REPL/src/docview.jl
Line 335 in 6cff73f
Bad completions
Julia uses
\varphi
for the loopy variant of phi, and\varepsilon
for the curly variant of epsilon (same as LaTeX). However Julia is not consistent with the style variants (italic, bold, sans...) of these letters:This PR fixes the commands of the style variants.
Phi superscripts
This one might be more controversial.
Unicode distinguishes three variants of lowercase phi:
\phi
in Julia and LaTeX\varphi
in Julia and LaTeX\ltphi
, a phonetic symbol that looks like a\phi
with small serifsBased on these characters, Unicode defines two superscript phi letters:
The first one is straightforward: it's like
\phi
but as superscript. Julia maps it to\^phi
as expected.The second one is problematic: it's a superscript version of
\ltphi
, yet Julia maps it to\^Phi
.This PR fixes it by remapping U+1db2 to
\^ltphi
. It's not as discoverable, but the current completion is misleading: a font could correctly implement\^Phi
as something that doesn't really look like a superscript\Phi
. And a future Unicode version might add a real superscript\Phi
.Note: the situation is similar to U+1d4b =
\^epsilon
: that Unicode character is actually a superscript version of the "Latin small letter open e" (rather thn "Greek small letter epsilon"). But it's different because Julia doesn't have\ltepsilon
or\openepsilon
, and Julia actually normalizes the "Latin" and "Greek" letters in this case (which is reasonable, they really look the same), see #14751.