Repository navigation
Conversation
The changelog of 0.100 says `\boldsymbol` and `\bm` "preserve the style of the
characters, so they remain italic if they were italic before", while `\mathbf`
is upright. They didn't: `\bm{x}` was drawn as an upright bold x, and written
back as `\mathbf{x}`.
`\mathbf` sets the 'normal' variant; `\bm` and `\boldsymbol` set only the
bold weight, so the difference was in the atom's style, but the box and the
atom's createBox defaulted every missing variant to 'normal' before
MathMode.getFont() saw it. They no longer do: getFont() treats a missing
variant as 'normal' itself and, for a bold with no variant, applies the letter
shape it applies to a regular letter (italic for a Latin letter in 'tex', so
the Math-BoldItalic font).
When writing LaTeX, a bold run is split by how its weight is spelt: an upright
bold (a variant was set) is `\mathbf` when it is letters and digits, as
before; a bold with the automatic shape is `\bm`, unless it is only digits,
which are upright either way; a bold italic variant (`\mathbfit`) carries its
own weight, so `\mathbfit{x}` is no longer written `\mathbf{\mathbfit{x}}`.
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.
The 0.100 changelog says that
\boldsymboland\bm"preserve the style of the characters, so they remain italic if they were italic before", while\mathbfrenders upright. In practice,\bm{x}and\boldsymbol{x}are drawn as an upright bold x (classML__mathbf) and serialized as\mathbf{x}, so a field round-trips\bm{x}^\top \mathbf{W} \bm{x}to\mathbf{x}^{\top}\mathbf{Wx}.Cause.
\mathbfsets thenormalvariant plus theboldvariant style.\bmand\boldsymbolset only theboldvariant style. That difference survives in the atom's style, but both the atom'screateBox()andBoxdefaulted a missing variant tonormalbeforeMathMode.getFont()ran, so the two looked identical there.getFont()also only auto-italicized a letter that had no variant style at all.Fix.
BoxandcreateBox()no longer fill in the variant.getFont()treats a missing variant asnormalitself. For a bold with no variant, it applies the same letter shape as for a regular letter: undertexa Latin letter or a lowercase Greek letter becomes italic (Math-BoldItalic,ML__mathbfit), while uppercase Greek and digits stay upright.emitBoldRun()splits a bold run by how its weight is spelt:\mathbfwhen it is letters and digits, as before.\bm, the fallback MathLive already uses, unless it is only digits.\mathbfit) carries its own weight, so\mathbfit{x}is no longer written\mathbf{\mathbfit{x}}.Tests. A
BOLD ITALICblock intest/latex.test.tscovers the round trips above, and checks that\bm{x}and\boldsymbol{x}draw withML__mathbfit, while\mathbf{x}and\bm{\Gamma}don't. The existing suites pass unchanged.Suggested changelog line:
\bm{x}and\boldsymbol{x}are drawn bold italic, as in TeX, and serialized as\bm{x}rather than the upright\mathbf{x}.🤖 Generated with Claude Code