Repository navigation
Conversation
Both put scripts before a base, and both were unknown commands.
`\prescript{sup}{sub}{base}` (mathtools), as in an isotope, is a new
`prescript` atom: `above` and `below` hold the scripts, `body` the base. The
scripts are placed for the base's height and depth, as mathtools' phantom of
the base does, flush right against it. Scripts after the base attach to it as
to any atom.
`\sideset{_a^b}{_c^d}\sum_{i=1}^{n}` (amsmath) is a new `sideset` atom: `below`
and `above` hold the scripts before the operator, `body` the operator, whose
own subscript and superscript are the scripts after it (always beside it, and
not written as `\nolimits`), and the atom's subscript and superscript are the
limits, placed as the operator's would be. As in amsmath, the scripts before
the operator are placed for the operator's symbol alone. Its arguments take
scripts only, as amsmath and Temml require.
To place scripts before a base, the layout of `attachSupsub()` (TeX's rule 18)
becomes `makeScripts()`, which `attachSupsub()` now calls, with an option to
set the scripts flush right; `supsubToLatex()` becomes `scriptsToLatex()` for
any two script lists; and `ExtensibleSymbolAtom.symbolBox()` gives the symbol
alone, without its limits. Rendering of existing atoms is unchanged.
The keyboard visits the scripts in the order they are drawn. Deleting one of
these atoms from outside goes into it; at the edge of one of its branches,
the caret moves on as the arrow keys do, until every branch is empty, when
the atom is deleted. MathML is `<mmultiscripts>`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Two amsmath/mathtools commands that put scripts before a base were unknown commands. KaTeX lacks
\sideset; Temml and MathJax support both.\prescript{14}{6}{C}(mathtools), as in an isotope or a tensor index.\sideset{_a^b}{_c^d}\sum_{i=1}^{n}(amsmath): scripts at the corners of a large operator, which keeps its limits. The most common use is\sideset{}{'}\sum.Model
prescriptatom.aboveandbelowhold the scripts andbodythe base. The scripts are placed for the base's height and depth, as mathtools' phantom of the base does, and set flush right against it. Scripts after the base attach to it as to any atom.sidesetatom, scripts before the operator.belowandabovehold them, placed as in amsmath for the operator's symbol alone.sidesetatom, the operator.bodyholds it. Its own subscript and superscript are the scripts after it: always beside it, and not written as\nolimits.sidesetatom, limits. The atom's own subscript and superscript are the limits, placed as the operator's would be, so\sideset{}{}\sum\limits_ialso works.Shared code (no change for existing atoms; their snapshots are unchanged)
attachSupsub()'s layout (TeX rule 18) moves tomakeScripts(), whichattachSupsub()calls. A new option sets the scripts flush right.supsubToLatex()becomesscriptsToLatex()for any two script lists.ExtensibleSymbolAtom.symbolBox()returns the symbol without its limits.Editing
_a^bis written), then the operator and its scripts, then the limits. For\prescript, the order follows its arguments: superscript, subscript, base.<mmultiscripts>, as Temml writes it.Tests
PRESCRIPT AND SIDESETblock intest/latex.test.tscovers round trips with no verbatim LaTeX kept, layout order, the operator drawn once with its limits, and MathML.test/playwright-tests/prescript-sideset.spec.tschecks the placeholder order for both commands and deletion with Backspace.Suggested changelog line:
\prescript(mathtools) and\sideset(amsmath) are supported.🤖 Generated with Claude Code