Files
owenrees 548f98f303 feat: add public Pgn_to_tex entry point
Move parsing and rendering internals into the private
pgn_to_tex_internal library and rename pgn2tex to converter. Expose only
Pgn_to_tex with default to_tex arguments, abstract diagram_data,
empty_diagrams, and parse_diagrams_json. Update tests, JS bridge, and
README to the new names.
2026-10-23 16:38:24 +02:00

33 lines
1.2 KiB
OCaml

let nag_to_tex nag =
match nag with
(* Move Assessments *)
| "$1" -> "!" (* Good move *)
| "$2" -> "?" (* Poor move *)
| "$3" -> "!!" (* Very good move *)
| "$4" -> "??" (* Very poor move *)
| "$5" -> "!?" (* Speculative move *)
| "$6" -> "?!" (* Questionable move *)
(* | 7 -> "\\Box" Forced move *)
(* | 8 -> "{\\tiny \\textceltel}" Singular move *)
(* | 9 -> "{\\tiny !!}" Worst move *)
(* Positional Assessments *)
| "$10" -> "=" (* Drawish / Equal *)
(* | 11 -> "=" Equal/Quiet *)
| "$13" -> "\\infty" (* Unclear *)
| "$14" -> "\\wbetter" (* White slight advantage *)
| "$15" -> "\\bbetter" (* Black slight advantage *)
| "$16" -> "\\ensuremath{\\pm}" (* White moderate advantage *)
| "$17" -> "\\ensuremath{\\mp}" (* Black moderate advantage *)
| "$18" -> "+-" (* White decisive advantage *)
| "$19" -> "-+" (* Black decisive advantage *)
(* Common Positional Symbols *)
| "$22" -> "\\zugzwang"
| "$32" -> "\\development"
| "$36" -> "\\initiative"
| "$40" -> "\\attack"
| "$44" -> "\\compensation"
| "$132" -> "\\counterplay"
(* | 146 -> "N" Novelty *)
(* Fallback for others: just print the $ number as a comment or ignore *)
| n -> ""