9 Commits
9 changed files with 111 additions and 40 deletions

No files matched your search

+2 -2
View File
@@ -4,9 +4,9 @@ This repository contains a Typst template for academic papers at the Kaunas Univ
## Initiating the template ## Initiating the template
Install the downloaded template under the following directory: Install the downloaded template under the following directory:
- LINUX: `~/.local/share/typst/packages/local/ktu-paper/0.2.1/` - Linux: `~/.local/share/typst/packages/local/ktu-paper/0.3.2/`
And then initiate a new project: And then initiate a new project:
```sh ```sh
typst init @local/ktu-paper:0.2.1 typst init @local/ktu-paper:0.3.2
``` ```
+1 -1
View File
@@ -1,7 +1,7 @@
// This file includes logic for displaying figures in the document, including numbering, captions, and references. It also includes logic for handling figure numbering per section or globally, based on the configuration set in `config.typ`. // This file includes logic for displaying figures in the document, including numbering, captions, and references. It also includes logic for handling figure numbering per section or globally, based on the configuration set in `config.typ`.
#import "config.typ": __FIG_PER_SECTION #import "config.typ": __FIG_PER_SECTION
/// Localizations for various recognized referencable figure types. /// Localizations for various recognized referenceable figure types.
/// This is used to provide the correct supplement text for each type of figure /// This is used to provide the correct supplement text for each type of figure
/// when generating references, captions and outlines. /// when generating references, captions and outlines.
#let __figureNames = ( #let __figureNames = (
+64 -18
View File
@@ -17,6 +17,7 @@
#let ktu-author-table( #let ktu-author-table(
authors: (), authors: (),
alignment: right, alignment: right,
namesFirst: true, // if false, roles will be displayed first
) = context { ) = context {
// The layout should be a list of lists whose elements are (name, role) pairs. // The layout should be a list of lists whose elements are (name, role) pairs.
assert(authors.len() > 0, message: "author table must have at least one author") assert(authors.len() > 0, message: "author table must have at least one author")
@@ -51,9 +52,13 @@
table.header([]), table.header([]),
..for author in authors { ..for author in authors {
let (name, role) = author let (name, role) = author
name = [*#name*]
if not namesFirst {
(role, name) = (name, role)
}
(align(center)[ (align(center)[
#set block(below: 8pt) #set block(below: 8pt)
#block[*#name*] #block[#name]
#block[#role] #block[#role]
], []) ], [])
@@ -67,9 +72,13 @@
), ),
..for author in authors { ..for author in authors {
let (name, role) = author let (name, role) = author
name = [*#name*]
if not namesFirst {
(role, name) = (name, role)
}
(align(left)[ (align(left)[
#set block(below: 8pt) #set block(below: 8pt)
#block[*#name*] #block[#name]
#block[#role] #block[#role]
], [], [], []) ], [], [], [])
@@ -128,8 +137,9 @@
] ]
} }
#let ktu-heading-page-centered( #let ktu-heading-page(
faculty: highlight[Fakulteto pavadinimas], faculty: highlight[Fakulteto pavadinimas],
department: none, // optional
title: highlight[Rašto darbo pavadinimas], title: highlight[Rašto darbo pavadinimas],
subtitles: highlight[Praktikos ataskaita / referatas ir pan. (įrašyti rašto darbo tipą)], subtitles: highlight[Praktikos ataskaita / referatas ir pan. (įrašyti rašto darbo tipą)],
authors: ( authors: (
@@ -138,44 +148,80 @@
), ),
place: highlight[Kaunas], place: highlight[Kaunas],
year: highlight[#datetime.today().year()], year: highlight[#datetime.today().year()],
centerAuthors: false,
authorNamesFirst: true, // if false, roles will be displayed first
) = { ) = {
let isArr = type(subtitles) == array let subHeaders = (faculty,)
if not isArr { if department != none {
subHeaders = (faculty, department)
}
if type(subtitles) != array {
subtitles = (subtitles,) subtitles = (subtitles,)
} }
ktu-title-header-block( ktu-title-header-block(
subHeaders: (faculty,), subHeaders: subHeaders,
bigTitle: title, bigTitle: title,
subTitles: subtitles, subTitles: subtitles,
) )
v(94pt) v(94pt)
ktu-author-table(authors: authors, alignment: center) if centerAuthors {
ktu-author-table(authors: authors, namesFirst: authorNamesFirst, alignment: center)
} else {
ktu-author-table(authors: authors, namesFirst: authorNamesFirst)
}
align(center+bottom, block([*#place, #year*])) align(center+bottom, block([*#place, #year*]))
} }
#let ktu-heading-page-centered(
faculty: highlight[Fakulteto pavadinimas],
department: none, // optional
title: highlight[Rašto darbo pavadinimas],
subtitles: highlight[Praktikos ataskaita / referatas ir pan. (įrašyti rašto darbo tipą)],
authors: (
(highlight[Vardenis Pavardenis], highlight[Projekto autorius]),
(highlight[Vardenis Pavardenis], highlight[Vadovas]),
),
authorNamesFirst: true, // if false, roles will be displayed first
place: highlight[Kaunas],
year: highlight[#datetime.today().year()],
) = {
ktu-heading-page(
faculty: faculty,
department: department,
title: title,
subtitles: subtitles,
authors: authors,
place: place,
year: year,
centerAuthors: true,
authorNamesFirst: authorNamesFirst,
)
}
#let ktu-heading-page-normal( #let ktu-heading-page-normal(
faculty: highlight[Fakulteto pavadinimas], faculty: highlight[Fakulteto pavadinimas],
department: none, // optional
title: highlight[Rašto darbo pavadinimas], title: highlight[Rašto darbo pavadinimas],
subtitles: highlight[Praktikos ataskaita / referatas ir pan. (įrašyti rašto darbo tipą)], subtitles: highlight[Praktikos ataskaita / referatas ir pan. (įrašyti rašto darbo tipą)],
authors: ( authors: (
(highlight[Vardenis Pavardenis], highlight[Projekto autorius]), (highlight[Vardenis Pavardenis], highlight[Projekto autorius]),
(highlight[Vardenis Pavardenis], highlight[Vadovas]), (highlight[Vardenis Pavardenis], highlight[Vadovas]),
), ),
authorNamesFirst: true, // if false, roles will be displayed first
place: highlight[Kaunas], place: highlight[Kaunas],
year: highlight[#datetime.today().year()], year: highlight[#datetime.today().year()],
) = { ) = {
let isArr = type(subtitles) == array ktu-heading-page(
if not isArr { faculty: faculty,
subtitles = (subtitles,) department: department,
} title: title,
ktu-title-header-block( subtitles: subtitles,
subHeaders: (faculty,), authors: authors,
bigTitle: title, place: place,
subTitles: subtitles, year: year,
centerAuthors: false,
authorNamesFirst: authorNamesFirst,
) )
v(94pt)
ktu-author-table(authors: authors)
align(center+bottom, block([*#place, #year*]))
} }
#let ktu-academic-honestly-declaration-page( #let ktu-academic-honestly-declaration-page(
+31 -6
View File
@@ -2,7 +2,12 @@
#import "config.typ": debug-author-table, enable-heading-experiment, __HEADING_EXPERIMENT, __FIG_PER_SECTION, __UPPERCASE_SECTION_TITLES #import "config.typ": debug-author-table, enable-heading-experiment, __HEADING_EXPERIMENT, __FIG_PER_SECTION, __UPPERCASE_SECTION_TITLES
#import "fragments.typ": ( #import "fragments.typ": (
ktu-table, ktu-table,
ktu-heading-page-centered, ktu-heading-page-normal, ktu-academic-honestly-declaration-page
// building blocks
ktu-author-table, ktu-title-header-block,
ktu-heading-page, ktu-heading-page-centered, ktu-heading-page-normal,
ktu-academic-honestly-declaration-page
) )
#import "figures.typ": ( #import "figures.typ": (
__fig-supplement, __fig-supplement,
@@ -24,15 +29,25 @@
* - Proposal: change `leading` option to `line-height` | https://github.com/typst/typst/issues/4224 * - Proposal: change `leading` option to `line-height` | https://github.com/typst/typst/issues/4224
*/ */
#let __METADATA_HEADING_ALIGN_LEFT = metadata("heading-align-left");
/// ///
/// Insert a heading without a number. /// Insert a heading without a number.
/// ///
/// Usually used for introductory or summary sections at the start and end. /// Usually used for introductory or summary sections at the start and end.
/// - text (str): The heading's title. /// - headingElement (heading): The heading's title.
/// - alignLeft (bool): Whether the heading should be left-aligned or centered.
/// -> /// ->
#let unnumbered-heading(text) = { #let unnumbered-heading(headingElement, alignLeft: false) = {
set heading(numbering: none) let fields = headingElement.fields()
[#text] let body = fields.body
let level = fields.at("level", default: 1)
if alignLeft {
body = body + __METADATA_HEADING_ALIGN_LEFT
}
heading(level: level, numbering: none, body)
} }
#let appendix-item(body) = { #let appendix-item(body) = {
@@ -443,7 +458,12 @@
// Antraštė be nr. // Antraštė be nr.
if it.numbering == none { if it.numbering == none {
// Centruota lygiuotė by default, but can be overridden by the user // Centruota lygiuotė by default, but can be overridden by the user
set align(unnumberedHeadingAlignment) let explicitlyAlignLeft = it.body.has("children") and it.body.children.len() > 1 and it.body.children.at(1) == __METADATA_HEADING_ALIGN_LEFT
// If the user explicitly set alignLeft to true, we should align left regardless of the global setting
let targetAlign = if explicitlyAlignLeft { left } else { unnumberedHeadingAlignment }
set align(targetAlign)
// atstumas prieš ir po antraštės - 10 pt // atstumas prieš ir po antraštės - 10 pt
block[#maybe-uppercase(it.body)] block[#maybe-uppercase(it.body)]
@@ -502,6 +522,11 @@
// Bibliography citing style // Bibliography citing style
set bibliography(style: "assets/iso690-numeric-lt.csl") set bibliography(style: "assets/iso690-numeric-lt.csl")
// Block equations are left-aligned
show math.equation.where(block: true): it => {
align(left, it)
}
body body
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 KiB

File renamed without changes.
+10 -10
View File
@@ -1,4 +1,4 @@
#import "@local/ktu-paper:0.3.0": ( #import "@local/ktu-paper:0.3.2": (
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,
@@ -94,7 +94,7 @@ show table.cell: set text(size: 8pt)
Duomenų sklaidą yra patogu pavaizduoti ir stačiakampe diagrama: Duomenų sklaidą yra patogu pavaizduoti ir stačiakampe diagrama:
#figure( #figure(
image("image.jpeg", width: 70%), image("images/santaka.png", width: 70%),
caption: [ caption: [
Skaitinių atributų stačiakampė diagrama Skaitinių atributų stačiakampė diagrama
], ],
@@ -136,8 +136,8 @@ Paveikslėlius galima grupuoti į "grid" #custom-ref(<image-grid-2>, <image-grid
#figure(grid( #figure(grid(
columns: 2, columns: 2,
gutter: 2mm, gutter: 2mm,
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
), caption: [ ), caption: [
Paveikslėliai "grid'e" 1 Paveikslėliai "grid'e" 1
]) <image-grid-2> ]) <image-grid-2>
@@ -145,11 +145,11 @@ Paveikslėlius galima grupuoti į "grid" #custom-ref(<image-grid-2>, <image-grid
#figure(grid( #figure(grid(
columns: 3, columns: 3,
gutter: 2mm, gutter: 2mm,
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
image("image.jpeg", width: 100%), image("images/santaka.png", width: 100%),
), caption: [ ), caption: [
Paveikslėliai "grid'e" 2 Paveikslėliai "grid'e" 2
]) <image-grid-3> ]) <image-grid-3>
@@ -190,7 +190,7 @@ $
čia $X$ -- imtis, $mu$ -- imties vidurkis, $sigma$ -- imties standartinis nuokrypis. Fragmentas pateikiamas #ref-no(<image-1>) paveikslėlyje. čia $X$ -- imtis, $mu$ -- imties vidurkis, $sigma$ -- imties standartinis nuokrypis. Fragmentas pateikiamas #ref-no(<image-1>) paveikslėlyje.
#figure( #figure(
image("image.jpeg", width: 90%), image("images/santaka.png", width: 90%),
caption: [ caption: [
Paveikslėlio pavadinimas Paveikslėlio pavadinimas
], ],
+2 -2
View File
@@ -1,4 +1,4 @@
#import "@local/ktu-paper:0.3.0": ( #import "@local/ktu-paper:0.3.2": (
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,
@@ -191,7 +191,7 @@ Eu eum decore inimicus consetetur, cu usu habeo corpora intellegam. Ut antiopam
Lorem ipsum dolor sit amet, eam ex decore persequeris, sit at illud lobortis atomorum. Sed dolorem quaerendum ne, prompta instructior ne pri. Et mel partiendo suscipiantur, docendi abhorreant ea sit. Recteque imperdiet eum te. Lorem ipsum dolor sit amet, eam ex decore persequeris, sit at illud lobortis atomorum. Sed dolorem quaerendum ne, prompta instructior ne pri. Et mel partiendo suscipiantur, docendi abhorreant ea sit. Recteque imperdiet eum te.
#figure( #figure(
image("Picture.png", width: 11.2cm, height: 8cm), image("images/santaka.png", width: 11.2cm, height: 8cm),
caption: [ caption: [
Kauno technologijos universiteto „Santakos“ slėnio fasadas Kauno technologijos universiteto „Santakos“ slėnio fasadas
], ],
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ktu-paper" name = "ktu-paper"
version = "0.3.0" version = "0.3.2"
compiler = "0.15.0" 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"