Treat math style declarations as transparent
This commit is contained in:
1 parent
495b615220
commit
6876935e60
1 file changed
+16
@@ -550,6 +550,13 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return match command.as_str() {
|
return match command.as_str() {
|
||||||
|
"displaystyle" | "textstyle" | "scriptstyle" | "scriptscriptstyle" => {
|
||||||
|
let mut after = next;
|
||||||
|
while chars.get(after).is_some_and(|ch| ch.is_whitespace()) {
|
||||||
|
after += 1;
|
||||||
|
}
|
||||||
|
parse_atom(chars, after)
|
||||||
|
}
|
||||||
"frac" => {
|
"frac" => {
|
||||||
let (numerator, after) = parse_atom(chars, next);
|
let (numerator, after) = parse_atom(chars, next);
|
||||||
let (denominator, after) = parse_atom(chars, after);
|
let (denominator, after) = parse_atom(chars, after);
|
||||||
@@ -1205,6 +1212,15 @@ mod tests {
|
|||||||
assert!(under.depth > plain.depth);
|
assert!(under.depth > plain.depth);
|
||||||
assert_eq!(under.height, plain.height);
|
assert_eq!(under.height, plain.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn math_style_commands_are_transparent() {
|
||||||
|
let font = Cmr10Metrics::default();
|
||||||
|
let plain = layout_math(&parse_math("x"), &font);
|
||||||
|
let styled = layout_math(&parse_math(r"\displaystyle{x}"), &font);
|
||||||
|
assert_eq!(plain.width, styled.width);
|
||||||
|
assert_eq!(plain.height, styled.height);
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn binom_stacks_two_arguments() {
|
fn binom_stacks_two_arguments() {
|
||||||
let font = Cmr10Metrics::default();
|
let font = Cmr10Metrics::default();
|
||||||
|
|||||||
Reference in new issue
Block a user