nsk@Measure
Simplified and precise distance measurement in Neural Sketch diagrams
The \nskMeasure
command provides a concise, intuitive, and efficient way to measure distances between nodes within your diagrams, enhancing your ability to precisely control spacing and alignment without manual calculations.
Usage Overview
\nskMeasure
serves two purposes:
- Compute: Measure distances between specified nodes along either horizontal or vertical axes.
- Retrieve: Recall the most recently measured distance directly into your document.
Syntax
The general command syntax is:
Parameters
Parameter | Options | Default | Description |
---|---|---|---|
axis | horizontal , vertical | horizontal | Direction along which the distance is measured |
from | <node>.<anchor> | (mandatory) | Starting anchor point for measurement |
to | <node>.<anchor> | (mandatory) | Ending anchor point for measurement |
Example
To measure the horizontal distance from the east anchor of node A
to the west anchor of node B
:
The measured distance is stored in the macro \nskDistance
. Subsequent calls without parameters will directly typeset this value.
Step-by-Step Example
Consider two adjacent blocks, A
and B
. Suppose you want to precisely measure and document the horizontal gap:
This example will typeset a neat, documented distance right in your diagram, promoting clarity and precise diagrammatic control.
Advanced Usage
For vertical measurements:
This flexibility lets you easily handle complex layouts requiring meticulous spacing adjustments.
Integration Tips
- Automatic Alignment: Use measured distances to automate and ensure consistent spacing across diagrams.
- Dynamic Adjustments: Incorporate measured values into layout macros or conditionals to dynamically adapt your diagrams.
Troubleshooting
The utility is designed to robustly handle typical diagram scenarios. However, take note:
- Mandatory Anchors: Ensure that both
from
andto
parameters include explicit node anchors (.north
,.south
,.east
,.west
,.center
). - Unrecognized Keys: Unrecognized key-value pairs in the options will produce warnings and be ignored gracefully.
Always verify node names and anchors. Misspelled or undefined nodes will result in compilation errors.
Technical Details
Internally, \nskMeasure
:
- Computes the absolute distance along the specified axis using lower-level
pgf
coordinate calculations. - Stores the result directly in a length macro (
\nskDistance
) accessible throughout the document.
Reference
Prop | Type | Default |
---|---|---|
axis? | choice | horizontal |
from? | token list | {} |
to? | token list | {} |