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,
|
after,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"overrightarrow" | "overleftarrow" => {
|
"overrightarrow" | "overleftarrow" | "overleftrightarrow" => {
|
||||||
let (base, after) = parse_atom(chars, next);
|
let (base, after) = parse_atom(chars, next);
|
||||||
let accent = if command == "overrightarrow" {
|
let accent = match command.as_str() {
|
||||||
'\u{20D7}'
|
"overrightarrow" => '\u{20D7}',
|
||||||
} else {
|
"overleftarrow" => '\u{20D6}',
|
||||||
'\u{20D6}'
|
_ => '\u{20E1}',
|
||||||
};
|
};
|
||||||
(
|
(
|
||||||
MathAtom::Accent {
|
MathAtom::Accent {
|
||||||
@@ -1068,6 +1068,19 @@ mod tests {
|
|||||||
assert!(tall.width > plain.width);
|
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]
|
#[test]
|
||||||
fn mathring_uses_the_ring_accent() {
|
fn mathring_uses_the_ring_accent() {
|
||||||
let MathAtom::Row(atoms) = parse_math(r"\mathring{x}") else {
|
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`.
|
`\substack{a\\b}` parses each row and stacks them as `MathAtom::StackLines`.
|
||||||
|
|
||||||
`\mathring{x}` is the U+030A ring accent.
|
`\mathring{x}` is the U+030A ring accent.
|
||||||
|
|
||||||
|
`\overleftrightarrow` uses U+20E1.
|
||||||
Reference in new issue
Block a user