Place
Documentation for the `place` function.
Places content relatively to its parent container.
Placed content can be either overlaid (the default) or floating. Overlaid content is aligned with the parent container according to the given alignment, and shown over any other content added so far in the container. Floating content is placed at the top or bottom of the container, displacing other content down or up respectively. In both cases, the content position can be adjusted with dx and dy offsets without affecting the layout.
The parent can be any container such as a block, box, rect, etc. A top level place call will place content directly in the text area of the current page. This can be used for absolute positioning on the page: with a top + left alignment, the offsets dx and dy will set the position of the element's top left corner relatively to the top left corner of the text area. For absolute positioning on the full page including margins, you can use place in page.foreground or page.background.
Examples
Effect on the position of other elements
Overlaid elements don't take space in the flow of content, but a place call inserts an invisible block-level element in the flow. This can affect the layout by breaking the current paragraph. To avoid this, you can wrap the place call in a box when the call is made in the middle of a paragraph. The alignment and offsets will then be relative to this zero-size box. To make sure it doesn't interfere with spacing, the box should be attached to a word using a word joiner.
For example, the following defines a function for attaching an annotation to the following word:
The zero-width weak spacing serves to discard spaces between the function call and the next word.
Accessibility
Assistive Technology (AT) will always read the placed element at the point where it logically appears in the document, regardless of where this function physically moved it. Put its markup where it would make the most sense in the reading order.
#place(
alignment,
scope: str,
float: bool,
clearance: length,
dx: relative,
dy: relative,
body
) -> contentParameters
Prop
Type
Definitions
Asks the layout algorithm to place pending floating elements before continuing with the content.
This is useful for preventing floating figures from spilling into the next section.