Module Loading
Selectively enabling Neural Sketch modules
TL;DR
If you're working in cloud-based environments like Overleaf or compiling large diagrams, loading only the modules you need can significantly improve compile time.
Build Only What You Need
Neural Sketch is modular by design.
When you begin writing a diagram, you’re not pulling in an entire graphics library—you’re composing from layers. Layers that can be swapped, omitted, combined. The system grows with your complexity.
At its core, Neural Sketch loads only the essentials: primitives like \nskBlock
, layout mechanisms, and a visual grammar that ensures consistency.
Beyond that, everything is opt-in.
Why Modularity Matters
Selective loading lets you:
- 🧩 Control surface area — only pull in what your diagram actually needs
- ⚡ Reduce compile time — smaller diagrams = faster feedback loops
- 📐 Stay readable — your diagram’s style reflects only the modules it uses
- 📦 Compose cleanly — add only what layers your idea requires
Imagine a diagram for a simple architectural sketch—it doesn’t need annotations, conditional rendering, or decorated paths. So why load them?
\nskUseModule
: One Line, Infinite Combinations
To load modules, use the macro:
Examples:
Load specific modules:
Always invoke \nskUseModule
in your preamble—or at least before your diagrams begin.
Avoid calling it multiple times with different sets. Consolidate your list.
Minimal Setup Example
Available Modules
Neural Sketch’s module ecosystem is composable, layered, and extensible.
Module | Description |
---|---|
annotations | Callouts and inline notes with headers, tags, and connectors |
bridges | Smart path bridging for overlapping lines (e.g. arrow hopping) |
containers | Auto-sized groups with bounding logic and visual wrappers |
coords | Named coordinates and relative anchors for clean positioning |
decorations | Path markings (repetition, interval, label drops) along edges |
groups | Logical groupings with transformations like rotate, scale, and shift |
loader | Loader logic for selective module activation (\nskUseModule ) |
measure | Distance measurement between nodes with optional output injection |
render | Conditional rendering via switch-case constructs |
zoom | Visual zoom-in lenses for annotated or magnified regions |
Modules like blocks
, colors
and styles
are loaded automatically and do not need to be explicitly included.
A Note on Performance
Neural Sketch modules are intentionally lightweight. In most cases, loading everything won’t hurt.
But in large documents—or cloud editors like Overleaf—staying lean helps:
- faster compile cycles
- easier debugging and tracing
Balancing Complexity and Performance
By tailoring your module list, you keep your diagram code and compilation light. If you need bridging arcs and coordinates but have no use for containers or extra text adornments, simply load:
This way, you gain automatic bridging arcs to handle crossing lines and coordinate anchors for precise placement—while skipping unrelated modules. For large or intricate documents, this selective loading can be pivotal for maintaining manageable compile times, especially on cloud-based services like Overleaf.
Note
In many common scenarios, the overhead introduced by extra modules is modest. But if your diagram is extremely large or if your environment imposes strict memory limits, selective loading can preserve efficiency.