mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Wrapping with parens should not push superscripts higher (#4545)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
parent
ac322e342b
commit
f0407d4949
@ -159,10 +159,19 @@ impl MathRun {
|
||||
|
||||
pub fn into_fragment(self, ctx: &MathContext, styles: StyleChain) -> MathFragment {
|
||||
if self.0.len() == 1 {
|
||||
self.0.into_iter().next().unwrap()
|
||||
} else {
|
||||
FrameFragment::new(ctx, styles, self.into_frame(ctx, styles)).into()
|
||||
return self.0.into_iter().next().unwrap();
|
||||
}
|
||||
|
||||
// Fragments without a math_size are ignored: the notion of size do not
|
||||
// apply to them, so their text-likeness is meaningless.
|
||||
let text_like = self
|
||||
.iter()
|
||||
.filter(|e| e.math_size().is_some())
|
||||
.all(|e| e.is_text_like());
|
||||
|
||||
FrameFragment::new(ctx, styles, self.into_frame(ctx, styles))
|
||||
.with_text_like(text_like)
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Returns a builder that lays out the [`MathFragment`]s into a possibly
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 651 B After Width: | Height: | Size: 649 B |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
@ -84,9 +84,9 @@ $ (-1)^n + (1/2 + 3)^(-1/2) $
|
||||
// Test that the attachments are aligned horizontally.
|
||||
$ x_1 p_1 frak(p)_1 2_1 dot_1 lg_1 !_1 \\_1 ]_1 "ip"_1 op("iq")_1 \
|
||||
x^1 b^1 frak(b)^1 2^1 dot^1 lg^1 !^1 \\^1 ]^1 "ib"^1 op("id")^1 \
|
||||
x_1 y_1 "_"_1 x^1 l^1 "`"^1 attach(I,tl:1,bl:1,tr:1,br:1)
|
||||
"_"_1 "`"^1 x_1 y_1 x^1 l^1 attach(I,tl:1,bl:1,tr:1,br:1)
|
||||
scripts(sum)_1^1 integral_1^1 abs(1/2)_1^1 \
|
||||
x^1_1, "("b y")"^1_1 != (b y)^1_1, "[∫]"_1 [integral]_1 $
|
||||
x^1_1, ")"^1_1 (b y)^1_1, "[∫]"_1 [integral]_1 $
|
||||
|
||||
--- math-attach-limit ---
|
||||
// Test limit.
|
||||
|
Loading…
x
Reference in New Issue
Block a user