Skip to content

POC for showPointLabels with TeX#3768

Draft
ivyolamit wants to merge 2 commits into
showlabels/02-renderer-and-flagfrom
showlabels/02-renderer-and-flag-poc-for-tex
Draft

POC for showPointLabels with TeX#3768
ivyolamit wants to merge 2 commits into
showlabels/02-renderer-and-flagfrom
showlabels/02-renderer-and-flag-poc-for-tex

Conversation

@ivyolamit

Copy link
Copy Markdown
Contributor

Summary:

[showlabels/02-renderer-and-flag-poc-for-tex] docs(changeset):

Issue: LEMS-XXXX

Test plan:

@ivyolamit ivyolamit self-assigned this Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Size Change: +425 B (+0.08%)

Total Size: 510 kB

📦 View Changed
Filename Size Change
packages/perseus/dist/es/index.js 202 kB +425 B (+0.21%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.6 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.32 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 12 kB
packages/perseus-core/dist/es/index.js 26.3 kB
packages/perseus-editor/dist/es/index.js 105 kB
packages/perseus-linter/dist/es/index.js 9.8 kB
packages/perseus-score/dist/es/index.js 10.2 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/strings.js 8.6 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions

Copy link
Copy Markdown
Contributor

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (ae6345c) and published it to npm. You
can install it using the tag PR3768.

Example:

pnpm add @khanacademy/perseus@PR3768

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3768

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR3768

@benchristel benchristel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple problems with calling the SpeechRuleEngine on the learner's device, which I've described inline.

We might have to cut scope and not support visible labels with TeX for this first pass.

export async function generateSpokenMathDetails(
mathString: string,
): Promise<string> {
const engine = await SpeechRuleEngine.setup("en");

@benchristel benchristel Jun 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are hardcoding the "en" locale here, which is not right. It was okay to hardcode "en" when this function was only used in the editor, because the generated labels would be saved in the content and go through the normal translation process. However, if we are generating math labels dynamically on the learner's computer, we need to use the appropriate locale.

This is also going to make a web request for a JSON file that defines the spoken English for various math symbols. We have an architectural rule in Perseus that Perseus doesn't make web requests.

I think what what we need to do is generate spoken labels in the editor like we did for locked labels. We'll need to save the spoken labels and visible labels (which may include TeX) separately in the content JSON.

Alternatively, we could decide that we won't support visible labels with TeX for this first pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants