mirror of
https://github.com/kristoferssolo/LU-DF-Typst-Template.git
synced 2025-12-30 21:31:36 +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`.
|
||||
- `bibliography`: Result of `bibliography("path/to/file.yml")` or `none`.
|
||||
- `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.
|
||||
|
||||
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:
|
||||
|
||||
```typst
|
||||
#import "@preview/solo-lu-df:0.1.1": *
|
||||
#import "@preview/solo-lu-df:0.1.4": *
|
||||
|
||||
#show: ludf.with(
|
||||
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),
|
||||
[Column 1], [Column 2],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
// Your content goes below.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node
|
||||
#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/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,
|
||||
)
|
||||
|
||||
#let indent = 1cm
|
||||
|
||||
#let attachment(caption: none, label: none, body) = {
|
||||
(
|
||||
content: body,
|
||||
@ -49,6 +47,7 @@
|
||||
outline-title: "Saturs",
|
||||
attachments: (),
|
||||
attachment-title: "Pielikumi",
|
||||
display-documentary: true,
|
||||
body,
|
||||
) = {
|
||||
// Set document metadata.
|
||||
@ -72,16 +71,14 @@
|
||||
paper: "a4",
|
||||
)
|
||||
|
||||
|
||||
// Main body.
|
||||
set par(
|
||||
justify: true,
|
||||
leading: 1.5em,
|
||||
spacing: 1.5em,
|
||||
first-line-indent: (amount: indent, all: true),
|
||||
leading: 0.65em * 1.5,
|
||||
spacing: 0.65em * 1.5,
|
||||
first-line-indent: (amount: 1cm, all: true),
|
||||
)
|
||||
|
||||
|
||||
// Configure equation numbering and spacing.
|
||||
set math.equation(numbering: "(1)")
|
||||
show math.equation: set block(spacing: 0.65em)
|
||||
@ -95,10 +92,10 @@
|
||||
|
||||
// Headings
|
||||
set heading(numbering: "1.1.")
|
||||
show heading: set block(spacing: 2em)
|
||||
show heading: set block(spacing: 0.65em * 2, sticky: true)
|
||||
show heading: it => {
|
||||
if it.level == 1 {
|
||||
pagebreak(weak: true)
|
||||
pagebreak()
|
||||
text(14pt, align(center, upper(it)))
|
||||
} else {
|
||||
text(12pt, it)
|
||||
@ -120,12 +117,16 @@
|
||||
it
|
||||
}
|
||||
|
||||
set figure(numbering: it => {
|
||||
let count = counter(heading).get()
|
||||
numbering("1.1.", count.first(), it)
|
||||
})
|
||||
set figure(
|
||||
numbering: 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.caption: set align(end)
|
||||
show table.cell.where(y: 0): strong
|
||||
@ -136,6 +137,7 @@
|
||||
|
||||
show figure.where(kind: image): set figure(supplement: "att")
|
||||
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.where(kind: image): set figure.caption(
|
||||
position: bottom,
|
||||
@ -266,7 +268,7 @@
|
||||
|
||||
outline(
|
||||
depth: 3,
|
||||
indent: indent,
|
||||
indent: 1cm,
|
||||
title: text(size: 14pt, outline-title),
|
||||
)
|
||||
|
||||
@ -278,12 +280,23 @@
|
||||
|
||||
make-attachments(attachment-title, attachments)
|
||||
|
||||
make-documentary-page(
|
||||
title,
|
||||
authors,
|
||||
advisors,
|
||||
reviewer,
|
||||
thesis-type,
|
||||
date,
|
||||
)
|
||||
if display-documentary {
|
||||
make-documentary-page(
|
||||
if type(title) == content {
|
||||
title
|
||||
.fields()
|
||||
.values()
|
||||
.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,
|
||||
logo,
|
||||
) = {
|
||||
align(center, upper(text(size: 14pt, [
|
||||
#university\
|
||||
#faculty
|
||||
])))
|
||||
align(
|
||||
center,
|
||||
upper(
|
||||
text(
|
||||
size: 14pt,
|
||||
[
|
||||
#university\
|
||||
#faculty
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
v(1fr)
|
||||
|
||||
align(center, upper(text(16pt, weight: "bold", title)))
|
||||
align(
|
||||
center,
|
||||
upper(
|
||||
text(
|
||||
16pt,
|
||||
weight: "bold",
|
||||
title,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
v(0.2fr)
|
||||
|
||||
@ -102,61 +119,50 @@
|
||||
reviewer,
|
||||
thesis-type,
|
||||
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")
|
||||
[
|
||||
#thesis-type "*#title*" ir
|
||||
izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē,
|
||||
Datorikas nodaļā.
|
||||
#set par(spacing: 2em)
|
||||
|
||||
#v(vspace / 3)
|
||||
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.
|
||||
#thesis-type "*#title*" ir
|
||||
izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē,
|
||||
Datorikas nodaļā.
|
||||
|
||||
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 {
|
||||
set par(
|
||||
first-line-indent: 1cm,
|
||||
hanging-indent: 1cm,
|
||||
)
|
||||
#v(1fr)
|
||||
|
||||
v(vspace / 2)
|
||||
Recenzents: *#reviewer.name*
|
||||
|
||||
[
|
||||
#if authors.len() > 1 { "Autori: " } else { "Autors: " }
|
||||
#authors.map(author => [*#author.name, #author.code*]).join(", ")
|
||||
~ #formatted-date
|
||||
]
|
||||
#v(1fr)
|
||||
|
||||
v(vspace)
|
||||
[
|
||||
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
|
||||
]
|
||||
]
|
||||
Darbs iesniegts #formatted-date \
|
||||
#thesis-type.replace("darbs", "darbu") pārbaudīja komisijas sekretārs (elektronisks paraksts)
|
||||
|
||||
v(vspace)
|
||||
[Recenzents: *#reviewer.name*]
|
||||
|
||||
|
||||
v(vspace)
|
||||
[
|
||||
Darbs iesniegts #formatted-date\
|
||||
Kvalifikācijas darbu pārbaudījumu komisijas sekretārs (elektronisks paraksts)
|
||||
]
|
||||
|
||||
v(vspace)
|
||||
}
|
||||
}
|
||||
#v(1fr)
|
||||
]
|
||||
|
||||
#let make-attachments(title, 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(
|
||||
title: "Darba Nosaukums",
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
[package]
|
||||
name = "solo-lu-df"
|
||||
version = "0.1.1"
|
||||
version = "0.1.4"
|
||||
entrypoint = "src/lib.typ"
|
||||
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."
|
||||
repository = "https://github.com/kristoferssolo/LU-DF-Typst-Template"
|
||||
keywords = [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user