From 6207d2d82af7e03c9b7303bcc76a375027181807 Mon Sep 17 00:00:00 2001 From: Anton Bilous Date: Mon, 19 May 2025 17:24:36 +0300 Subject: [PATCH] feat(style)!: remove reference styling & fix figure numbering for appendices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use `@some_label[див. фігуру]` to get a "див. фігуру 42" link. --- style.typ | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/style.typ b/style.typ index 703ae78..73fe85b 100644 --- a/style.typ +++ b/style.typ @@ -69,7 +69,7 @@ show figure.where(kind: table): set figure.caption(position: top) show figure.caption.where(kind: table): set align(left) - // Numbering + // Numbering {{{1 show heading.where(level: 1): it => { counter(math.equation).update(0) counter(figure.where(kind: raw)).update(0) @@ -80,32 +80,6 @@ set figure(numbering: i => numbering("1.1", counter(heading).get().at(0), i)) set math.equation(numbering: i => numbering("(1.1)", counter(heading).get().at(0), i)) - // References to images and tables {{{1 - // TODO: simplify this to a simple number display? Will become a bit manual tho - set ref( - supplement: it => if it == none or not it.has("kind") { - it - } else if it.kind == image { - "див. рис." - } else if it.kind == table { - "див. таблицю" - } else { - it - }, - ) - show ref: it => { - let el = it.element - - if el == none or not el.has("kind") { - return it - } - if el.kind != image and el.kind != table { - return it - } - - [(#it)] - } - // Headings {{{1 set heading(numbering: "1.1") @@ -128,7 +102,6 @@ v(spacing * 2, weak: true) } - // Listings {{{1 show raw: it => { let raw-spacing = 0.5em @@ -153,9 +126,13 @@ /// -> content /// - it (content): Content to apply the style to. #let appendices-style(it) = /* {{{ */ { + // Numbering counter(heading).update(0) set heading(numbering: (i, ..n) => upper(num-to-alpha.at(i)) + numbering(".1.1", ..n)) + set figure(numbering: i => [#upper(num-to-alpha.at(counter(heading).get().at(0))).#i]) + set math.equation(numbering: i => [(#upper(num-to-alpha.at(counter(heading).get().at(0))).#i)]) + // Headings show heading: it => if it.level == 1 { set align(center) set text(size: 14pt, weight: "regular")