mirror of
https://github.com/kristoferssolo/LU-DF-Typst-Template.git
synced 2025-12-31 05:32:34 +00:00
Compare commits
9 Commits
8c1c86f712
...
fe82dee5e4
| Author | SHA1 | Date | |
|---|---|---|---|
| fe82dee5e4 | |||
| a5e6f289cc | |||
| e9dbdea5f1 | |||
| ec3fe8e51d | |||
| a05dbee1fb | |||
| 54f7a8cef8 | |||
| 3dd154a517 | |||
| c2e78f8511 | |||
| 6f44f1b0d8 |
@ -33,6 +33,7 @@ configure the whole document and `attachment` helper function. Important argumen
|
|||||||
`text` (content) and `keywords` (array) as well as `title`, `lang` and `keyword-title`.
|
`text` (content) and `keywords` (array) as well as `title`, `lang` and `keyword-title`.
|
||||||
- `bibliography`: Result of `bibliography("path/to/file.yml")` or `none`.
|
- `bibliography`: Result of `bibliography("path/to/file.yml")` or `none`.
|
||||||
- `attachments`: Tuple of `attachment(...)` items (tables, figures).
|
- `attachments`: Tuple of `attachment(...)` items (tables, figures).
|
||||||
|
- `display-documentary`: Whether to display the documentary page at the end. Defaults to `true`.
|
||||||
- Positional argument: the document body follows the `ludf.with(...)` call.
|
- Positional argument: the document body follows the `ludf.with(...)` call.
|
||||||
|
|
||||||
The function also accepts a single, positional argument for the body of the paper.
|
The function also accepts a single, positional argument for the body of the paper.
|
||||||
@ -42,7 +43,7 @@ function in a show rule. If you want to change an existing project to use this
|
|||||||
template, you can add a show rule like this at the top of your file:
|
template, you can add a show rule like this at the top of your file:
|
||||||
|
|
||||||
```typst
|
```typst
|
||||||
#import "@preview/solo-lu-df:0.1.1": *
|
#import "@preview/solo-lu-df:0.1.4": *
|
||||||
|
|
||||||
#show: ludf.with(
|
#show: ludf.with(
|
||||||
title: "Darba Nosaukums",
|
title: "Darba Nosaukums",
|
||||||
@ -67,7 +68,8 @@ template, you can add a show rule like this at the top of your file:
|
|||||||
columns: (1fr, 1fr),
|
columns: (1fr, 1fr),
|
||||||
[Column 1], [Column 2],
|
[Column 1], [Column 2],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Your content goes below.
|
// Your content goes below.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node
|
#import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node
|
||||||
#import fletcher.shapes: cylinder, ellipse
|
#import fletcher.shapes: cylinder, ellipse
|
||||||
#import "@preview/solo-lu-df:0.1.1": *
|
#import "@preview/solo-lu-df:0.1.4": *
|
||||||
#import "utils/tables.typ": function-table
|
#import "utils/tables.typ": function-table
|
||||||
#import "utils/diagrams.typ": data-store, dpd-database, dpd-edge, process
|
#import "utils/diagrams.typ": data-store, dpd-database, dpd-edge, process
|
||||||
|
|
||||||
|
|||||||
59
src/lib.typ
59
src/lib.typ
@ -2,8 +2,6 @@
|
|||||||
make-abstract, make-attachments, make-documentary-page, make-title,
|
make-abstract, make-attachments, make-documentary-page, make-title,
|
||||||
)
|
)
|
||||||
|
|
||||||
#let indent = 1cm
|
|
||||||
|
|
||||||
#let attachment(caption: none, label: none, body) = {
|
#let attachment(caption: none, label: none, body) = {
|
||||||
(
|
(
|
||||||
content: body,
|
content: body,
|
||||||
@ -49,6 +47,7 @@
|
|||||||
outline-title: "Saturs",
|
outline-title: "Saturs",
|
||||||
attachments: (),
|
attachments: (),
|
||||||
attachment-title: "Pielikumi",
|
attachment-title: "Pielikumi",
|
||||||
|
display-documentary: true,
|
||||||
body,
|
body,
|
||||||
) = {
|
) = {
|
||||||
// Set document metadata.
|
// Set document metadata.
|
||||||
@ -72,16 +71,14 @@
|
|||||||
paper: "a4",
|
paper: "a4",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// Main body.
|
// Main body.
|
||||||
set par(
|
set par(
|
||||||
justify: true,
|
justify: true,
|
||||||
leading: 1.5em,
|
leading: 0.65em * 1.5,
|
||||||
spacing: 1.5em,
|
spacing: 0.65em * 1.5,
|
||||||
first-line-indent: (amount: indent, all: true),
|
first-line-indent: (amount: 1cm, all: true),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// Configure equation numbering and spacing.
|
// Configure equation numbering and spacing.
|
||||||
set math.equation(numbering: "(1)")
|
set math.equation(numbering: "(1)")
|
||||||
show math.equation: set block(spacing: 0.65em)
|
show math.equation: set block(spacing: 0.65em)
|
||||||
@ -95,10 +92,10 @@
|
|||||||
|
|
||||||
// Headings
|
// Headings
|
||||||
set heading(numbering: "1.1.")
|
set heading(numbering: "1.1.")
|
||||||
show heading: set block(spacing: 2em)
|
show heading: set block(spacing: 0.65em * 2, sticky: true)
|
||||||
show heading: it => {
|
show heading: it => {
|
||||||
if it.level == 1 {
|
if it.level == 1 {
|
||||||
pagebreak(weak: true)
|
pagebreak()
|
||||||
text(14pt, align(center, upper(it)))
|
text(14pt, align(center, upper(it)))
|
||||||
} else {
|
} else {
|
||||||
text(12pt, it)
|
text(12pt, it)
|
||||||
@ -120,12 +117,16 @@
|
|||||||
it
|
it
|
||||||
}
|
}
|
||||||
|
|
||||||
set figure(numbering: it => {
|
set figure(
|
||||||
let count = counter(heading).get()
|
numbering: it => {
|
||||||
numbering("1.1.", count.first(), it)
|
let count = counter(heading).get()
|
||||||
})
|
numbering("1.1.", count.first(), it)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
show figure: set block(breakable: true) // allow for tables to span to next pages mid sentence
|
show figure: set block(
|
||||||
|
breakable: true,
|
||||||
|
) // allow for tables to span to next pages mid sentence
|
||||||
show figure: set par(justify: false) // disable justify for figures (tables)
|
show figure: set par(justify: false) // disable justify for figures (tables)
|
||||||
show figure.caption: set align(end)
|
show figure.caption: set align(end)
|
||||||
show table.cell.where(y: 0): strong
|
show table.cell.where(y: 0): strong
|
||||||
@ -136,6 +137,7 @@
|
|||||||
|
|
||||||
show figure.where(kind: image): set figure(supplement: "att")
|
show figure.where(kind: image): set figure(supplement: "att")
|
||||||
show figure.caption.where(kind: image): set align(start)
|
show figure.caption.where(kind: image): set align(start)
|
||||||
|
show figure.caption: set block(sticky: true)
|
||||||
show figure.caption: set text(size: 11pt)
|
show figure.caption: set text(size: 11pt)
|
||||||
show figure.where(kind: image): set figure.caption(
|
show figure.where(kind: image): set figure.caption(
|
||||||
position: bottom,
|
position: bottom,
|
||||||
@ -266,7 +268,7 @@
|
|||||||
|
|
||||||
outline(
|
outline(
|
||||||
depth: 3,
|
depth: 3,
|
||||||
indent: indent,
|
indent: 1cm,
|
||||||
title: text(size: 14pt, outline-title),
|
title: text(size: 14pt, outline-title),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -278,12 +280,23 @@
|
|||||||
|
|
||||||
make-attachments(attachment-title, attachments)
|
make-attachments(attachment-title, attachments)
|
||||||
|
|
||||||
make-documentary-page(
|
if display-documentary {
|
||||||
title,
|
make-documentary-page(
|
||||||
authors,
|
if type(title) == content {
|
||||||
advisors,
|
title
|
||||||
reviewer,
|
.fields()
|
||||||
thesis-type,
|
.values()
|
||||||
date,
|
.at(0)
|
||||||
)
|
.filter(it => it.func() != linebreak and it != [ ])
|
||||||
|
.join(" ")
|
||||||
|
} else {
|
||||||
|
title
|
||||||
|
},
|
||||||
|
authors,
|
||||||
|
advisors,
|
||||||
|
reviewer,
|
||||||
|
thesis-type,
|
||||||
|
date,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
108
src/utils.typ
108
src/utils.typ
@ -60,14 +60,31 @@
|
|||||||
place,
|
place,
|
||||||
logo,
|
logo,
|
||||||
) = {
|
) = {
|
||||||
align(center, upper(text(size: 14pt, [
|
align(
|
||||||
#university\
|
center,
|
||||||
#faculty
|
upper(
|
||||||
])))
|
text(
|
||||||
|
size: 14pt,
|
||||||
|
[
|
||||||
|
#university\
|
||||||
|
#faculty
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
v(1fr)
|
v(1fr)
|
||||||
|
|
||||||
align(center, upper(text(16pt, weight: "bold", title)))
|
align(
|
||||||
|
center,
|
||||||
|
upper(
|
||||||
|
text(
|
||||||
|
16pt,
|
||||||
|
weight: "bold",
|
||||||
|
title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
v(0.2fr)
|
v(0.2fr)
|
||||||
|
|
||||||
@ -102,61 +119,50 @@
|
|||||||
reviewer,
|
reviewer,
|
||||||
thesis-type,
|
thesis-type,
|
||||||
date,
|
date,
|
||||||
) = {
|
) = [
|
||||||
let vspace = 1fr
|
#set page(numbering: none)
|
||||||
set page(numbering: none)
|
#let formatted-date = strong(date.display("[day].[month].[year]."))
|
||||||
|
|
||||||
let formatted-date = strong(date.display("[day].[month].[year]."))
|
#heading(level: 1, outlined: false, numbering: none, "Dokumentārā lapa")
|
||||||
|
|
||||||
heading(level: 1, outlined: false, numbering: none, "Dokumentārā lapa")
|
#set par(spacing: 2em)
|
||||||
[
|
|
||||||
#thesis-type "*#title*" ir
|
|
||||||
izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē,
|
|
||||||
Datorikas nodaļā.
|
|
||||||
|
|
||||||
#v(vspace / 3)
|
#thesis-type "*#title*" ir
|
||||||
Ar savu parakstu apliecinu, ka darbs izstrādāts patstāvīgi, izmantoti tikai tajā
|
izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē,
|
||||||
norādītie informācijas avoti un iesniegtā darba elektroniskā kopija atbilst
|
Datorikas nodaļā.
|
||||||
izdrukai un/vai recenzentam uzrādītajai darba versijai.
|
|
||||||
|
Ar savu parakstu apliecinu, ka darbs izstrādāts patstāvīgi, izmantoti tikai
|
||||||
|
tajā norādītie informācijas avoti un iesniegtā darba elektroniskā kopija
|
||||||
|
atbilst izdrukai un/vai recenzentam uzrādītajai darba versijai.
|
||||||
|
#set par(hanging-indent: 1cm)
|
||||||
|
|
||||||
|
#v(0.5fr)
|
||||||
|
|
||||||
|
#if authors.len() > 1 { "Autori: " } else { "Autors: " }
|
||||||
|
#(
|
||||||
|
authors.map(author => [*#author.name, #author.code*]).join(", ")
|
||||||
|
) ~ #formatted-date
|
||||||
|
|
||||||
|
#v(1fr)
|
||||||
|
Rekomendēju darbu aizstāvēšanai\
|
||||||
|
#if advisors.len() > 0 [
|
||||||
|
Darba #if advisors.len() > 1 { "vadītāji:" } else { "vadītājs:" }
|
||||||
|
#(
|
||||||
|
advisors.map(advisor => [*#advisor.title #advisor.name*]).join("\n")
|
||||||
|
) ~ #formatted-date
|
||||||
]
|
]
|
||||||
|
|
||||||
context {
|
#v(1fr)
|
||||||
set par(
|
|
||||||
first-line-indent: 1cm,
|
|
||||||
hanging-indent: 1cm,
|
|
||||||
)
|
|
||||||
|
|
||||||
v(vspace / 2)
|
Recenzents: *#reviewer.name*
|
||||||
|
|
||||||
[
|
#v(1fr)
|
||||||
#if authors.len() > 1 { "Autori: " } else { "Autors: " }
|
|
||||||
#authors.map(author => [*#author.name, #author.code*]).join(", ")
|
|
||||||
~ #formatted-date
|
|
||||||
]
|
|
||||||
|
|
||||||
v(vspace)
|
Darbs iesniegts #formatted-date \
|
||||||
[
|
#thesis-type.replace("darbs", "darbu") pārbaudīja komisijas sekretārs (elektronisks paraksts)
|
||||||
Rekomendēju darbu aizstāvēšanai\
|
|
||||||
#if advisors.len() > 0 [
|
|
||||||
Darba #if advisors.len() > 1 { "vadītāji:" } else { "vadītājs:" }
|
|
||||||
#advisors.map(advisor => [*#advisor.title #advisor.name*]).join("\n")
|
|
||||||
~ #formatted-date
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
v(vspace)
|
#v(1fr)
|
||||||
[Recenzents: *#reviewer.name*]
|
]
|
||||||
|
|
||||||
|
|
||||||
v(vspace)
|
|
||||||
[
|
|
||||||
Darbs iesniegts #formatted-date\
|
|
||||||
Kvalifikācijas darbu pārbaudījumu komisijas sekretārs (elektronisks paraksts)
|
|
||||||
]
|
|
||||||
|
|
||||||
v(vspace)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#let make-attachments(title, attachments) = {
|
#let make-attachments(title, attachments) = {
|
||||||
if attachments == () {
|
if attachments == () {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#import "@preview/solo-lu-df:0.1.1": *
|
#import "@preview/solo-lu-df:0.1.4": *
|
||||||
|
|
||||||
#show: ludf.with(
|
#show: ludf.with(
|
||||||
title: "Darba Nosaukums",
|
title: "Darba Nosaukums",
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "solo-lu-df"
|
name = "solo-lu-df"
|
||||||
version = "0.1.1"
|
version = "0.1.4"
|
||||||
entrypoint = "src/lib.typ"
|
entrypoint = "src/lib.typ"
|
||||||
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
||||||
license = "MIT"
|
license = "MIT-0"
|
||||||
description = "Write qualification papers, bachelor’s theses, and master’s theses for University of Latvia, Computer Science programme."
|
description = "Write qualification papers, bachelor’s theses, and master’s theses for University of Latvia, Computer Science programme."
|
||||||
repository = "https://github.com/kristoferssolo/LU-DF-Typst-Template"
|
repository = "https://github.com/kristoferssolo/LU-DF-Typst-Template"
|
||||||
keywords = [
|
keywords = [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user