Neural Sketch

Module Loading

Selectively enabling Neural Sketch modules

TL;DR

If you're working in cloud-based LaTeX\LaTeX 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:

\nskUseModule{<comma-separated list>}

Examples:

\nskUseModule{<module_list>}

Load specific modules:

\nskUseModule{containers}

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

\documentclass{standalone}
 
\usepackage{neural-sketch}
\nskUseModule{*} % or choose what you need %
 
\begin{document}
% your diagram here
\end{document}

Available Modules

Neural Sketch’s module ecosystem is composable, layered, and extensible.

ModuleDescription
annotationsCallouts and inline notes with headers, tags, and connectors
bridgesSmart path bridging for overlapping lines (e.g. arrow hopping)
containersAuto-sized groups with bounding logic and visual wrappers
coordsNamed coordinates and relative anchors for clean positioning
decorationsPath markings (repetition, interval, label drops) along edges
groupsLogical groupings with transformations like rotate, scale, and shift
loaderLoader logic for selective module activation (\nskUseModule)
measureDistance measurement between nodes with optional output injection
renderConditional rendering via switch-case constructs
zoomVisual 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:

\nskUseModule{bridges, coords}

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.

On this page