Consider the consequences to a parser when there are multiple forms of what appear to be (say) "+" or "space" or "A" (is that a capital alpha?) .. Selecting Greek or other symbols from a palette might be cute. Freeform input of unicode, probably a bag of worms. RJF
On Friday, February 21, 2020 at 8:09:36 AM UTC-8, Nicolas M. Thiéry wrote: > > Hi, > > Since Sage uses Python 3, we can finally use unicode symbols for > variables: > > sage: Φ = lambda λ: λ + 1 > > But how to input them? I just accidently discovered that IPython (and > thus Jupyter) makes it super easy. Type: > > sage: \Phi<tab> > > And you get: > > sage: Φ > > > https://ipython.readthedocs.io/en/stable/api/generated/IPython.core.completer.html#forward-latex-unicode-completion > > > Reverse conversion from symbol to latex name works too: > > sage: \Φ<tab> > > And you get: > > sage: \Phi > > Not all symbols are available by default; for example \otimes. But > it's possible to add more symbols: > > import IPython.core.completer > IPython.core.completer.latex_symbols[r'\otimes'] = '⊗' > > (best to add it as well to reverse_latex_symbol). > > > A rather big caveat though: one can easily input all the usual math > glyphs (mathbb, mathfrak, ...) of a character. However they all are > considered as equal by Python itself: > > sage: \mbfN<tab> > sage: 𝐍 > <function numerical_approx at 0x7f712339f6a8> > sage: N > <function numerical_approx at 0x7f712339f6a8> > > Cheers, > Nicolas > -- > Nicolas M. Thiéry "Isil" <nth...@users.sf.net <javascript:>> > http://Nicolas.Thiery.name/ > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/eee9a835-b09f-4c57-8c2c-c46ee9a88028%40googlegroups.com.