nsk@Coord
Define and manage precise named coordinates for robust positioning in Neural Sketch diagrams.
Introduction
The \nskCoord
macro in Neural Sketch introduces a concise and intuitive system for defining named coordinates, significantly enhancing the precision and readability of complex diagrams. By creating labeled anchor points, you gain the capability to position elements reliably, reducing redundancy and minimizing manual calculations.
Basic Usage
A minimal invocation of \nskCoord
defines a simple named coordinate at the origin (0,0)
:
Advanced Example
For precise control, specify explicit coordinates, relative positioning, or custom markers:
Available Options
Identity
id
(string
, default=auto-generated
): Assigns a unique identifier to the coordinate.
If an explicit id
is not provided, Neural Sketch automatically assigns a sequential identifier such as coord1
, coord2
, etc, See the Auto-Incremental IDs page for a comprehensive guide.
Positioning
x
,y
(number
, default=0
): Directly specify coordinates.
at
(coordinate
, default={}
): Places the coordinate precisely at another node or explicit TikZ coordinate.
pos
(string
, default={}
): Specifies relative positioning similar to TikZ's syntax.
Shifting
Apply small manual shifts to coordinates:
shift-x
,shift-y
(dimension
, default=0pt
): Adjust coordinate placement horizontally or vertically.
Visual Markers
Add visual markers for debugging or enhancing diagram readability:
marker
(choice: none, o, x
, default=none
): Specifies the type of visual marker.marker-color
(color
, default=red
): Defines the marker color.marker-size
(dimension
, default=1mm
): Sets the marker's size.
Marker Types
Marker | Visual | Description |
---|---|---|
none | — | No marker displayed. |
o | ○ | Circle marker centered at coordinate |
x | ✕ | Cross marker centered at coordinate |
Markers are excellent for visually verifying coordinate placement during development or presentations.
Usage Examples
Precise Element Placement
Use named coordinates to position elements precisely:
Debugging Complex Layouts
Visually verify positions with markers:
Internal Mechanics
Internally, \nskCoord
:
- Generates a phantom (invisible) TikZ node that serves as a named anchor.
- Automatically assigns sequential IDs if explicit names are omitted.
- Handles precise shifts and markers robustly.
- Integrates seamlessly with Neural Sketch’s positioning system.
Reference Table
Prop | Type | Default |
---|---|---|
id? | string | auto-generated |
x? | number | 0 |
y? | number | 0 |
at? | coordinate | {} |
pos? | string | {} |
shift-x? | dimension | 0pt |
shift-y? | dimension | 0pt |
marker? | choice | none |
marker-color? | color | red |
marker-size? | dimension | 1mm |