Neural Sketch
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

\nskWrap[<options>]
\nskWrap![<options>]   % wrap on the right instead of left

Basic Usage

Wrap a block below and to the left of a reference block:

\begin{nskFigure}
  \nskBlock[id=ref, text-center={Reference}]
 
  \nskWrap[under=ref]
  \nskBlock[text-center={Wrapped Left}]
\end{nskFigure}

Advanced Example

Wrap a block above and to the right of a reference, with custom offsets:

\begin{nskFigure}
  \nskBlock[id=main, text-center={Main Block}]
 
  % Leading '!' switches to right-side wrapping
  \nskWrap![over=main, shift-x=2mm, shift-y=-1mm]
  \nskBlock[fill=nskBlue, text-north={Wrapped Right}]
\end{nskFigure}

Available Options

Reference & Direction

  • under (token list): Identifier of the node to wrap below. Sets direction=below and anchor=north.
  • over (token list): Identifier of the node to wrap above. Sets direction=above and anchor=south.
  • target (token list): Alias for the node when you prefer to set direction 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:

  1. Inserts a hidden marker via \nskMark at the computed position relative to your reference node.
  2. Sets an internal boolean flag (g_nsk_wrap_left_bool or g_nsk_wrap_right_bool).
  3. Causes the next \nskBlock to pick up that flag and adjust its anchor and placement accordingly.

Practical Tips

  • Use under for vertical stacking and over 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

PropTypeDefault
under?token list{}
over?token list{}
target?token list{}
shift-x?dimension0cm
shift-y?dimension0cm

On this page