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

Tab-completing of \varphi and \phi reversed? #8429

Closed
jiahao opened this issue Sep 20, 2014 · 3 comments
Closed

Tab-completing of \varphi and \phi reversed? #8429

jiahao opened this issue Sep 20, 2014 · 3 comments
Labels
unicode Related to unicode characters and encodings

Comments

@jiahao
Copy link
Member

jiahao commented Sep 20, 2014

The current tab-completion behaviour for me does

\varphi --> φ #stroked phi, U+03C6
\phi --> ϕ #curly phi, U+03D5

which is exactly the opposite of what LaTeX does. Needless to say, this is rather confusing...

The Unicode 7.0 tables say (pdf)

03C6 φ GREEK SMALL LETTER PHI
• the ordinary Greek letter, showing considerable glyph variation
• in mathematical contexts, the loopy glyph is preferred, to contrast with 03D5 ϕ
03D5 ϕ GREEK PHI SYMBOL
• used as a technical symbol, with a stroked glyph

According to Wikipedia, Unicode pre-3.0 had the code points assigned the other way (!!!!!) and it looks like it has caused no end of problems. There are still lots of fonts out there that render the glyphs in the opposite fashion. For us, the problem is that the unicode.xml file used to autogenerate latex_symbols.jl still has the pre-3.0 code points assigned.

Technically this an upstream issue, but W3C has decided to document rather than update, so we may have no choice but to special-case phi and varphi handling.

cc: @stevengj

@jiahao jiahao added the unicode Related to unicode characters and encodings label Sep 20, 2014
@jiahao
Copy link
Member Author

jiahao commented Sep 20, 2014

Rereading the description I just posted made me realize that the problem is in my font rendering and not the way we handle tab-completion.

Closing, but user beware.

@jiahao jiahao closed this as completed Sep 20, 2014
@jiahao
Copy link
Member Author

jiahao commented Sep 20, 2014

And it turns out that Consolas, the default font on my browser (for fixed-width) and shell, is one of the few bad fonts.

Here is a quick and dirty way to programmatically check a list of fonts for this issue:

type HTML #stolen from an old @stevengj notebook
   s::String
end

import Base.writemime
writemime(io::IO, ::MIME"text/html", x::HTML) = print(io, x.s)

for font in ["Andale Mono", "Consolas", "Courant", "Courier", "Courier New",
        "DejaVu Sans Mono", "Inconsolata", "Latin Modern Mono", "Letter Gothic Std",
        "Linux Libertine Mono O", "Menlo", "MingLiU", "Monaco", "OCR A Std",
        "Osaka", "PCMyungjo", "Prestige Elite Std", "PT Mono", "SimHei", "SimSun-ExtB",
        "Source Code Pro", "TeX Gyre Cursor"]
    display(HTML("""\\phi = <font face="$font">ϕ</font> \\varphi = <font face="$font">φ</font> ($font)<br />"""))
end

which in my IJulia session produces

screen shot 2014-09-20 at 1 15 54 pm

tl;dr: don't use Andale Mono, Consolas, Osaka or SimHei if you want Unicode sanity.

@andreasnoack
Copy link
Member

I'm having the same problem with URW Garamond which is my preferred font in LaTeX. For that font, it is even worse for \kappa because it defaults to ϰ instead of κ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unicode Related to unicode characters and encodings
Projects
None yet
Development

No branches or pull requests

2 participants