Strip trailing line breaks in math equations (#750)
This commit is contained in:
parent
a066a3d283
commit
03d2ec9f81
@ -127,11 +127,15 @@ impl MathRow {
|
||||
TIGHT_LEADING.scaled(ctx)
|
||||
};
|
||||
|
||||
let rows: Vec<_> = fragments
|
||||
let mut rows: Vec<_> = fragments
|
||||
.split(|frag| matches!(frag, MathFragment::Linebreak))
|
||||
.map(|slice| Self(slice.to_vec()))
|
||||
.collect();
|
||||
|
||||
if matches!(rows.last(), Some(row) if row.0.is_empty()) {
|
||||
rows.pop();
|
||||
}
|
||||
|
||||
let width = rows.iter().map(|row| row.width()).max().unwrap_or_default();
|
||||
let points = alignments(&rows);
|
||||
let mut frame = Frame::new(Size::zero());
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 13 KiB |
@ -33,3 +33,24 @@ $ "abc" &= c \
|
||||
---
|
||||
// Test multiline subscript.
|
||||
$ sum_(n in NN \ n <= 5) n = (5(5+1))/2 = 15 $
|
||||
|
||||
---
|
||||
// Test no trailing line break.
|
||||
$
|
||||
"abc" &= c
|
||||
$
|
||||
No trailing line break.
|
||||
|
||||
---
|
||||
// Test single trailing line break.
|
||||
$
|
||||
"abc" &= c \
|
||||
$
|
||||
One trailing line break.
|
||||
|
||||
---
|
||||
// Test multiple trailing line breaks.
|
||||
$
|
||||
"abc" &= c \ \ \
|
||||
$
|
||||
Multiple trailing line breaks.
|
||||
|
Loading…
x
Reference in New Issue
Block a user