Neural Sketch

Module Loading

Selectively enabling Neural Sketch modules

Overview

By default, Neural Sketch activates only its core module, which provides fundamental features like \nskBlock and the global styling keys. For more advanced functionality—such as bridging lines, coordinate helpers, or annotations—you can load the corresponding modules manually. This modular setup ensures your document remains concise, while allowing you to incorporate precisely the tools you need.

Why Load Modules Separately?

When creating extensive diagrams, especially ones that may not always require bridging arcs, containers, or specialized annotation features, it can be advantageous to load only the specific modules needed. This approach:

  1. Minimizes compilation overhead: Each additional module introduces extra code and style definitions; loading unneeded modules may slow compilation.
  2. Provides clarity of usage: You can see exactly which advanced features your diagram employs by referencing the module list.
  3. Supports scalability: For simpler sketches, you can rely on the core. For complex diagrams—like neural network architectures with crossing lines or annotated sub-sections—load bridging, annotations, containers, and other relevant modules.

The \nskUseModule Macro

Neural Sketch offers a macro, \nskUseModule, that can load one or more modules in a single pass. You specify a comma-separated list of module names, or use an asterisk ({*}) to load all available modules at once.

\nskUseModule{<module_list>}

Load specific modules:

\nskUseModule{containers}

Or if you want all core features at your disposal, simply issue:

\nskUseModule{*}

Invoke \nskUseModule{...} in your document’s preamble (or at least before creating your figures).

Avoid calling \nskUseModule multiple times with different sets of modules to prevent conflicts or unexpected behavior.

Minimal Working Example

Below is a minimal working example to confirm your environment is set up correctly:

simple.tex
\documentclass{standalone}
 
\usepackage{neural-sketch} 
\nskUseModule{*} 
 
\begin{document}
...
\end{document}

Available Modules

Below are the modules currently available, along with a short summary of their purpose:

ModuleDescription
blockGeometric primitives: e.g., rectangles, diamonds, circles.
loaderControls partial or complete loading of modules.
stylesGlobal style definitions for all shapes and lines.
colorsCurated color palette for consistent, publication-ready diagrams.
groupsLogical grouping of shapes with transformations (scale/rotate).
containersBounding containers with padding, used to visually group content.
coordsDefines named coordinates or anchor points for precise positioning.
bridgesManages arrow routing and bridging arcs where lines cross.
annotationsAuto-incrementing annotations, tags, and references.
decorationsCustom path decorations (markers, repeating shapes, etc.).
renderConditional rendering: switch or case-based macros.
pargsDark-mode support and color inversion logic.

When you pass the name of one or more modules to \nskUseModule, only those modules are loaded, so your diagrams gain that functionality without pulling in the rest.

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