summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordamaxwell <damaxwell@alaska.edu>2023-08-05 02:02:38 -0800
committerGitHub <noreply@github.com>2023-08-05 12:02:38 +0200
commitba0990f189ec7120d8be949c081998d721bbe5e6 (patch)
tree57c2343f7b6b8a3e094dba65c2e018ee53ab35a6
parentad55755f33d2e5a386717e3af2f7b1a52db6ad87 (diff)
Period and slash are ordinary characters in math (#1855)
-rw-r--r--crates/typst-library/src/math/fragment.rs2
-rw-r--r--tests/ref/math/class.pngbin5306 -> 6491 bytes
-rw-r--r--tests/typ/math/class.typ4
-rw-r--r--tests/typ/math/matrix-alignment.typ5
4 files changed, 9 insertions, 2 deletions
diff --git a/crates/typst-library/src/math/fragment.rs b/crates/typst-library/src/math/fragment.rs
index 8baea913..8e051074 100644
--- a/crates/typst-library/src/math/fragment.rs
+++ b/crates/typst-library/src/math/fragment.rs
@@ -216,7 +216,7 @@ impl GlyphFragment {
pub fn with_id(ctx: &MathContext, c: char, id: GlyphId, span: Span) -> Self {
let class = match c {
':' => Some(MathClass::Relation),
- '⋯' | '⋱' | '⋰' | '⋮' => Some(MathClass::Normal),
+ '.' | '/' | '⋯' | '⋱' | '⋰' | '⋮' => Some(MathClass::Normal),
_ => unicode_math_class::class(c),
};
let mut fragment = Self {
diff --git a/tests/ref/math/class.png b/tests/ref/math/class.png
index f339c4f1..7365dc3e 100644
--- a/tests/ref/math/class.png
+++ b/tests/ref/math/class.png
Binary files differ
diff --git a/tests/typ/math/class.typ b/tests/typ/math/class.typ
index 188e7d90..0c9fa32b 100644
--- a/tests/typ/math/class.typ
+++ b/tests/typ/math/class.typ
@@ -31,3 +31,7 @@ $ a dotsq b \
#let normal = math.class.with("normal")
#let pluseq = $class("binary", normal(+) normal(=))$
$ a pluseq 5 $
+
+---
+// Test exceptions.
+$ sqrt(3)\/2 quad d_0.d_1d_2 dots $ \ No newline at end of file
diff --git a/tests/typ/math/matrix-alignment.typ b/tests/typ/math/matrix-alignment.typ
index fd149dd8..0b3aa456 100644
--- a/tests/typ/math/matrix-alignment.typ
+++ b/tests/typ/math/matrix-alignment.typ
@@ -42,10 +42,13 @@ $ mat(
---
// Test #460 equations.
+#let stop = {
+ math.class("punctuation",$.$)
+}
$ mat(&a+b,c;&d, e) $
$ mat(&a+b&,c;&d&, e) $
$ mat(&&&a+b,c;&&&d, e) $
-$ mat(.&a+b&.,c;.....&d&....., e) $
+$ mat(stop &a+b&stop,c;...stop stop&d&...stop stop, e) $
---
// Test #454 equations.