Skip to content

Commit

Permalink
Period and slash are ordinary characters in math
Browse files Browse the repository at this point in the history
  • Loading branch information
damaxwell committed Aug 3, 2023
1 parent 028d2f5 commit b42f8a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/typst-library/src/math/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Binary file modified tests/ref/math/class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions tests/typ/math/class.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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 $
5 changes: 4 additions & 1 deletion tests/typ/math/matrix-alignment.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b42f8a8

Please sign in to comment.