| name | tex-heatmap-colorize |
| description | Deterministic LaTeX colorization for resume heatmap. Injects xcolor-based phrase-level highlights into .tex source using colorbox commands. No LLM required — pure scripting. Supports progressive colorization (block-by-block), mismatch list generation, and compilation fallback. Uses \hmH{}, \hmP{}, \hmI{} inline commands for character-level phrase highlighting.
|
Tex Heatmap Colorize
Deterministic scripts for injecting character-level heatmap colors into LaTeX
resume source. Zero LLM token consumption.
Scripts
enumerate-blocks.ts
Parses .tex source into a three-level AST: Section → Block → Element.
Uses brace-matching for precise LaTeX command boundary detection.
colorize.ts
Three exported functions called in sequence:
injectPreamble(tex) — one-time: adds xcolor colors + \hmH/\hmP/\hmI
command definitions before \begin{document}
highlightPhrases(baseTex, blocks, annotations) — per-block: idempotent
phrase-level \colorbox injection, called after each block analysis
appendMismatchList(coloredTex, gaps, irrelevant) — final: conditional
mismatch report page before \end{document}
Color Definitions
\definecolor{hmHighBg}{RGB}{255,210,210} % Red — High match
\definecolor{hmPartialBg}{RGB}{255,235,210} % Orange — Partial match
\definecolor{hmIrrelBg}{RGB}{210,240,210} % Green — Irrelevant
Highlight Commands
\newcommand{\hmH}[1]{\colorbox{hmHighBg}{\strut #1}} % High
\newcommand{\hmP}[1]{\colorbox{hmPartialBg}{\strut #1}} % Partial
\newcommand{\hmI}[1]{\colorbox{hmIrrelBg}{\strut #1}} % Irrelevant
Phrase Matching Strategy
- Exact substring match within the element's line range (highest priority)
- Whitespace-normalized match (collapse
\n and multi-spaces)
- Match failure → silently skip the phrase
Process phrases longest-first to avoid short phrases breaking long ones.
Never highlight across {} boundaries or inside LaTeX command names.
Progressive Colorization
Each call to highlightPhrases starts from baseTex (preamble-injected,
no highlights) and applies ALL accumulated annotations. This ensures
idempotency — calling N times with the same inputs produces identical output.
Compilation Fallback
Level 1: Apply phrase highlights → compile
↓ failure
Level 2: Skip this block's phrases → compile (preserve prior blocks)
Each block's fallback is independent — one block's failure doesn't affect others.