Touying config-page margin, y values are not working

A tough situation… In touying/themes/university.typ at de35911fe057df91ca6ca4bd22e36b63acf47a25 · touying-typ/touying · GitHub the top and bottom margins are already defined, which take precedence over y. And since I assume the normal folding/merging is happening, you can’t reverse the precedence.

First it merges page config with (margin: (x: 3em, y: 2.8em)), then it gets to (margin: (top: 2em, bottom: 1.25em, x: 2em)), and finally merges (margin: (x: 2em, y: 4em)). So…it’s basically how it is (how folding works in general).

Unless…you can somehow introduce “user-defined” markers, which you can then check and in these very niche use cases swap the precedence. This is probably very niche because there are not many if any values like these. That have “layers” with value and then x/y and then top/bottom/left/right. Though one thing I’m pretty sure, is that you’d always want it (user-defined config) to have higher precedence than built-in default or template defaults.

Oh, right, I guess you can check for the “higher layer” (more broad “selector”), and if you found one, it just overrides the lower layer, i.e., (top: 2em, bottom: 1.25em) will be gone if merged with (y: 4em).

Yeah, this actually makes more sense since passing a value instead of a dictionary already reverses the precedence, i.e., less specific (more broad) setting wins.

Here is the potential fix: fix: correctly handle page margin merge/precedence by Andrew15-5 · Pull Request #322 · touying-typ/touying · GitHub.

2 Likes