#How to make different spacing between `heading + heading` and `heading + text`?
9 messages · Page 1 of 1 (latest)
hey, i was looking for the same answer, and i found the solution in case someone would be looking for it try this :
show heading: set block(spacing: 1em)
show heading.where(level: 1): it => block(text(size: 12pt,strong(upper(it.body))) + v(-0.5em))
show heading.where(level: 2): it => block(text(size: 10pt, strong(it.body))+ v(-0.4em))
try playing with the "em" you'll find out
Seems this is not an answer because it doesn't take into account that the indentation between h1 and h2 should be different than between h1 and paragraph. It changes all indents in level: 1 and level: 2 without exception.
?r ps=a t=l
#let spacing = .5em
#set heading(numbering: "1.1.")
#show heading: set block(spacing: spacing)
#show heading.where(level: 1): it => block(it + v(-1 * spacing))
#show heading.where(level: 2): it => block(it + v(1 * spacing))
It does:
= #lorem(2)
== #lorem(2)
= #lorem(2)
= #lorem(2)
/////////////
#context { counter(heading).update(0)}
#v(32pt)
What I wanted:
= #lorem(2)
#v(12pt)
== #lorem(2)
= #lorem(2)
#v(18pt)
= #lorem(2)
So, as you can see that your code changes not only the indentation between h1 and h2, but also between h1 and h1.
This is the issue: https://github.com/typst/typst/issues/4281 with «dirty» solution from @old jacinth at the end of the discussion (but I didn't test it).