Neural Sketch
Commands/preloaded

nsk@LastBlockID

Retrieve the identifier of the block defined immediately before the most recently created block.

This is an unstable API, only used internally. Deprecated in favor of \nskID

Overview

The \nskLastBlockID command provides a convenient alias to fetch the identifier of the block defined immediately preceding the most recently created block in a Neural Sketch diagram. It saves you from manually tracking auto-generated or user-defined IDs when you need to reference the prior element.

Usage

\begin{nskFigure}
  \nskBlock[id=firstBlock]{}
  \nskBlock[id=secondBlock]{}
 
  % This will expand to "firstBlock"
  Previous Block ID: \nskLastBlockID
\end{nskFigure}

Although \nskLastBlockID takes a numerical argument, it is currently hard-coded to use an offset of 2 (i.e. always returns the block immediately before the last). Passing any number will yield the same result until this behavior is extended.

Parameters

  • n (number, default=2): Offset index (1-based) counting backwards from the most recently created block. Currently fixed at 2 to return the previous block’s ID.

Practical Example

\begin{nskFigure}
  \nskBlock[id=A]{}
  \nskBlock[id=B]{}
 
  % Always returns "B"
  Middle Block ID: \nskLastBlockID
\end{nskFigure}

Internal Behavior

Internally, \nskLastBlockID simply calls the lower-level macro \nskBlockIDLast with a hard-coded offset of 2, retrieving the second-last entry from Neural Sketch’s internal history of block IDs.

Reference Table

PropTypeDefault
n?number2

On this page