On 2020-02-21, Simon King <simon.k...@uni-jena.de> wrote: > Hi Emmanuel, > > On 2020-02-21, Emmanuel Charpentier <emanuel.charpent...@gmail.com> wrote: >> sage: latex(λ^2) >> λ^{2} > > Couldn't we modify the latex() function, by exploiting > IPython.core.completer.reverse_latex_symbol, to automatically translate > all unicode symbols that aren't understood by pdflatex?
Such as: sage: import IPython sage: from IPython.core.completer import reverse_latex_symbol sage: def replfunc(match): ....: return reverse_latex_symbol[match.group(0)] ....: sage: import re sage: regex = re.compile('|'.join(re.escape(x) for x in reverse_latex_symbol)) sage: f(λ) = sin(λ) sage: latex(f) λ \ {\mapsto}\ \sin\left(λ\right) sage: print(regex.sub(replfunc,latex(f))) \lambda \ {\mapsto}\ \sin\left(\lambda\right) Best regards, Simon -- 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/r2pj45%24q7v%241%40ciao.gmane.io.