TypstDocumentation

locate

Provides access to the location of content.

This is useful in combination with queries, counters, state, and links. See their documentation for more details.

#locate(loc => [
  My location: \
  #loc.position()!
])
Preview

Parameters
Question mark

locate() -> content

func
function
RequiredPositional
Question mark

A function that receives a location. Its return value is displayed in the document.

This function is called once for each time the content returned by locate appears in the document. That makes it possible to generate content that depends on its own location in the document.