nsk@BlockID
Retrieve block identifiers for precise referencing and positioning.
Introduction
In complex diagrams created using Neural Sketch, referencing previously defined blocks accurately is essential. The macro \nskBlockID
enables straightforward retrieval of block identifiers, facilitating clear and precise referencing, relative positioning, and annotation.
This capability greatly simplifies maintaining coherence and consistency throughout your diagrams, especially when handling large-scale visualizations.
Usage
Basic Usage
The \nskBlockID
macro returns the identifier of the current block (the block most recently defined). It's typically used within custom commands or positioning references.
Automatic IDs
If no explicit ID is provided when creating a block, Neural Sketch automatically generates one using a combination of the shape type and an incremental index:
Recommendation
Always explicitly provide an ID for clarity, especially when creating complex diagrams. This practice ensures readability and maintainability.
Accessing Previous Block IDs
To retrieve identifiers of previously defined blocks, use the related commands:
\nskLastBlockID
Returns the ID of the block immediately preceding the current block:
\nskBlockIDLast[n]
Provides access to the nth-last defined block ID, with [1]
indicating the most recently created block, [2]
the second most recent, and so forth:
Error Handling
Attempting to reference a block index larger than the total number of defined blocks triggers a LaTeX error. Always ensure the requested block exists.
Practical Example
Here's how you might use block IDs for positioning:
In this example:
- The auto-generated IDs of each block is displayed on top of each block.
Use Cases
Leveraging \nskBlockID
is especially beneficial for:
- Dynamic Positioning: Precisely position new diagram components relative to existing ones.
- Annotation and Labeling: Automatically anchor annotations and labels to relevant blocks.
- Advanced Automation: Programmatically generate complex diagrams by iterating over block IDs.