Skip to content

State management in CeTZ #739

Answered by johannes-wolf
noahjutz asked this question in Q&A
Discussion options

You must be logged in to vote

Maybe using anchors is enough for drawing nodes next to each other? Note that you can overwrite anchors (e.g. calling something like anchor("last-elem", (...)) multiple times works).

Yes, you can use cetz context for this. The simplest way to modify the context is by calling set-ctx(ctx => { ... return ctx }). If you need more control, you can define your own elements, because all elements can modify the context (note that the context is scoped by groups/scopes).

An element function (like line()) returns a single-element array containing a function
that takes a context and returns a dictionary with it's (optional) drawables (paths) and a new context.

For an example, have a look at how group

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by noahjutz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants