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" <nthi...@users.sf.net>
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/20200221160932.GJ3271%40mistral.

Reply via email to