#stack but unbreakable

9 messages · Page 1 of 1 (latest)

somber nimbus
#

I created first-level headings that look like in the picture, which is what I want.
However there is a problem then the heading is close to the end of the page, then the line is on the next page but the heading text stays on the same page.
I implemented the heading like this:

stack(
  block[
    #counter(heading).display()
    #h(4pt)
    #it.body
  ],
  v(13pt),
  line(length: 100%, stroke: 1pt),
  v(32pt)
)

What I need is something like an breakable: false attribute of stack.
I tried to wrap the stack inside block(breakable: false)[/*stack ...*/], but this added unwanted vertical space above the heading.

I want to use stack since I need to precisely control the spacing between the line and the heading ...

paper socket
#

How about just putting another block around it?

somber nimbus
paper socket
#

Try setting inset and outset to 0 on the containing block

#

Or 0pt to be exact, since it expects a length not an integer

somber nimbus
#

Ok never mind,
I had a problem in my code where the [ of the block was on the next line, like this:

#

?r

#{
    //[#pagebreak(weak: true)]
    block(breakable: false, inset: 1pt, outset: 0pt, fill: red)
    [
    #stack(
      v(10mm),
      block[
        #counter(heading).display()
        #h(4pt)
        Heading
      ],
      v(13pt),
      line(length: 100%, stroke: 1pt),
      v(32pt)
    )
    ]
  }
somber nimbus
#

Kind of strange that I did not get an error. Also the [ was not displayed as text, this is why I did not notice the problem...