I'm using typst 0.11.1. How do you add spacing between figures, and the subsequent text?
If captions become very long, it can be hard to see where it ends, and the surrounding text begins. Example:
#lorem(50)
#figure(block(width: 100%, height: 10em, fill: green), caption: [Shrek green. #lorem(35)])
#lorem(70)
Where is the option to add padding around a figure?
Update:
The previous solution was leaving blanks at the places where the figure was originally placed before floating. The Github user eltos has created a better rule (requires Typst >0.12.0):
#let figure_spacing = 0.75em // Additional spacing between figures and the text
#show figure: it => {
if it.placement == none {
block(it, inset: (y: figure_spacing))
} else if it.placement == top {
place(
it.placement,
float: true,
block(width: 100%, inset: (bottom: figure_spacing), align(center, it))
)
} else if it.placement == bottom {
place(
it.placement,
float: true,
block(width: 100%, inset: (top: figure_spacing), align(center, it))
)
}
}
#lorem(20)
#figure(block(width: 100%, height: 10em, fill: green), caption: [Shrek green. #lorem(35)], placement: top)
#lorem(10)
#figure(block(width: 100%, height: 10em, fill: green), caption: [Shrek green. #lorem(35)], placement: none)
#lorem(10)
#figure(block(width: 100%, height: 10em, fill: green), caption: [Shrek green. #lorem(35)], placement: bottom)
#lorem(50)
Old Answer (produces blanks between paragraphs)
in Typst 0.13 you can use the following show
rule to add some top and bottom spacing around each figure:
#show figure: f => {[#v(2em) #f #v(2em) ]}
#lorem(50)
#figure(block(width: 100%, height: 10em, fill: green), caption: [Shrek green. #lorem(35)])
#lorem(70)