Skip to content

renderer.resolveCitation ​

How to read this API

These are TypeScript APIs compiled into SnapTeX; a .tex project cannot load them at runtime.

  • function name(...) is a helper that your rule imports and calls.
  • apply(...), render(...), extract(...), and collect(...) are callbacks that your rule implements and SnapTeX calls.
  • renderer.name(...), context.name(...), input.name(...), and deps.name(...) are methods SnapTeX supplies to callbacks; do not import or construct them.
  • service.name(...) is an instance method called after your host or test constructs PreviewUpdateService.

Register extension declarations through SNAP_TEX_RULES in src/rules.ts. See Source API Scope for imports, value ownership, output safety, rebuilds, and testing.

Returns the stable first-seen citation number for one bibliography key. It mutates citation state; use it while rendering a citation, not to test whether a key exists.

Signature ​

ts
renderer.resolveCitation(key: string): number

Parameters ​

ParameterDescription
keyCitation key without braces

Returns ​

A one-based number. The first call registers the key and assigns the next number; later calls reuse that number without adding a duplicate.

Call relationships ​

  • Called by: citation rendering helpers and custom legacy citation rules.
  • Updates: renderer citation state observed by later getCitedKeys calls.
  • Reset by: renderer state reset or a full backend reset.
ts
const number = renderer.resolveCitation('smith2024');

Do not call this merely to inspect whether a key was cited: it mutates first-seen citation state.

See also ​

A fast structural preview, not a replacement for a full TeX compiler.