How to place something in the margin at the begining of a paragraph

Hi,
I’m trying to add some stuff in the margin for some paragraphs.

I use something like this :

#set page(width: 6cm, height: 6cm, margin: 1cm)

#let side(c) = place(dx: -0.7cm)[#c]

#lorem(10)

#side[B] #lorem(10)

#side[C] #lorem(10)

It goes right until an automatic pagebreak happen (if I add manual #pagebreak(), it’s ok, but not really satisfying…)

I took a look at How does one place content relative to the page margin? but it’s not really my use case.

Any ideas ?

You could wrap the current side function in a sticky block (and set the spacing appropriately):

#let side(c) = block(
  place(dx: -0.7cm, c),
  sticky: true,
  below: 0pt
)

1 Like