feat(demos): render LaTeX in math standards as plain Unicode - #166
Open
michael-berger-czi wants to merge 4 commits into
Open
feat(demos): render LaTeX in math standards as plain Unicode#166michael-berger-czi wants to merge 4 commits into
michael-berger-czi wants to merge 4 commits into
Conversation
michael-berger-czi
force-pushed
the
mberger/display-LaTeX-equations-better
branch
from
August 19, 2026 18:07
239a603 to
0f027ef
Compare
michael-berger-czi
marked this pull request as ready for review
August 19, 2026 18:07
There was a problem hiding this comment.
Pull request overview
This PR improves the TypeScript demo’s math standards UI by converting mixed LaTeX/Markdown fragments in standard descriptions and evaluator output into readable Unicode for display, without changing the underlying evaluator inputs.
Changes:
- Apply LaTeX→Unicode conversion to standards picker labels and evaluator JSON output display.
- Introduce
latexToUnicode/latexToUnicodeDeephelpers to unwrap common math delimiters, convert fractions, strip emphasis markers, and delegate symbol conversion tounicodeit. - Add the
unicodeitdependency to the demo app.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| demos/typescript/src/pages/MathStandardsAlignmentPage.tsx | Uses display-only LaTeX→Unicode conversion for picker labels and rendered JSON output. |
| demos/typescript/src/latex.ts | Adds LaTeX/Markdown cleanup + deep string conversion utility for JSON-like values. |
| demos/typescript/package.json | Adds unicodeit runtime dependency. |
| demos/typescript/package-lock.json | Locks unicodeit and its transitive dependencies. |
Files not reviewed (1)
- demos/typescript/package-lock.json: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+3771
to
+3779
| "node_modules/unicodeit": { | ||
| "version": "0.7.5", | ||
| "resolved": "https://registry.npmjs.org/unicodeit/-/unicodeit-0.7.5.tgz", | ||
| "integrity": "sha512-IfHeCkRhhf/rvBRw7yMBM6VHzuUg3jSizjFbitT46ATd1VJd9mCYaL78snVzR/vgJEW8a1AczFpNHf3YLSK5dQ==", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "@types/typeahead": "^0.11.32", | ||
| "typeahead": "^0.2.2" | ||
| } |
| }), | ||
| }); | ||
| setOutput(JSON.stringify(results, null, 2)); | ||
| setOutput(JSON.stringify(latexToUnicodeDeep(results), null, 2)); |
Collaborator
There was a problem hiding this comment.
Maybe we shouldnt, and keep this raw-as-is?
Contributor
Author
There was a problem hiding this comment.
Think I agree, doesn't seem like we need this.
michael-berger-czi
force-pushed
the
mberger/display-LaTeX-equations-better
branch
2 times, most recently
from
August 20, 2026 21:52
f18b45c to
1c48bbd
Compare
Standard descriptions from the Knowledge Graph contain raw LaTeX
($\frac{1}{2}$, $5 = \Box \div 3$) plus Markdown emphasis (*For
example, ...*), which displayed verbatim in the standards picker and
evaluator output. The evaluator's LLM-generated reasoning mirrors the
same notation.
Add a latexToUnicode helper that converts this markup to readable
Unicode (½, □ ÷, x², ⅔ × 6) using unicodeit for symbol conversion,
with supplemental handling for what it doesn't cover:
- strip \(...\)/\[...\] delimiters and unwrap $...$ spans, with a
heuristic that leaves dollar amounts in word problems untouched
- convert \frac{a}{b} to vulgar fractions (½) or a/b
- strip Markdown *emphasis* pairs (lone asterisks like 3 * 4 survive)
- map \Box to the hollow □ unicodeit lacks
- restore prose hyphens unicodeit turns into minus signs, and unwrap
leftover grouping braces ({π}² → π²)
Applied display-only in MathStandardsAlignmentPage to picker labels
and (recursively) to evaluator result JSON; the question and statement
codes sent to the evaluator are unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
adnanrhussain
force-pushed
the
mberger/display-LaTeX-equations-better
branch
from
August 31, 2026 16:12
1c48bbd to
d8fc471
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Low lift implementation for handling various latex equations in the typescript demo app. This doesn't handle all cases, but should clean up quite a few non handled cases.
AI summary:
Standard descriptions from the Knowledge Graph contain raw LaTeX ($\frac{1}{2}$ , $5 = \Box \div 3$ ) plus Markdown emphasis (For example, ...), which displayed verbatim in the standards picker and evaluator output. The evaluator's LLM-generated reasoning mirrors the same notation.
Add a latexToUnicode helper that converts this markup to readable Unicode (½, □ ÷, x², ⅔ × 6) using unicodeit for symbol conversion, with supplemental handling for what it doesn't cover:
Applied display-only in MathStandardsAlignmentPage to picker labels and (recursively) to evaluator result JSON; the question and statement codes sent to the evaluator are unchanged.
Thanks for your interest in our project!
This repository is currently being maintained internally, so we’re not accepting external contributors.
However, if you’ve discovered a bug or have a feature suggestion, please feel free to open an issue or reach out to us at support@learningcommons.org.
If you believe you have found a security issue, please responsibly disclose by contacting us at security@learningcommons.org.
If you are interested in partnering with us, fill out this form to get in touch.