How can I remove extra padding above and below block quotations?

#set quote(
  block: true,
)

#show quote: set pad(y: 1em)

#quote([
  Quote 1. #lorem(25)
])

#lorem(50)

#quote([
  Quote 2. #lorem(25)
])

#lorem(50)

#quote([
  Quote 3. #lorem(25)
])

#quote([
  Quote 4. #lorem(25)
])

#lorem(50)

How can I remove extra padding above and below block quotations?

I tried #show quote: set pad(y: 1em), but this didn’t help.

As a quote is a block element, you can use a show-set rule to override the above and below spacing values:

#show quote: set block(above: 2.4em, below: 1.8em)

These values are the default values that are set internally, so you want to choose something smaller than that. You can also set the spacing property instead to set both the above and below spacing to the same value.

1 Like

This works, thanks. But could you explain why using y: <value> instead of above: <value>, below: <value> doesn’t work?

You said “You can also set the spacing property instead to set both the above and below spacing to the same value”. But it seems this is the only option then?

Note Eric used set block(), not set pad(). the horizontal padding and vertical spacing are set via properties of different elements. spacing is a shortcut for above and below, separate from pad.y.

1 Like

Thanks, now I see. (Lorem ipsum dolor sit amet. Post must be at least 20 characters. Not sure this is a good UI idea.)

Could you explain, why

  • #show quote: set block(above: 1em, below: 1em) and
  • #show quote: set block(above: 0em, below: 0em)

give different visual outputs, whereas

  • #show quote: set block(spacing: 1em) and
  • #show quote: set block(spacing: 0em)

give the same visual output (and which is the same as produced by above: 1em, below: 1em? Which version makes more sense: spacing: 1em or spacing: 0em?

As far as I know, that has to do with the above and below parameters currently taking priority over the spacing parameter. Normal text paragraphs also have a spacing that is set via the above property. Thus, when a paragraph collides a quote whose spacing is set via the spacing property, the above value of the paragraph wins.

That is actually an issue with the current Typst version that will be fixed very soon with the release of v0.12.

1 Like

In reply to my own question above:

One practical difference between above: Xem, below: Xem and spacing: Xem can be seen here: Why 'where(block: true)' doesn't work with 'set block'?