Can Typst detect the current column?

I have a two-column layout. I’d like to insert symbols in the appropriate margin (left or right) at certain points in the text. Ideally I could do this automatically. Automatically adding symbols is straightforward, but I’m not sure of the best way to automatically determine the appropriate margin to place them in.

Currently I’m using

  set text(blue)
  underline(overline[*#words*])
  place(left, dy: -1.5em, dx: -1.5cm, block(image("Handout.png", width: 1cm)))
}

to insert the images whenever I tag a keyword.

I think I could use location and then run calculations vs. page size to work out whether it’s the left or right column, and place it appropriately, but if there’s a more elegant way that would be great.

Hi, welcome to the Typst forum! The idea you suggest is the only way I know of to do this. Note that you can get the current location with the here function.

1 Like