Neural Sketch
Commands/render

nsk@Case

Define case branches within an `nskSwitch` environment for conditional content rendering in Neural Sketch.

Overview

The \nskCase command defines a branch within an nskSwitch environment. It compares a specified value against the switch operand and, if they match (and no prior case has matched), executes the provided code block.

Usage

Place \nskCase inside an nskSwitch environment:

\begin{nskSwitch}[type=int]{<operand>}
  \nskCase[1]{%
    % code to execute if operand == 1
  }
  \nskCase[2]{ ... }
  \nskDefault{% fallback code }
\end{nskSwitch}

Matching Behavior

  • String mode: Default type=string; compares operand and case value as literal strings.
  • Integer mode: type=int; evaluates operand and case value as integers before comparison.
  • Floating-point mode: type=float; evaluates operand and case value as floating-point numbers.
  • Boolean mode: type=bool; compares operand and case value as literal true/false.

Only the first matching \nskCase is executed. Subsequent cases are skipped once a match is found.

Reference Table

PropTypeDefault
valuestring
codeLaTeX code

On this page