#numbering

9 messages · Page 1 of 1 (latest)

cold totem
#

So i'm trying to get a numbering and underline of headings.

  show heading: it => {
    [
      #underline(
        offset: 0.2em,
      )[#h(1em * (it.level - 1)) #locate(loc => { counter(heading).at(loc).map(str).join(".") }).
        #it.body]
      #v(1em)
    ]
  }

i wrote that show rule, but it also numbers my outline
How can i do both?

signal ivy
#

Hmmm ah

#

I thought you were changing the number

#

But you aren't

#

im assuming #show heading: underline.with(offset: 0.2em) didn't work for some reason?

cold totem
#

oh i didn't know that existed

#

if i don't know i just rebuild from sratch tbh

signal ivy
#

Note that underline.with(offset: 0.2em) is equivalent to (..args) => underline(offset: 0.2em, ..args)

And since show rules always call the function to the right with one parameter, that show rule is equivalent to

#show heading: it => underline(offset: 0.2em, it)

#

So you're basically applying the underline on the entire heading