-
-
Notifications
You must be signed in to change notification settings - Fork 660
src/sage/misc/sagedoc.py: Add latex to unicode mappings #35493
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
base: develop
Are you sure you want to change the base?
Conversation
I agree with this, but I forget what our policy is on assuming that users have a terminal that supports unicode. Also, what about the other (more common) Greek letters? It would look quite weird to only have some of them changed to unicode. |
At JabRef we have made good experiences with the small latex2unicode library. It's written in Scala, so not reusable here but the encoding map is rather complete: https://github.com/tomtung/latex2unicode/blob/master/src/main/scala/com/github/tomtung/latex2unicode/helper/Escape.scala |
I don't think we have a policy for this formulated anywhere. The I wouldn't be concerned about terminal capabilities. I'd think the most plausible compatibility issue would be (1) workflows in which users copy-paste terminal output into a LaTeX document, without loading the necessary packages for input and font configuration; or (2) programs that run Sage as a subprocess. |
Thanks for the pointer! Looking great. I think somewhere in IPython/Jupyter there also must be a package that contains such mappings already, for offering tab-completion with the latex names. |
Yes, it's not complete, of course; this is just a mockup that makes Also, because the substitutions are regex-based, there is a potential for breakage from unintended matches. For example, so far I have shied away from handling the |
And finally, it seems to me that this is something that should be taken care of in a more reusable way, perhaps a Sphinx extension. Mildly related: |
The unfortunate side-effect is that it makes any doc that only does part of it look very broken. This is a good proof-of-concept right now, but I think it would be hard to convince people that our doc formatter is not horribly broken without doing certain subsets (e.g., all Greek letters).
Indeed, that might be a hard one to deal with. I think we would be better of replacing our docstrings with something like |
I found these but haven't looked at them in any detail:
|
Documentation preview for this PR (built with commit e17b688; changes) is ready! 🎉 |
📚 Description
Docstrings formatted for the terminal, in uses like
CliffordAlgebra?
, are difficult to read when heavy LaTeX markup is used.We add some mappings that replace LaTeX commands by Unicode characters.
Resolves #35491
📝 Checklist
⌛ Dependencies