Weird (minor) bug in VSCode Unicode font

[Windows 11, updated today]

I want to use symbol \phi in my code (\phi in LaTeX). However, if I type \phi and hit Tab in VSCode (both Jupyter Notebook and *.jl file), the result on the screen is symbol \varphi (\varphi).

Similarly, if I type \varphi, I get symbol \phi (\phi in LaTeX).


Next, if I copy the symbol \phi, which incorrectly appears as \varphi, into the “find” box of VSCode, the symbol suddenly changes and appears (correctly) as \phi.


There is clearly a bug here. I don’t know whether the bug lies in VSCode itself (i.e., is a Microsoft responsibility), or whether it lies in the Julia modification.

What plugin are you using to do unicode tab completion?

You could be seeing \varphi and \phi are switched · Issue #36 · ojsheikh/unicode-latex · GitHub, which is reportedly a font issue.

1 Like

same in IJulia (notebook)

Look at the code points. It should be:

julia> 'ϕ' # \phi — "straight" form
'ϕ': Unicode U+03D5 (category Ll: Letter, lowercase)

julia> 'φ' # \varphi — "loopy" form
'φ': Unicode U+03C6 (category Ll: Letter, lowercase)

If you get these codepoints with the wrong symbols, then it is probably a font issue. Try switching to e.g. JuliaMono.

Apparently there is some confusion here because the standard glyphs for these two Unicode codepoints were swapped in Unicode 3.0 (in 1999) and some online sources still display them incorrectly, but the standard now clearly states that U+03C6 should now be the “loopy” form if the font is intended to support technical usage:

Fonts used primarily for Greek text may use either glyph form for U+03C6, but fonts that also intend to support technical use of the Greek letters should use the loopy form to ensure appropriate contrast with the straight form used for U+03D5.

4 Likes

Confirmed: Consolas has it wrong. U+03D5 looks like what I would call \varphi.

2 Likes

(It’s possible that Consolas doesn’t even have these codepoints, and what you are seeing is a fallback to another font? I’m not sure if there is an easy way to check this? Update: According to this web page, Consolas indeed has the characters and they are swapped.)

Don’t know. The “Character Map” utility in Win11 shows the same mix-up for Consolas.

for fun:

8 Likes

More bugs??? [Your solution with JuliaMono works… but…]

VSCode suggested I should sync the settings, so I logged in to GitHub. I was then told there were some conflicts. When I merged the conflicting settings, the following happened:

  • Color Theme changed to black (I dislike black background)
  • The font changed back from JuliaMono to Consolas
  • Possibly other things, but I didn’t notice other changes

Why does this happen, and how can I avoid it? (I try to keep 3 PCs synced…)

Sounds like you just messed up the merge; you probably should have selected the “merge manually” option. Probably if you change the settings on one machine and merge again it should work now.

In any case, this is straying pretty far off-topic for a Julia forum; if you continue to have problems you should go to a vscode forum.