nsk@Block
Comprehensive reference for the `\nskBlock` command in Neural Sketch
Overview
The \nskBlock
command is the foundational drawing primitive in Neural Sketch, providing a rich set of customization options for geometric shapes, styling, positioning, and embedded content. It leverages TikZ’s shapes.geometric
library to render rectangles, circles, diamonds, trapezoids, and more, with fine-grained control via a concise key-value interface.
If no id
is provided, an auto-incremental identifier is generated, allowing seamless chaining and referencing of blocks.
Basic Usage
This will draw a block (defaulting to a rectangle) with any combination of the supported keys to customize its appearance, position, and content.
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 |
---|---|---|
type? | choice | rectangle |
padding-x? | dimension | style default |
padding-y? | dimension | style default |
id? | token list | auto-generated |
x? | number | style default |
y? | number | style default |
shift-x? | number | 0 |
shift-y? | number | 0 |
anchor? | token list | style default |
rotate? | number | style default |
opacity? | number | style default |
pos? | token list | none |
last-pos? | token list | none |
last-pos-s? | token list | none |
align? | choice | none |
width? | dimension | style default |
height? | dimension | style default |
size? | dimension | none |
border-type? | token list | solid |
border-color? | color | style default |
border-radius? | dimension | style default |
border-size? | dimension | style default |
outer-border-type? | token list | style default |
outer-border-color? | color | style default |
outer-border-radius? | dimension | style default |
outer-border-size? | dimension | style default |
fill? | color | style default |
shadow? | boolean | true |
importance? | number | 1.0 |
tikz-opts? | token list | {} |
text-size? | token list | style default |
text-north? | token list | none |
text-north-loc? | token list | style default |
text-north-style? | token list | style default |
text-south? | token list | none |
text-south-loc? | token list | style default |
text-south-style? | token list | style default |
text-east? | token list | none |
text-east-loc? | token list | style default |
text-east-style? | token list | style default |
text-west? | token list | none |
text-west-loc? | token list | style default |
text-west-style? | token list | style default |
text-center? | token list | none |
text-center-loc? | token list | style default |
text-center-style? | token list | style default |
embed? | token list | {} |
embed-gfx? | token list | {} |
embed-padding? | dimension | style default |
embed-border-radius? | dimension | style default |
embed-border-size? | dimension | style default |
embed-border-color? | color | style default |
pattern? | token list | none |
pattern-color? | color | nskFg |
pattern-opacity? | number | 0.2 |
fade? | choice | none |
stack? | boolean | false |
stack-opts? | token list | style default |
stack-xoffset? | dimension | style default |
stack-yoffset? | dimension | style default |
stack-count? | choice | single |