-
-
Notifications
You must be signed in to change notification settings - Fork 939
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
Add more math operators #1090
Add more math operators #1090
Conversation
i think you can always use |
That's just unnecessary boilerplate. And we already got that framework for |
As I'm not a mathematician, I don't know how common these are. We can't support every operator, but of course we should support common ones. We should also seek to prevent confusion, |
I think that adding every math operator under the sun as predefined is a slippery slope. Both because their names are less agreed upon ( There is already https://typst.app/docs/reference/math/op/ for you to define operators to your heart's content. In this PR I'd claim that (I say this as a mathematician) |
That's the first thing I thought of. Also, we have to be careful to not create a footgun for ourselves, as adding too many operators means we won't be able to declare functions with their names in the future without causing a breaking change. So this must be treated carefully. As an aside, perhaps a way to tackle this would be to hide extra operators behind a module or function scope? Such as |
Quick side note to "i think you can always use I am a mathematican too 😊 And yes they are definitely common. And I of course agree we can't support all of them but should predefine the most common ones. The int-integral confusion shouldn't be a big deal hopefully because the interior is mostly used with brackets like this: int() and operates on sets. That just doesn't make sense for integrals. Also the interior and an integral don't often show up in the same place. And people who write with typst will know that the integral symbol is named integral I guess. @Enivex This PR isn't adding every math operator under the sun... @PgBiel I think the I'd argue that the ones I want to add are fundamental to mathematics. If you still pull your veto in the end lets make it at least consistent and remove things like ker (which IMO would be a big loss though) |
I'm not arguing that they aren't, just that the notation is less universal. I'll just point out that LaTeX also has ker, but none of the operators you propose here. |
Would it be possible to import them in such a way that one does not need the verbose prefix if one actually wants to use them? |
Yes, you can use |
Yes that part referred to Laurenz and the fact the we all agree only important and fundamental operators should be predefined :) Weird that LaTeX is missing some important stuff too :( |
The reasons are likely similar to what I mentioned here. Thankfully, it seems like a no-brainer to have additional categories of operators that can be imported, based on what @PgBiel says. (I think it should be more than one "blob" though) |
What if, instead of hiding operators behind an For example, when writting a document on, say, linear algebra, you would import the This solution lets us add specific operators without fear of cluttering the main namespace, and it prevents operators from different fields from interfering with each other (a bit like |
Hmm. Makes sense yes. It should be a sub module though like Also Im and im don't collide because it's case sensitive. |
Yeah but in general I think relying on case only is something that should be avoided when possible. It just makes it more confusing. |
Are there any of these operators for which there is consensus that they should be globally available, e.g. |
I don't know. I guess a consensus is impossible to reach. Someone always will disagree. Someone just has to make a decision. They all won't hurt but I agree that someone would need to create a module system which fully resolves this "problem" by grouping operators for example in "trigonometry", "linear-algebra", etc. and deciding on a few fundamental ones that work out of the box. Deciding on these while trying to make everyone happy will be impossible. Someone with power just has to do it ig 🤷♀️ For now I think |
Sorry for the long wait. We discussed a bit more on Discord. I would be on board with adding |
Oh don't worry. Sounds good to me! I will update the PR later today. |
There is a list on the text operator page. It is not automatically generated though. |
Oh perfect! Sorry for the ping then. |
Added some missing ops.
id
: identity (very important)im
: image (if there isker
we also needim
; also doesn't collide withIm
)tr
: trace (also relevant for linear algebra and kind of in the same class asdet
anddim
)cl
: closure (important in topology and analysis)int
: interior (important in topology and analysis)