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
Show-set rule is not able to set all fields (synthesized ones) #2459
It is not possible to set some settable figure parameters via a show-set rule. Take the following example that aims to remove the supplement from a figure caption:
//#show figure: set figure(supplement: none) // DOES NOT WORK//#set figure(supplement: none) // DOES WORK#figure(
[],
caption: [
This is a caption.
],
//supplement: none // DOES WORK
)
A possible use case is to make the supplement bold for figures but not for tables.
I found this behavior for the supplement and numbering parameters, but interestingly not for gap.
More generally show-set on the same element does not work for synthesized fields (which aren't really a user-facing concept). I intend to fix this alongside other styling bugs like recursive show rule crashes.
changed the title [-]Show-set rule is not able to set set some figure parameters[/-][+]Show-set rule is not able to set all fields (synthesized ones)[/+]on Nov 14, 2023
Possibly related, trying to set supplement via just a normal set rule does not work as expected. The code
set figure(
numbering : it => text(weight:"bold", fill:purple)[#it],
supplement : it => text(weight:"bold", fill:purple)[#it],
)
is supposed to set figure supplements and numbers to have the same weight and color. The numbering setting works as expected, but the supplement setting ends up replacing the supplement with the figure itself. I would expect that it in this context refers to the supplement and not to the figure.
@SeSodesa Pretty sure that example is working as intended. You're just overiding the values of the numbering and supplement fields with the functions you wrote. It just happens that both those fields can take functions.
The bug is longer-standing than the content rework. It falls directly under styling rework and is, in fact, what I am working on right now, as we speak (alongside #351).
Activity
laurmaedje commentedon Oct 21, 2023
More generally show-set on the same element does not work for synthesized fields (which aren't really a user-facing concept). I intend to fix this alongside other styling bugs like recursive show rule crashes.
[-]Show-set rule is not able to set set some figure parameters[/-][+]Show-set rule is not able to set all fields (synthesized ones)[/+]SeSodesa commentedon Nov 23, 2023
Possibly related, trying to set
supplementvia just a normalsetrule does not work as expected. The codeis supposed to set
figuresupplements and numbers to have the same weight and color. Thenumberingsetting works as expected, but thesupplementsetting ends up replacing the supplement with the figure itself. I would expect thatitin this context refers to thesupplementand not to thefigure.laxsjo commentedon Dec 13, 2023
@SeSodesa Pretty sure that example is working as intended. You're just overiding the values of the
numberingandsupplementfields with the functions you wrote. It just happens that both those fields can take functions.numberinghappens to take an argument that is usefull,but functions in
supplementtake the figure body element as an argument (I assume to be able to adjust thesupplementbased on the figure content)Here is the documentaiton for
numbering: https://typst.app/docs/reference/model/figure/#parameters-supplementI agree that it would be very usefull for there to be some mechanic to "set" a field by updating whatever value was set previously.
Dherse commentedon Jan 26, 2024
@laurmaedje Do we consider this:
#[elem]macro?laurmaedje commentedon Jan 26, 2024
The bug is longer-standing than the content rework. It falls directly under styling rework and is, in fact, what I am working on right now, as we speak (alongside #351).