diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-04-19 10:38:03 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-04-19 11:06:52 +0200 |
| commit | f8966f9e867dc72080355342aab64734f70ac4f7 (patch) | |
| tree | 9713d316b31e913b9edd5eca73410f81457aaf76 /library/src/math/mod.rs | |
| parent | d10b53df0b487036b0d639b6033f4568648cfff1 (diff) | |
Fix realize in math
Diffstat (limited to 'library/src/math/mod.rs')
| -rw-r--r-- | library/src/math/mod.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index 97e5548e..9c8a9cdf 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -344,9 +344,18 @@ impl LayoutMath for EquationElem { impl LayoutMath for Content { fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { + // Directly layout the body of nested equations instead of handling it + // like a normal equation so that things like this work: + // ``` + // #let my = $pi$ + // $ my r^2 $ + // ``` + if let Some(elem) = self.to::<EquationElem>() { + return elem.layout_math(ctx); + } + if let Some(realized) = ctx.realize(self)? { - realized.layout_math(ctx)?; - return Ok(()); + return realized.layout_math(ctx); } if let Some(children) = self.to_sequence() { |
