You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add a \math{} command that parses its body as math inside prose, as the inverse of \text{}
remember whether LaTeX entry began in text or free-text and restore that prose mode after bounded or unbounded completion
allow nested LaTeX commands and spaces inside an open bounded entry, including \math{\forall x \land \frac{1}{2}}
keep math placeholders in math mode until they are filled
publish matching runtime bundles
Dependency
This PR is stacked on #3060 because free-text is introduced there. Until #3060 merges, GitHub will show its prerequisite commits in this PR; after it lands, this branch can be rebased and the diff will reduce to the text-mode behavior and \math{} changes.
Verification
npx tsc --noEmit
npx jest test --runInBand (335 passed)
full Chromium physical-keyboard suite (48 passed)
focused source/watch tests in Chromium, Firefox, and WebKit (9 passed)
focused tests repeated against the checked-in dist/mathlive.mjs artifact in Chromium, Firefox, and WebKit (9 passed)
Of course. \math{} is not necessary for expressiveness; I proposed it primarily as an ergonomic counterpart to \text{}.
The motivation was interactive input in text-initialized fields. In free-text, neither typing nor pasting $...$ interprets it as math. In ordinary text mode, typing it also does not create a math region, although pasting a complete balanced expression does (which might be something unintended which, if confirmed, I am more than happy to address either with or separately from this PR). \text{let $\forall x \in \R$} works because the complete bounded \text{...} command originates in math mode and is parsed as a unit, not because $...$ acts as an interactive mode switch in a text-initialized field.
Since \text{} would not be the natural entry point in an already text-initialized field, I thought \math{} would provide intuitive symmetry: users familiar with either command could readily infer the other.
That said, I overlooked the existing \ensuremath{} command. It already covers the intended functional use case and has the advantage of being standard LaTeX. Therefore, \math{} would add discoverability and symmetry, but no new capability. I am happy to remove it and keep the PR focused on restoring prose mode after bounded and unbounded LaTeX input.
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
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.
Summary
\math{}command that parses its body as math inside prose, as the inverse of\text{}textorfree-textand restore that prose mode after bounded or unbounded completion\math{\forall x \land \frac{1}{2}}Dependency
This PR is stacked on #3060 because
free-textis introduced there. Until #3060 merges, GitHub will show its prerequisite commits in this PR; after it lands, this branch can be rebased and the diff will reduce to the text-mode behavior and\math{}changes.Verification
npx tsc --noEmitnpx jest test --runInBand(335 passed)dist/mathlive.mjsartifact in Chromium, Firefox, and WebKit (9 passed)