diff --git a/crates/typst-library/src/math/ctx.rs b/crates/typst-library/src/math/ctx.rs index 2ebd55b90..b9aef711c 100644 --- a/crates/typst-library/src/math/ctx.rs +++ b/crates/typst-library/src/math/ctx.rs @@ -190,7 +190,7 @@ impl<'a, 'b, 'v> MathContext<'a, 'b, 'v> { } else { glyph.into() } - } else if text.chars().all(|c| c.is_ascii_digit()) { + } else if text.chars().all(|c| c.is_ascii_digit() || c == '.') { // Numbers aren't that difficult. let mut fragments = vec![]; for c in text.chars() { diff --git a/tests/ref/bugs/math-number-spacing.png b/tests/ref/bugs/math-number-spacing.png new file mode 100644 index 000000000..5ec65df30 Binary files /dev/null and b/tests/ref/bugs/math-number-spacing.png differ diff --git a/tests/ref/math/frac.png b/tests/ref/math/frac.png index 59357cffd..b4d52fc84 100644 Binary files a/tests/ref/math/frac.png and b/tests/ref/math/frac.png differ diff --git a/tests/typ/bugs/math-number-spacing.typ b/tests/typ/bugs/math-number-spacing.typ new file mode 100644 index 000000000..9450caca9 --- /dev/null +++ b/tests/typ/bugs/math-number-spacing.typ @@ -0,0 +1,9 @@ +// Test spacing after numbers in math. + +--- +$ +10degree \ +10 degree \ +10.1degree \ +10.1 degree +$