Commands/preloaded
nsk@Wrap
Configure wrapping behavior for the next block relative to an existing element.
Overview
The \nskWrap
command sets up a wrap marker and flag so that the next block you draw will be positioned relative to a specified reference node, with consistent spacing and alignment. By default it wraps on the left side; prefixing with !
wraps on the right.
nskWrap
leverages an internal \nskMark
node to anchor and then
automatically adjusts the placement of the following \nskBlock
call.
Syntax
Basic Usage
Wrap a block below and to the left of a reference block:
Advanced Example
Wrap a block above and to the right of a reference, with custom offsets:
Available Options
Reference & Direction
under
(token list
): Identifier of the node to wrap below. Setsdirection=below
andanchor=north
.over
(token list
): Identifier of the node to wrap above. Setsdirection=above
andanchor=south
.target
(token list
): Alias for the node when you prefer to setdirection
manually.
Side Control
- Without
!
(default): Wraps on the left side (left
flag). - With leading
!
: Wraps on the right side (right
flag).
Fine-Tuning
shift-x
(dimension
, default=0cm
): Horizontal adjustment of the wrap marker and block.shift-y
(dimension
, default=0cm
): Vertical adjustment of the wrap marker and block.
Internal Mechanics
When you invoke \nskWrap
, it:
- Inserts a hidden marker via
\nskMark
at the computed position relative to your reference node. - Sets an internal boolean flag (
g_nsk_wrap_left_bool
org_nsk_wrap_right_bool
). - Causes the next
\nskBlock
to pick up that flag and adjust its anchor and placement accordingly.
Practical Tips
- Use
under
for vertical stacking andover
for top-aligned wrapping. - Prefix with
!
to switch sides without changing any other options. - Combine
shift-x
/shift-y
to fine-tune positions when default spacing isn’t quite right.
Reference Table
Prop | Type | Default |
---|---|---|
under? | token list | {} |
over? | token list | {} |
target? | token list | {} |
shift-x? | dimension | 0cm |
shift-y? | dimension | 0cm |