From 1a2dc26b976581d68d18c5baffbebe947b3140f7 Mon Sep 17 00:00:00 2001 From: Anton Bilous Date: Sun, 9 Feb 2025 13:52:50 +0200 Subject: [PATCH] appearance of references to images --- template.typ | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/template.typ b/template.typ index b304aba..2f0cca9 100644 --- a/template.typ +++ b/template.typ @@ -15,14 +15,14 @@ /// bold text #let bold(content) = text(weight: "bold")[#content] -/// insert fig with label and caption -#let fig(path, caption) = { - figure( +/// captioned image with label derived from path +#let img(path, caption) = [ + #figure( image(path), caption: caption, ) - label(path.split("/").last().split(".").first()) -} + #label(path.split("/").last().split(".").first()) +] /// subjects list #let subjects = ( @@ -113,6 +113,19 @@ }, ) + // appearance of references to images + show ref: it => { + let el = it.element + if el != none and el.kind == image { + link( + el.location(), + [(див. рис. #numbering(el.numbering))], + ) + } else { + it + } + } + // TODO: Maybe this will be better. Must be investigated. // // set math.equation(numbering: (..num) => @@ -607,4 +620,3 @@ heading(title) doc } -