Skip to content
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

Consider supporting standard direction names in addition to cardinal directions #714

Open
Andrew15-5 opened this issue Oct 10, 2024 · 7 comments
Labels
feature 🎁 Feature Request

Comments

@Andrew15-5
Copy link
Contributor

Even though this might very well be a skill issue, I still don't like using the cardinal directions in my vector graphics in Typst. First, it's confusing/disorienting to me. But I think it mostly has to do with the fact that top/bottom/right/left directions are just too common to use anything but them. I think it's correct to say that Americans love using cardinal directions, but still. Everyone uses standard names, and so does Typst.

I would like to be able to anchor my elements in cetz with "top-left" or top + left instead of "north-west".

I honestly think that this is one of my main issues with cetz (and tikz) when I want to fine-tune something. It doesn't break anything, but I struggle (even if ever so slightly) every time I have to use them.

This is also why I love fletcher, as it provides up to 3 names for the same direction, which is described under the "Relative coordinate shorthands" section:

Like node positions, edge vertices may be specified by CeTZ-style coordinate expressions, combining elastic and physical coordinates.

Additionally, you may specify relative shorthand strings such as "u" for up or "sw" for south west. Any combination of top/up/north, bottomp/down/south, left/west, and right/east are allowed.

I like the fact that all of these start with a unique letter, so you can even use the 1-letter shorthands (in addition to the full names). Not sure if it will work for cetz, but would be cool if shorthands are also supported (you wouldn't even have to write the dash for compound directions).

(I also found a typo: Jollywatt/typst-fletcher#52.)

@johannes-wolf johannes-wolf added the feature 🎁 Feature Request label Oct 10, 2024
@johannes-wolf
Copy link
Member

Not a fan of having multiple names for the same thing.
I can see "north-west" etc. being a bit long to type,
shorter names like "n", "nw", ... would be better.

@Andrew15-5
Copy link
Contributor Author

Not a fan of having multiple names for the same thing.

I mean, yes, but what is the actual problem? I think the freedom of choice is great. There are definitely a lot of people that would prefer one or the other naming scheme any day of the week. The consistency of the names inside a project is the project author's problem, not the library's.

@johannes-wolf
Copy link
Member

How should it work? Hardcoding "n" to resolve to "north-west"?
Because there should only be a single anchor for the north coordinate.

@johannes-wolf
Copy link
Member

You can define some variables: #let n = "north" etc.

@Andrew15-5
Copy link
Contributor Author

How should it work?

Same as it works in fletcher? Or not, because fletcher is pretty much a cetz wrapper, so they differ.

I'm talking about "top-left" == "north-west". The direction names are even builtins in Typst, surely they deserve to be first-class directions in cetz too.

@johannes-wolf
Copy link
Member

johannes-wolf commented Nov 27, 2024

But names like "top-left" have no real benefit over "north-west". They are not even that much shorter. I think supporting multiple variations is not a good idea, it can cause lots of conflicts, when overwriting anchors, custom elements etc. etc.
I suggest adding some constants to your documents.

@Andrew15-5
Copy link
Contributor Author

But names like "top-left" have no real benefit over "north-west".

It's personal preference at it's core. I never in my life used cardinal directions outside of Earth map and compass. So I don't want to start using it now. This highly depends on the country too.

it can cause lots of conflicts, when overwriting anchors, custom elements etc. etc.

I don't understand what kind of conflicts could possibly appear when supporting multiple names. If you wanna override something using other names, then just do it, there are no conflicts here.

I suggest adding some constants to your documents.

That's the problem. I would have to add this for every single document where I use anchors. The library should reduce the boilerplate, not the other way round. It's not even some niche obscure feature that only I will use. It's a normal one, to say the least.

I can cope with my overrides if I was able to import my library at any point, but git repos aren't supported yet and I don't want to increase amound of local packages that can't be easly used elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎁 Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants