Render \widetilde in terminal Markdown math (#62554)

## What changed

Apply the same Unicode combining tilde as `\tilde` when the
`\widetilde` argument is a single grapheme.

## Testing

Extend the Unicode math snapshot to cover both `\widetilde{I}` and
`\widetilde I` in fraction numerators.

GitOrigin-RevId: e6976f998bb0955ba9c73117bd19dd814b07399a
This commit is contained in:
Eric Traut
2026-11-19 17:12:52 +00:00
committed by copyberry
parent ac784eb10e
commit 325123ae4a
3 changed files with 18 additions and 2 deletions
@@ -304,7 +304,7 @@ impl MathParser<'_> {
};
Some(Layout::text(text))
}
"hat" | "widehat" | "bar" | "tilde" | "vec" | "dot" | "ddot" => {
"hat" | "widehat" | "bar" | "tilde" | "widetilde" | "vec" | "dot" | "ddot" => {
let arg = self.argument()?;
let text = arg.single()?;
if text.graphemes(/*is_extended*/ true).count() != 1
@@ -316,7 +316,7 @@ impl MathParser<'_> {
let accent = match name {
"hat" | "widehat" => '\u{0302}',
"bar" => '\u{0304}',
"tilde" => '\u{0303}',
"tilde" | "widetilde" => '\u{0303}',
"vec" => '\u{20d7}',
"dot" => '\u{0307}',
"ddot" => '\u{0308}',
@@ -27,6 +27,14 @@ $$
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
$$
$$
I'=\frac{\widetilde{I}}{\rho}
$$
$$
I'=\frac{\widetilde I}{\rho}
$$
$$\frac{1}{2}\frac{3}{4}$$
$$
@@ -8,6 +8,14 @@ The spectrum is λ₁ ≤ λ₂ on ℝⁿ.
x=────────────
2a
Ĩ
I'=─
ρ
Ĩ
I'=─
ρ
1 3
─ ─
2 4