* Render the upper half-plane membership `Element(x, HH)` as the explicit part * predicate `Im(x) > 0` — the form the engine actually guards on and that the * assumptions guide documents — rather than the orphan `\mathrm{HH}` glyph. * Only the 2-operand membership is rewritten; the 3-operand set-
(node: unknown)
| 206 | * left untouched. |
| 207 | */ |
| 208 | function rewriteUpperHalfPlane(node: unknown): unknown { |
| 209 | if (!Array.isArray(node)) return node; |
| 210 | if (node.length === 3 && node[0] === 'Element' && node[2] === 'HH') |
| 211 | return ['Greater', ['Imaginary', rewriteUpperHalfPlane(node[1])], 0]; |
| 212 | return node.map(rewriteUpperHalfPlane); |
| 213 | } |
| 214 | |
| 215 | function mathjsonToLatex( |
| 216 | ce: ReturnType<typeof createEngine>, |