amuse icon indicating copy to clipboard operation
amuse copied to clipboard

Allow named units to have a LaTeX representation (WIP)

Open rieder opened this issue 1 year ago • 4 comments

rieder avatar Sep 03 '24 14:09 rieder

Meant to allow for nice LaTeX representations like R_{\odot} instead of RSun

rieder avatar Sep 03 '24 14:09 rieder

@spzwart @LourensVeen I'd like your thoughts on this. The aim is to allow us to use this in e.g. axes for plots, where using "RSun" just looks stupid and manually putting in the unit leads to potential unit errors (I just found one in the book).

rieder avatar Sep 04 '24 13:09 rieder

Sounds like a good idea. The one thing that comes to mind is that these symbols are probably in Unicode, and that we could do that. But I'm not sure how well Unicode works in LaTeX, although it will probably work in plotting software.

Maybe something to test, it's nicer and more modern. On the other hand, LaTeX is still very widely used in science, so if Unicode doesn't solve the problem then it'll be good to have for sure.

LourensVeen avatar Sep 11 '24 15:09 LourensVeen

Unicode can work (☉ for \odot etc), but some older LaTeX implementations don't accept unicode. Also, unicode doesn't do sub/superscript etc. We could easily also add a unicode representation, where we write L☉ instead of LSun for example, but I think that wouldn't be as directly beneficial (matplotlib parses LaTeX, so that immediately works).

rieder avatar Sep 11 '24 15:09 rieder

Ready to merge I think.

rieder avatar Oct 30 '24 14:10 rieder