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
When investigating hydra#2 I stumbled upon something interesting. It's regarding how locations for elements are created when show rules with leading invisible elements are involved.
In the following show rules, the location of elem changes depending on the rule.
#showelem: it=> {
v(8cm)
// loc starts here, this makes sense as the spacing is invisible and a user likely cares more about where the actual content startsit
}
#showelem: it=> {
// loc starts here, this makes sense, the block may not be invisibleblock({
v(8cm)
it
})
}
#showelem: it=> {
// loc starts here, this makes no sense as metadata is not just invisible it's also 0-sizedmetadata(none)
v(8cm)
it
}
A similar thing happens to page numbers for locations when a rule of the following form is given:
// introspection thinks this element appears on the previous page#showelem: it=>counter(other).update(0) +pagebreak(weak: true) +it
The latter example involving page breaks may seem contrived, but is a real problem in templates.
If a template provides a heading show rule that adds leading weak page breaks on level 1 headings, then any rule added by the user below the template itself may add arbitrary, perhaps invisible elements to the front of those headings. The user may not even be able to put it before the template if the template adds other headings where their rule should not apply.
Given how many styles a template may apply, adding a sort of override function that a user could pass in that is applied before this to circumvent this becomes unfeasible, needlessly complicated and unidiomatic.
Description
When investigating hydra#2 I stumbled upon something interesting. It's regarding how locations for elements are created when show rules with leading invisible elements are involved.
In the following show rules, the location of
elem
changes depending on the rule.A similar thing happens to page numbers for locations when a rule of the following form is given:
The latter example involving page breaks may seem contrived, but is a real problem in templates.
If a template provides a heading show rule that adds leading weak page breaks on level 1 headings, then any rule added by the user below the template itself may add arbitrary, perhaps invisible elements to the front of those headings. The user may not even be able to put it before the template if the template adds other headings where their rule should not apply.
Given how many styles a template may apply, adding a sort of override function that a user could pass in that is applied before this to circumvent this becomes unfeasible, needlessly complicated and unidiomatic.
Reproduction URL
https://typst.app/project/rgKG6an4XgcA6_QwpIefzT
Operating system
Web app
Typst version
The text was updated successfully, but these errors were encountered: