Compare commits

..

9 Commits

Author SHA1 Message Date
fe82dee5e4
refactor: documentary page 2025-12-12 03:00:22 +02:00
a5e6f289cc
chore: bump version number 2025-12-12 02:58:14 +02:00
e9dbdea5f1
fix: paragraph spacing 2025-12-12 02:53:23 +02:00
ec3fe8e51d
chore: fix package version in readme 2025-11-21 17:31:53 +02:00
a05dbee1fb
feat: add display-documentary parameter
Add `display-documentary` parameter determine if documentary page should
be displayed or not.
2025-11-21 17:29:26 +02:00
54f7a8cef8
feat: add sticky captions and heading 2025-11-03 16:14:18 +02:00
3dd154a517
chore: bump version numbers 2025-11-03 12:00:21 +02:00
c2e78f8511
fix(documentary-page): typo 2025-11-03 11:47:28 +02:00
6f44f1b0d8
fix(documentary-page): linebreak in title 2025-11-03 11:31:51 +02:00
6 changed files with 101 additions and 80 deletions

View File

@ -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.

View File

@ -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

View File

@ -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(
numbering: it => {
let count = counter(heading).get() let count = counter(heading).get()
numbering("1.1.", count.first(), it) 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)
if display-documentary {
make-documentary-page( make-documentary-page(
title, if type(title) == content {
title
.fields()
.values()
.at(0)
.filter(it => it.func() != linebreak and it != [ ])
.join(" ")
} else {
title
},
authors, authors,
advisors, advisors,
reviewer, reviewer,
thesis-type, thesis-type,
date, date,
) )
}
} }

View File

@ -60,14 +60,31 @@
place, place,
logo, logo,
) = { ) = {
align(center, upper(text(size: 14pt, [ align(
center,
upper(
text(
size: 14pt,
[
#university\ #university\
#faculty #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")
#set par(spacing: 2em)
heading(level: 1, outlined: false, numbering: none, "Dokumentārā lapa")
[
#thesis-type "*#title*" ir #thesis-type "*#title*" ir
izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē, izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē,
Datorikas nodaļā. Datorikas nodaļā.
#v(vspace / 3) Ar savu parakstu apliecinu, ka darbs izstrādāts patstāvīgi, izmantoti tikai
Ar savu parakstu apliecinu, ka darbs izstrādāts patstāvīgi, izmantoti tikai tajā tajā norādītie informācijas avoti un iesniegtā darba elektroniskā kopija
norādītie informācijas avoti un iesniegtā darba elektroniskā kopija atbilst atbilst izdrukai un/vai recenzentam uzrādītajai darba versijai.
izdrukai un/vai recenzentam uzrādītajai darba versijai. #set par(hanging-indent: 1cm)
]
context { #v(0.5fr)
set par(
first-line-indent: 1cm,
hanging-indent: 1cm,
)
v(vspace / 2)
[
#if authors.len() > 1 { "Autori: " } else { "Autors: " } #if authors.len() > 1 { "Autori: " } else { "Autors: " }
#authors.map(author => [*#author.name, #author.code*]).join(", ") #(
~ #formatted-date authors.map(author => [*#author.name, #author.code*]).join(", ")
] ) ~ #formatted-date
v(vspace) #v(1fr)
[
Rekomendēju darbu aizstāvēšanai\ Rekomendēju darbu aizstāvēšanai\
#if advisors.len() > 0 [ #if advisors.len() > 0 [
Darba #if advisors.len() > 1 { "vadītāji:" } else { "vadītājs:" } Darba #if advisors.len() > 1 { "vadītāji:" } else { "vadītājs:" }
#advisors.map(advisor => [*#advisor.title #advisor.name*]).join("\n") #(
~ #formatted-date advisors.map(advisor => [*#advisor.title #advisor.name*]).join("\n")
] ) ~ #formatted-date
] ]
v(vspace) #v(1fr)
[Recenzents: *#reviewer.name*]
Recenzents: *#reviewer.name*
v(vspace) #v(1fr)
[
Darbs iesniegts #formatted-date\
Kvalifikācijas darbu pārbaudījumu komisijas sekretārs (elektronisks paraksts)
]
v(vspace) Darbs iesniegts #formatted-date \
} #thesis-type.replace("darbs", "darbu") pārbaudīja komisijas sekretārs (elektronisks paraksts)
}
#v(1fr)
]
#let make-attachments(title, attachments) = { #let make-attachments(title, attachments) = {
if attachments == () { if attachments == () {

View File

@ -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",

View File

@ -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, bachelors theses, and masters theses for University of Latvia, Computer Science programme." description = "Write qualification papers, bachelors theses, and masters 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 = [