Ignore numbering and limits control words in math
This commit is contained in:
1 parent
c72f612431
commit
f88fa7fd9d
1 file changed
+10
-1
@@ -581,7 +581,8 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
|
|||||||
return match command.as_str() {
|
return match command.as_str() {
|
||||||
"quad" => (MathAtom::Space(655_360), next),
|
"quad" => (MathAtom::Space(655_360), next),
|
||||||
"qquad" => (MathAtom::Space(1_310_720), next),
|
"qquad" => (MathAtom::Space(1_310_720), next),
|
||||||
"displaystyle" | "textstyle" | "scriptstyle" | "scriptscriptstyle" => {
|
"displaystyle" | "textstyle" | "scriptstyle" | "scriptscriptstyle" | "nonumber"
|
||||||
|
| "notag" | "limits" | "nolimits" | "displaylimits" => {
|
||||||
let mut after = next;
|
let mut after = next;
|
||||||
while chars.get(after).is_some_and(|ch| ch.is_whitespace()) {
|
while chars.get(after).is_some_and(|ch| ch.is_whitespace()) {
|
||||||
after += 1;
|
after += 1;
|
||||||
@@ -1268,6 +1269,14 @@ mod tests {
|
|||||||
assert_eq!(under.height, plain.height);
|
assert_eq!(under.height, plain.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn numbering_control_words_are_transparent() {
|
||||||
|
let font = Cmr10Metrics::default();
|
||||||
|
let plain = layout_math(&parse_math("x+y"), &font);
|
||||||
|
let numbered = layout_math(&parse_math(r"x\nonumber+y"), &font);
|
||||||
|
assert_eq!(plain.width, numbered.width);
|
||||||
|
assert_eq!(plain.height, numbered.height);
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn operatorname_star_does_not_emit_a_symbol() {
|
fn operatorname_star_does_not_emit_a_symbol() {
|
||||||
let font = Cmr10Metrics::default();
|
let font = Cmr10Metrics::default();
|
||||||
|
|||||||
Reference in new issue
Block a user