summaryrefslogtreecommitdiff
path: root/library/src/math/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-19 10:38:03 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-19 11:06:52 +0200
commitf8966f9e867dc72080355342aab64734f70ac4f7 (patch)
tree9713d316b31e913b9edd5eca73410f81457aaf76 /library/src/math/mod.rs
parentd10b53df0b487036b0d639b6033f4568648cfff1 (diff)
Fix realize in math
Diffstat (limited to 'library/src/math/mod.rs')
-rw-r--r--library/src/math/mod.rs13
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() {