nsk@Block
Comprehensive reference for the `\nskBlock` command in Neural Sketch
The \nskBlock
command is the foundational element in Neural Sketch, providing a highly customizable primitive shape used extensively for constructing diagrams.
Overview
The \nskBlock
command generates fundamental geometric primitives, such as rectangles, circles, diamonds, trapezoids, and more, leveraging the TikZ shapes.geometric
library. It is designed for simplicity while offering extensive customization via a concise key-value interface.
By default, a block appears as a rectangle filled with a neutral color (nskLightGray
), bordered by a slightly darker outline (nskDarkGray
), and optionally labeled using integrated text anchors.
Basic Usage
Here’s a minimal example demonstrating the simplest usage:
Customized Example
For advanced use cases, you can specify options to adjust styling, positioning, and labeling:
Available Keys
Identity
id
(string
): Assigns a unique identifier to the block, useful for referencing positions later.
ID-Generation
IDs are internally managed and allow efficient shape tracking. If no ID is explicitly provided, an automatic ID is generated, which you can also reference. See the Auto-Incremental IDs page for a comprehensive guide.
Shape and Dimensions
shape
(string
, default=rectangle
): Sets the geometric shape of the block (rectangle
,circle
,diamond
,trapezium
, etc.).
width
,height
(dimension
, default=1cm
): Specifies the minimum width and height of the block.
border-radius
(dimension
, default=2.5mm
): Sets the corner radius for rectangular shapes.
Supported Primitives
For a list of all Supported Primitives check out Supported Primitives.
Colors and Styling
fill
(color
, default=nskLightGray
): Defines the fill color.
border-color
(color
, default=nskDarkGray
): Sets the border color.
border-size
(dimension
, default=0.4mm
): Adjusts the thickness of the block border.
Basic Styles
For a list of all the styles provided out-of-the-box, check out Basic Styles.
Positioning
last-pos
(coordinate
, default={}
): Positions the current block relative to the previous block.
last-pos-s
(coordinate
, default={}
): Similar tolast-pos
but allows silent overrides without warnings.
Advanced Positioning
For detailed guidance on advanced positioning techniques, refer to the Positioning Mechanism page.
Text Anchors
These keys define text labels attached to specific block anchor points:
text-north
,text-south
,text-east
,text-west
,text-center
(string
, default={}
): Adds text anchored to the specified side or center.
Text Positioning
For detailed information on placing and positioning text, see Text Positioning.
Technical Details
Internally, \nskBlock
:
- Sets user-defined keys and processes any position overrides (
last-pos
,last-pos-s
). - Auto-generates a unique ID if none is provided.
- Maintains a history of block positions and IDs for subsequent referencing.
- Provides debugging information when needed.
Example: Position Chaining
\nskBlock
allows intuitive chaining of positions:
Advanced Tips
- Leverage Neural Sketch’s curated palette and color mixing syntax for visual clarity:
- Combine custom shapes with annotations for detailed diagrams:
See Also
- Basic Styles for default styling details.
- Palette for detailed color information.
- Notation & Conventions for standardized usage guidelines.
Reference
Prop | Type | Default |
---|---|---|
border-color? | token list | {} |
border-radius? | dimension | {} |
border-size? | dimension | {} |
border-type? | token list | solid |
embed? | token list | {} |
embed-border-radius? | dimension | {} |
embed-gfx? | token list | {} |
embed-padding? | dimension | {} |
fill? | token list | {} |
height? | dimension | {} |
id? | token list | {} |
importance? | number | 1.0 |
last-pos? | token list | {} |
last-pos-s? | token list | {} |
outer-border-color? | token list | nskMainAccent |
outer-border-radius? | dimension | {} |
outer-border-size? | dimension | 7mm |
outer-border-type? | token list | none |
pattern? | token list | {} |
pattern-color? | token list | {} |
pos? | token list | {} |
shadow? | boolean | true |
text-center? | token list | {} |
text-center-loc? | token list | {} |
text-center-style? | token list | {} |
text-east? | token list | {} |
text-east-loc? | token list | {} |
text-east-style? | token list | {} |
text-north? | token list | {} |
text-north-loc? | token list | {} |
text-north-style? | token list | {} |
text-south? | token list | {} |
text-south-loc? | token list | {} |
text-south-style? | token list | {} |
text-west? | token list | {} |
text-west-loc? | token list | {} |
text-west-style? | token list | {} |
tikz-opts? | token list | {} |
type? | token list | rectangle |
width? | dimension | {} |
x? | number | 0 |
y? | number | 0 |