Error for parent-scoped figures without placement (#5151)

This commit is contained in:
Laurenz 2024-10-07 16:13:24 +02:00
parent 60bd92eec6
commit 5220f362a5
2 changed files with 11 additions and 0 deletions

View File

@ -351,6 +351,12 @@ impl Show for Packed<FigureElem> {
.with_float(true)
.pack()
.spanned(self.span());
} else if self.scope(styles) == PlacementScope::Parent {
bail!(
self.span(),
"parent-scoped placement is only available for floating figures";
hint: "you can enable floating placement with `figure(placement: auto, ..)`"
);
}
Ok(realized)

View File

@ -77,6 +77,11 @@ We can clearly see that @fig-cylinder and
#lines(15)
--- figure-scope-without-placement ---
// Error: 2-27 parent-scoped placement is only available for floating figures
// Hint: 2-27 you can enable floating placement with `figure(placement: auto, ..)`
#figure(scope: "parent")[]
--- figure-theorem ---
// Testing show rules with figures with a simple theorem display
#show figure.where(kind: "theorem"): it => {