Leedehai / typst-physics

physica: vectors, fields, differentials, derivatives, Dirac brakets, tensors, and more. See examples in the manual PDF.
https://github.com/Leedehai/typst-physics
MIT License
343 stars 11 forks source link

Update the tensor function #35

Closed StrangeGirlMurph closed 3 days ago

StrangeGirlMurph commented 1 week ago

Hey :) I modified the tensor function a bit. It now defaults to showing everything as a superscript if no + or - is given. I also made the function a bit more robust. It for example also handles cases like $tensor(R,e,-)$.

I also encountered and dove deep into the same thing that confused you. https://github.com/Leedehai/typst-physics/blob/1cd65e1b8904cb69267f6b8982d0564953c25178/physica.typ#L841 If you want to learn more see the discussion on discord: https://discord.com/channels/1054443721975922748/1088371867913572452/1297487726387400775 (Basically "-" != math.minus = sym.minus)

Feel free to just take this as an inspiration if you're not happy with the implementation directly. Also please play around with it. It should feel very natural.

Leedehai commented 3 days ago

Thank you!