diff options
| author | sitandr <60141933+sitandr@users.noreply.github.com> | 2023-06-24 15:28:36 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 14:28:36 +0200 |
| commit | c5e82b3fa8e44e0efd9beb37c477e5dc202f523e (patch) | |
| tree | 94e7eb91600903c3158ef83df1cf06f26eca9b86 /library/src | |
| parent | fa42a26f6fa2f6e1132aec4977df2e1bccf9fc99 (diff) | |
Added argument to disable limits in inline math, closes #1522 (#1552)
Diffstat (limited to 'library/src')
| -rw-r--r-- | library/src/math/attach.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/library/src/math/attach.rs b/library/src/math/attach.rs index eee1e80e..340dd21e 100644 --- a/library/src/math/attach.rs +++ b/library/src/math/attach.rs @@ -124,13 +124,25 @@ pub struct LimitsElem { /// The base to attach the limits to. #[required] pub body: Content, + + /// Whether to apply limits in inline equations. + /// + /// It is useful to disable this setting + /// in most cases of applying limits globally + /// (inside show rules or new elements) + #[default(true)] + pub inline: bool, } impl LayoutMath for LimitsElem { #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let mut fragment = ctx.layout_fragment(&self.body())?; - fragment.set_limits(Limits::Always); + fragment.set_limits(if self.inline(ctx.styles()) { + Limits::Always + } else { + Limits::Display + }); ctx.push(fragment); Ok(()) } |
