mirror of
https://github.com/JustAnyones/ktu-paper.git
synced 2026-09-19 12:48:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67947b07a7
|
||
|
|
cd64907a36
|
||
|
|
920866695c
|
+9
-7
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
/// Helper function to resolve figure numbers (either global "1" or section-based "1.1").
|
/// Helper function to resolve figure numbers (either global "1" or section-based "1.1").
|
||||||
/// It takes a figure item and referenced location and returns the appropriate number as a string.
|
/// It takes a figure item and referenced location and returns the appropriate number as a string.
|
||||||
#let __get-figure-number(fig-item, loc) = context {
|
#let __get-figure-number(fig-item, loc) = {
|
||||||
if type(fig-item) != content {
|
if type(fig-item) != content {
|
||||||
panic("can only get figure number for content elements")
|
panic("can only get figure number for content elements")
|
||||||
}
|
}
|
||||||
@@ -48,17 +48,17 @@
|
|||||||
panic("can only get figure number for figure elements")
|
panic("can only get figure number for figure elements")
|
||||||
}
|
}
|
||||||
|
|
||||||
let perSection = __FIG_PER_SECTION.get()
|
let perSection = __FIG_PER_SECTION.at(loc)
|
||||||
if perSection {
|
if perSection {
|
||||||
let chapter = counter(heading).at(loc).at(0, default: 0)
|
let chapter = counter(heading).at(loc).at(0, default: 0)
|
||||||
let figNum = counter(figure.where(kind: fig-item.kind)).at(loc).at(0, default: 1)
|
let figNum = counter(figure.where(kind: fig-item.kind)).at(loc).at(0, default: 1)
|
||||||
[#chapter.#figNum]
|
str(chapter) + "." + str(figNum)
|
||||||
} else {
|
} else {
|
||||||
let caption = fig-item.caption
|
let caption = fig-item.caption
|
||||||
if caption != none and caption.numbering != none {
|
if caption != none and caption.numbering != none {
|
||||||
caption.counter.at(loc).at(0)
|
str(caption.counter.at(loc).at(0))
|
||||||
} else {
|
} else {
|
||||||
[#counter(figure.where(kind: fig-item.kind)).at(loc).at(0)]
|
str(counter(figure.where(kind: fig-item.kind)).at(loc).at(0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,12 +124,14 @@
|
|||||||
}
|
}
|
||||||
set text(size: 11pt)
|
set text(size: 11pt)
|
||||||
|
|
||||||
|
let fig-num = context __get-figure-number(it, here())
|
||||||
|
|
||||||
// Tables have captions at the top
|
// Tables have captions at the top
|
||||||
if it.kind == table {
|
if it.kind == table {
|
||||||
align(left)[*#__get-figure-number(it, here()) #supplement#separator* #caption.body]
|
align(left)[*#fig-num #supplement#separator* #caption.body]
|
||||||
it.body
|
it.body
|
||||||
} else {
|
} else {
|
||||||
it.body
|
it.body
|
||||||
[*#__get-figure-number(it, here()) #supplement#separator* #caption.body]
|
align(center)[*#fig-num #supplement#separator* #caption.body]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#import "@local/ktu-paper:0.2.0": (
|
#import "@local/ktu-paper:0.2.1": (
|
||||||
ktu-paper, setup-code,
|
ktu-paper, setup-code,
|
||||||
ktu-table-of-contents, ktu-picture-list, ktu-table-list,
|
ktu-table-of-contents, ktu-picture-list, ktu-table-list,
|
||||||
ktu-heading-page-normal,
|
ktu-heading-page-normal,
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#import "@local/ktu-paper:0.2.0": (
|
#import "@local/ktu-paper:0.2.1": (
|
||||||
ktu-paper, setup-code,
|
ktu-paper, setup-code,
|
||||||
ktu-table-of-contents, ktu-picture-list, ktu-table-list,
|
ktu-table-of-contents, ktu-picture-list, ktu-table-list,
|
||||||
ktu-heading-page-normal,
|
ktu-heading-page-normal,
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ktu-paper"
|
name = "ktu-paper"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
compiler = "0.15.1"
|
compiler = "0.15.0"
|
||||||
entrypoint = "src/lib.typ"
|
entrypoint = "src/lib.typ"
|
||||||
repository = "https://github.com/svetikas/ktu-paper"
|
repository = "https://github.com/svetikas/ktu-paper"
|
||||||
authors = ["Dominykas Svetikas <https://svetikas.lt>"]
|
authors = ["Dominykas Svetikas <https://svetikas.lt>"]
|
||||||
|
|||||||
Reference in New Issue
Block a user