You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non convergence: place() seems to change here() #3614
This doesn't converge, it keeps pushing the box downwards and abort after 5 iterations. Should the absolute positioned box change the result of here()?
I could be wrong but I think this is working as intended, the here function grabs the location of the current scope, which in this case surrounds the square. Thus the here function will grab the location of the square itself and cause the box to be pushed downwards.
To circumvent this you need to give the here function an anchor to grab onto, so in 0.11 placing an invisible box will do the trick:
All that being said I feel like this is not ideal behavior, assuming my understanding of the situation is correct, the location of the scope of a context should probably be fixed to the location where it is called.
the here function grabs the location of the current scope, which in this case surrounds the square. Thus the here function will grab the location of the square itself and cause the box to be pushed downwards. To circumvent this you need to give the here function an anchor to grab onto,
I'm trying to wrap my mind around this. I'm very new to Typst.
The original scenario was something like this:
text here square --> text _ here square --> text __ here square --> ...
The new scenario, with an invisible box:
text ibox here square --> text ibox here square
In what sense the invisible box is more of an anchor than the content that previously preceded here() (which wasn't moving either)?
And in what sense the new "surrounding scope" is different to the previous one?
I'd have to wait till I have more free time to play with the source code and see how exactly this works, or see what @laurmaedje has to say, but my understanding is this:
The scope of the context is everything placed inside of the context, so in the original case this is just the square, so the abstract syntax tree looks something like this.
The here function grabs the location of closest node of the tree to its left and then above it, so in the original case it grabs the location of the context scope itself. Now the context scope only contains the square so its location after the square is placed is the same as that of the square, it wraps itself around the square. So the here ends up getting the location of the square.
On the other hand in the situation with the invisible box the syntax tree looks like this.
Now when the here function runs it finds the box first and so it grabs its location instead of that of the context, and that location is fixed so it is independent of the number of iterations.
I would classify the current behaviour as wrong. If you use here inside of a show rule for an element, it should grab that element's proper location. However, with an explicit context block, it attaching itself to the first contained element rather than being free-standing is more a result of the current implementation than intended behaviour.
Activity
AxiomOfChoices commentedon Mar 10, 2024
I could be wrong but I think this is working as intended, the
herefunction grabs the location of the current scope, which in this case surrounds the square. Thus theherefunction will grab the location of the square itself and cause the box to be pushed downwards.To circumvent this you need to give the
herefunction an anchor to grab onto, so in 0.11 placing an invisible box will do the trick:All that being said I feel like this is not ideal behavior, assuming my understanding of the situation is correct, the location of the scope of a context should probably be fixed to the location where it is called.
memeplex commentedon Mar 10, 2024
FYI: https://discord.com/channels/1054443721975922748/1088371867913572452/1216316471584751647
@laurmaedje
memeplex commentedon Mar 11, 2024
I'm trying to wrap my mind around this. I'm very new to Typst.
The original scenario was something like this:
text here square-->text _ here square-->text __ here square--> ...The new scenario, with an invisible box:
text ibox here square-->text ibox here squareIn what sense the invisible box is more of an anchor than the content that previously preceded here() (which wasn't moving either)?
And in what sense the new "surrounding scope" is different to the previous one?
AxiomOfChoices commentedon Mar 11, 2024
I'd have to wait till I have more free time to play with the source code and see how exactly this works, or see what @laurmaedje has to say, but my understanding is this:

The scope of the context is everything placed inside of the context, so in the original case this is just the square, so the abstract syntax tree looks something like this.
The
herefunction grabs the location of closest node of the tree to its left and then above it, so in the original case it grabs the location of the context scope itself. Now the context scope only contains the square so its location after the square is placed is the same as that of the square, it wraps itself around the square. So thehereends up getting the location of the square.On the other hand in the situation with the invisible box the syntax tree looks like this.

Now when the
herefunction runs it finds the box first and so it grabs its location instead of that of the context, and that location is fixed so it is independent of the number of iterations.laurmaedje commentedon Mar 11, 2024
I would classify the current behaviour as wrong. If you use
hereinside of a show rule for an element, it should grab that element's proper location. However, with an explicit context block, it attaching itself to the first contained element rather than being free-standing is more a result of the current implementation than intended behaviour.