Add widecheck and dddot math accents
This commit is contained in:
1 parent
cefc3e5289
commit
76cc4035ea
2 files changed
+45
No files matched your search
@@ -745,6 +745,26 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
|
||||
after,
|
||||
)
|
||||
}
|
||||
"widecheck" => {
|
||||
let (base, after) = parse_atom(chars, next);
|
||||
(
|
||||
MathAtom::Accent {
|
||||
accent: '\u{030C}',
|
||||
base: Box::new(base),
|
||||
},
|
||||
after,
|
||||
)
|
||||
}
|
||||
"dddot" => {
|
||||
let (base, after) = parse_atom(chars, next);
|
||||
(
|
||||
MathAtom::Accent {
|
||||
accent: '\u{20DB}',
|
||||
base: Box::new(base),
|
||||
},
|
||||
after,
|
||||
)
|
||||
}
|
||||
"vec" => {
|
||||
let (base, after) = parse_atom(chars, next);
|
||||
(
|
||||
@@ -1015,6 +1035,29 @@ mod tests {
|
||||
assert!(tall.width > plain.width);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn widecheck_and_dddot_use_their_accent_codepoints() {
|
||||
let MathAtom::Row(check) = parse_math(r"\widecheck{x}") else {
|
||||
panic!("expected row")
|
||||
};
|
||||
assert!(matches!(
|
||||
&check[0],
|
||||
MathAtom::Accent {
|
||||
accent: '\u{030C}',
|
||||
..
|
||||
}
|
||||
));
|
||||
let MathAtom::Row(dots) = parse_math(r"\dddot{x}") else {
|
||||
panic!("expected row")
|
||||
};
|
||||
assert!(matches!(
|
||||
&dots[0],
|
||||
MathAtom::Accent {
|
||||
accent: '\u{20DB}',
|
||||
..
|
||||
}
|
||||
));
|
||||
}
|
||||
#[test]
|
||||
fn overrightarrow_uses_the_arrow_accent() {
|
||||
let parsed = parse_math(r"\overrightarrow{AB}");
|
||||
|
||||
@@ -216,3 +216,5 @@ for a later overlaid slash.
|
||||
`\stackrel{top}{base}` shares the `Stack` layout with `\overset`.
|
||||
|
||||
`\overrightarrow`/`\overleftarrow` parse as arrow accents (U+20D7/U+20D6).
|
||||
|
||||
`\widecheck` and `\dddot` map to U+030C and U+20DB accents.
|
||||
Reference in new issue
Block a user