From 4c79d7c6e43d853120eb9108caff90fb3c5cfcd8 Mon Sep 17 00:00:00 2001 From: diaco Date: Tue, 7 Jul 2026 13:25:54 +0330 Subject: [PATCH] Refactor heading display logic in product test template --- product_test_template.typ | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/product_test_template.typ b/product_test_template.typ index cf41395..2847105 100644 --- a/product_test_template.typ +++ b/product_test_template.typ @@ -109,8 +109,6 @@ ))], ) ] - line(length: 100%) - // set heading(numbering: "۱.۱- ") set math.equation(numbering: "(1)") set footnote(numbering: "۱.") @@ -118,11 +116,24 @@ set footnote.entry(indent: 0em) set align(right) - show heading: it => [ - #set align(right) - #it.body - #v(10pt) - ] + show heading: it => context { + let y = here().position().y + let body-top = if counter(page).get().first() > 1 { + page.margin.top + 28pt + } else { + page.margin.top + } + let not-at-top = y > body-top + 12pt + [ + #if not-at-top and it.level <= 2 [ + #line(length: 100%) + #v(8pt) + ] + #set align(right) + #it.body + #v(10pt) + ] + } set text(spacing: 100%) set par(