Neural Sketch
Commands/measure

nsk@MeasureR

Internal measurement engine powering `\nskMeasure` in Neural Sketch

Overview

The \nskMeasureR command is the low-level implementation behind the user-facing \nskMeasure macro. It handles parsing of measurement keys, computes the distance between two anchor points along a specified axis, updates the internal \nskDistance length, and optionally assigns the result to another macro.

  • When invoked without any options, \nskMeasureR expands to the previously stored distance (\nskDistance).
  • When invoked with an option list, it computes a new measurement and stores it.

Most users should use \nskMeasure; \nskMeasureR is provided for advanced or internal use cases.

Usage

\nskMeasureR[axis=<axis>, from=<node.anchor>, to=<node.anchor>, into=<macro>]
  • No argument: expands to \nskDistance.
  • With arguments: processes the keys and performs the measurement.

Available Options

  • axis (choice, default=horizontal): Axis along which to measure distance.

    • Choices: horizontal, vertical
  • from (token list, required): Starting anchor point for the measurement, in the form node.anchor.

  • to (token list, required): Ending anchor point for the measurement, in the form node.anchor.

  • into (token list, optional): Name of a macro to which the computed distance will also be assigned. If omitted, only \nskDistance is updated.

Internal Behavior

  1. Uses the nsk/measure key family to parse provided options.
  2. Splits the from and to values into node names and anchor components.
  3. Invokes \pgfpointdiff on the two anchor coordinates.
  4. Measures the absolute x-component (horizontal) or y-component (vertical) into \nskDistance.
  5. If an into key is specified, assigns the same length to the named macro.

Reference Table

PropTypeDefault
axis?choicehorizontal
fromtoken list{}
totoken list{}
into?token list{}

On this page