How can I replicate this LaTeX environment in Typst?

I wrote a small code to wrap some LaTeX environments with tcolorbox: Overleaf project

Can I do something similar in Typst that handles pagebreaks and automatic numbering of environments? If yes, any guidance with links/resources is much appreciated. I’m quite new to this tool and looking forward to use it.

Thank you.

Hey. The link is restricted.

My bad. I just updated the link. Thank you.

1 Like

The colored corners can be done with a breakable block and place. (First time using curve no idea if it can be done better.)

#let colored-corners(color: red, body) = block(width: 100%, spacing: 2em, inset: 1em, breakable: true, {
  place(
    top+left,
    dx: -1em,
    dy: -1em,
    curve(
      stroke: color+.1em,
      curve.move((1em, 0pt)),
      curve.line((0pt, 0pt)),
      curve.line((0pt, 1em)),
    )
  )
  body
  place(
    bottom+right,
    dx: 1em,
    dy: 1em,
    curve(
      stroke: color+.1em,
      curve.move((-1em, 0pt)),
      curve.line((0pt, 0pt)),
      curve.line((0pt, -1em)),
    )
  )
})

#colored-corners[
  #lorem(20)
]

You can probably just wrap one of the existing environment implementations with the above colored corner code.

4 Likes

What a great answer! Thank you!