I have a simple wrapper function that determines the size of a block with #layout, calculates some spacing, and applies it using #pad.
However, when using it with a floating figure, the figure only floats to the top/bottom of this function instead of the page like it’s supposed to. Is there a way to change that (or a better way to handle the whole thing)?
Here’s an MWE:
#let lead = 13pt
#let a(it) = layout(size => [
#let (height,) = measure(
block(width: size.width, it),
)
#let padding = lead
#while height > padding {
padding = padding + lead
}
#pad(bottom: (padding + lead - height), it)
])
#lorem(10)
#a[
#figure(
caption: [Test],
placement: bottom,
rect(height: 30pt)
)
]
#lorem(10)
Edit: I’m aware that floating figures’ spacing happens via place.clearance. This function is also used for other content where it works fine, so I want to get the floating working before dealing with that.