Add the double-arrow math accent
This commit is contained in:
1 parent
0d3067a86d
commit
30464dd214
2 files changed
+20
-5
No files matched your search
@@ -753,12 +753,12 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
|
||||
after,
|
||||
)
|
||||
}
|
||||
"overrightarrow" | "overleftarrow" => {
|
||||
"overrightarrow" | "overleftarrow" | "overleftrightarrow" => {
|
||||
let (base, after) = parse_atom(chars, next);
|
||||
let accent = if command == "overrightarrow" {
|
||||
'\u{20D7}'
|
||||
} else {
|
||||
'\u{20D6}'
|
||||
let accent = match command.as_str() {
|
||||
"overrightarrow" => '\u{20D7}',
|
||||
"overleftarrow" => '\u{20D6}',
|
||||
_ => '\u{20E1}',
|
||||
};
|
||||
(
|
||||
MathAtom::Accent {
|
||||
@@ -1068,6 +1068,19 @@ mod tests {
|
||||
assert!(tall.width > plain.width);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overleftrightarrow_uses_the_double_arrow_accent() {
|
||||
let MathAtom::Row(atoms) = parse_math(r"\overleftrightarrow{AB}") else {
|
||||
panic!("expected row")
|
||||
};
|
||||
assert!(matches!(
|
||||
&atoms[0],
|
||||
MathAtom::Accent {
|
||||
accent: '\u{20E1}',
|
||||
..
|
||||
}
|
||||
));
|
||||
}
|
||||
#[test]
|
||||
fn mathring_uses_the_ring_accent() {
|
||||
let MathAtom::Row(atoms) = parse_math(r"\mathring{x}") else {
|
||||
|
||||
@@ -237,3 +237,5 @@ v1 remains the production renderer; the route-D core is additive and tested inde
|
||||
`\substack{a\\b}` parses each row and stacks them as `MathAtom::StackLines`.
|
||||
|
||||
`\mathring{x}` is the U+030A ring accent.
|
||||
|
||||
`\overleftrightarrow` uses U+20E1.
|
||||
Reference in new issue
Block a user