From ecd589a84f24cb0639bb20057d070bf0d9ec4899 Mon Sep 17 00:00:00 2001 From: Leedehai <18319900+Leedehai@users.noreply.github.com> Date: Sat, 29 Apr 2023 14:51:29 -0400 Subject: Add a test checking equations can embed function-built pieces (#1033) --- tests/ref/bugs/math-realize.png | Bin 8926 -> 20296 bytes tests/typ/bugs/math-realize.typ | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/ref/bugs/math-realize.png b/tests/ref/bugs/math-realize.png index d6a14fa3..941f965b 100644 Binary files a/tests/ref/bugs/math-realize.png and b/tests/ref/bugs/math-realize.png differ diff --git a/tests/typ/bugs/math-realize.typ b/tests/typ/bugs/math-realize.typ index 19e2c93a..d7991542 100644 --- a/tests/typ/bugs/math-realize.typ +++ b/tests/typ/bugs/math-realize.typ @@ -18,3 +18,30 @@ $ vec(1,2) * 2 $ $ x^2 #hide[$(>= phi.alt) union y^2 0$] z^2 $ Hello #hide[there $x$] and #hide[$ f(x) := x^2 $] + +--- +// Test equations can embed equation pieces built by functions +#let foo(v1, v2) = { + // Return an equation piece that would've been rendered in + // inline style if the piece is not embedded + $v1 v2^2$ +} +#let bar(v1, v2) = { + // Return an equation piece that would've been rendered in + // block style if the piece is not embedded + $ v1 v2^2 $ +} +#let baz(..sink) = { + // Return an equation piece built by joining arrays + sink.pos().map(x => $hat(#x)$).join(sym.and) +} + +Inline $2 foo(alpha, (M+foo(a, b)))$. + +Inline $2 bar(alpha, (M+foo(a, b)))$. + +Inline $2 baz(x,y,baz(u, v))$. + +$ 2 foo(alpha, (M+foo(a, b))) $ +$ 2 bar(alpha, (M+foo(a, b))) $ +$ 2 baz(x,y,baz(u, v)) $ -- cgit v1.2.3