nsk@Onlayer
Precise layer-based drawing control for Neural Sketch diagrams.
Overview
The macros \nskOnlayer
, \nskOnbg
, and \nskOnfg
provide intuitive yet powerful mechanisms for precise layer management within Neural Sketch diagrams. Leveraging TikZ's built-in layering system, these macros enable fine-grained control over the drawing order and placement of diagram elements, essential for creating clear, structured, and visually appealing diagrams.
Usage
\nskOnlayer
This general macro explicitly places provided content onto a specified TikZ layer:
<layer-name>
: The name of a valid, predefined TikZ layer.- Content: Any valid Neural Sketch or TikZ code intended for explicit layering.
Predefined Layer Shortcuts
For common use cases, Neural Sketch provides two convenient shortcuts:
- Background Layer (
background
): Use\nskOnbg
- Foreground Layer (
foreground
): Use\nskOnfg
Background Layer (\nskOnbg
)
Quickly positions content explicitly on the background layer:
Foreground Layer (\nskOnfg
)
Positions content explicitly on the foreground layer, ideal for annotations or elements requiring visual prominence:
Examples
Basic Layering
Placing annotations clearly on the foreground:
Background Decoration
Adding subtle backgrounds behind primary diagram elements:
Layer Definitions and Management
By default, Neural Sketch leverages the TikZ predefined layers:
background
main
(default layer)foreground
The default layer order is background -> main -> foreground
. Content placed explicitly with \nskOnlayer
, \nskOnbg
, or \nskOnfg
respects this hierarchy.
Custom Layers
If additional layer granularity is required, you may define custom layers in your document preamble:
Use the newly defined layer explicitly:
Practical Use Cases
- Annotations and Labels: Clearly position annotations, ensuring readability and clarity without visual interference.
- Decorative Elements: Control decorative backgrounds or highlights to emphasize structural or semantic groupings.
- Complex Diagrams: Precisely orchestrate drawing sequences to visually distinguish overlapping or nested diagram components.
Tips & Best Practices
- Consistency: Regularly use layers to maintain visual clarity, especially in intricate diagrams.
- Performance: While explicit layering is efficient, avoid unnecessary complexity that might impact compilation.
Ensure the layers you reference are explicitly defined or included by default to avoid LaTeX compilation errors.
Reference Table
Prop | Type | Default |
---|---|---|
layer-name | string | {} |
content | LaTeX code | {} |