#How to make different spacing between `heading + heading` and `heading + text`?

9 messages · Page 1 of 1 (latest)

bold flame
#

How to make the indentation between heading.where(level: 1) and heading.where(level: 2) be 12pt (red line) and between heading.where(level: 1) and par() be 18pt (blue line)? I could do something like `#v(-6pt), but I don't want to do it manually every time.

humble hound
#

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

bold flame
#

?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)
bold flame
#

So, as you can see that your code changes not only the indentation between h1 and h2, but also between h1 and h1.