mirror of
https://github.com/kristoferssolo/LU-DF-Typst-Template.git
synced 2026-02-04 06:22:05 +00:00
Compare commits
8 Commits
fe82dee5e4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
c97aaca839
|
|||
|
d05d91bdf4
|
|||
|
8338d90b17
|
|||
|
aec331a7aa
|
|||
|
9d5d4209bd
|
|||
|
102c63925e
|
|||
|
1b96f36217
|
|||
|
610ab2e7d0
|
10
README.md
10
README.md
@@ -32,10 +32,15 @@ configure the whole document and `attachment` helper function. Important argumen
|
|||||||
- `abstract`: A record with `primary` and `secondary` abstracts. Each has
|
- `abstract`: A record with `primary` and `secondary` abstracts. Each has
|
||||||
`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). All attachments must be referenced in the document body to appear in the outline.
|
||||||
|
- `outline-title`: Title for the table of contents. Defaults to `"Saturs"`.
|
||||||
|
- `attachment-title`: Title for the attachments section. Defaults to `"Pielikumi"`.
|
||||||
- `display-documentary`: Whether to display the documentary page at the end. Defaults to `true`.
|
- `display-documentary`: Whether to display the documentary page at the end. Defaults to `true`.
|
||||||
|
- `description`: Document description for PDF metadata. Defaults to `none`.
|
||||||
- Positional argument: the document body follows the `ludf.with(...)` call.
|
- Positional argument: the document body follows the `ludf.with(...)` call.
|
||||||
|
|
||||||
|
**Note:** The template automatically extracts keywords from both `primary` and `secondary` abstracts and sets them as PDF document metadata.
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
The template will initialize your package with a sample call to the `ludf`
|
The template will initialize your package with a sample call to the `ludf`
|
||||||
@@ -43,7 +48,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.4": *
|
#import "@preview/solo-lu-df:1.0.0": *
|
||||||
|
|
||||||
#show: ludf.with(
|
#show: ludf.with(
|
||||||
title: "Darba Nosaukums",
|
title: "Darba Nosaukums",
|
||||||
@@ -53,6 +58,7 @@ template, you can add a show rule like this at the top of your file:
|
|||||||
advisors: (
|
advisors: (
|
||||||
(title: "Mg. dat.", name: "Ivars Ozoliņš"),
|
(title: "Mg. dat.", name: "Ivars Ozoliņš"),
|
||||||
),
|
),
|
||||||
|
reviewer: (name: "Prof. Anna Liepa"),
|
||||||
date: datetime(year: 2025, month: 1, day: 1),
|
date: datetime(year: 2025, month: 1, day: 1),
|
||||||
place: "Rīga",
|
place: "Rīga",
|
||||||
bibliography: bibliography("bibliography.yml"),
|
bibliography: bibliography("bibliography.yml"),
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#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 "@preview/solo-lu-df:1.0.0": *
|
||||||
#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
|
#import "utils/diagrams.typ": data-store, dpd-database, dpd-edge, process
|
||||||
|
#import "utils/tables.typ": function-table
|
||||||
|
|
||||||
|
#import fletcher.shapes: cylinder, ellipse
|
||||||
|
#import table: cell, header
|
||||||
|
|
||||||
#show: ludf.with(
|
#show: ludf.with(
|
||||||
title: "Darba Nosaukums",
|
title: "Darba Nosaukums",
|
||||||
@@ -177,12 +179,12 @@ Funkciju sadalījums moduļos ir aprakstīts tabulā (@function-modules[tab.]).
|
|||||||
table(
|
table(
|
||||||
columns: (auto, 1fr, auto),
|
columns: (auto, 1fr, auto),
|
||||||
align: left,
|
align: left,
|
||||||
table.header([Modulis], [Funkcija], [Identifikators]),
|
header([Modulis], [Funkcija], [Identifikators]),
|
||||||
|
|
||||||
table.cell(rowspan: 1)[A modulis],
|
cell(rowspan: 1)[A modulis],
|
||||||
[A saskarne], [#link(<AF01>)[AF01]],
|
[A saskarne], [#link(<AF01>)[AF01]],
|
||||||
|
|
||||||
table.cell(rowspan: 2)[B modulis],
|
cell(rowspan: 2)[B modulis],
|
||||||
[B saskarne], [#link(<BF01>)[BF01]],
|
[B saskarne], [#link(<BF01>)[BF01]],
|
||||||
[B apstrāde], [#link(<BF02>)[BF02]],
|
[B apstrāde], [#link(<BF02>)[BF02]],
|
||||||
),
|
),
|
||||||
|
|||||||
32
src/lib.typ
32
src/lib.typ
@@ -48,10 +48,20 @@
|
|||||||
attachments: (),
|
attachments: (),
|
||||||
attachment-title: "Pielikumi",
|
attachment-title: "Pielikumi",
|
||||||
display-documentary: true,
|
display-documentary: true,
|
||||||
|
description: none,
|
||||||
body,
|
body,
|
||||||
) = {
|
) = {
|
||||||
// Set document metadata.
|
// Set document metadata.
|
||||||
set document(title: title, author: authors.map(author => author.name))
|
set document(
|
||||||
|
title: title,
|
||||||
|
author: authors.map(author => author.name),
|
||||||
|
keywords: abstract
|
||||||
|
.values()
|
||||||
|
.map(it => it.keywords)
|
||||||
|
.flatten()
|
||||||
|
.filter(it => it != none and it != ""),
|
||||||
|
description: description,
|
||||||
|
)
|
||||||
|
|
||||||
// Set the body font.
|
// Set the body font.
|
||||||
set text(
|
set text(
|
||||||
@@ -124,9 +134,7 @@
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
show figure: set block(
|
show figure: set block(breakable: true) // allow for tables to span to next pages mid sentence
|
||||||
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
|
||||||
@@ -233,6 +241,7 @@
|
|||||||
"JetBrains Mono",
|
"JetBrains Mono",
|
||||||
"Fira Code",
|
"Fira Code",
|
||||||
"TeX Gyre Cursor",
|
"TeX Gyre Cursor",
|
||||||
|
"DejaVu Sans Mono",
|
||||||
),
|
),
|
||||||
features: (calt: 0),
|
features: (calt: 0),
|
||||||
ligatures: false,
|
ligatures: false,
|
||||||
@@ -263,13 +272,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Table of contents.
|
// Table of contents.
|
||||||
// Uppercase 1st level headings in ToC
|
// Format attachment entries in outline
|
||||||
show outline.entry.where(level: 1): it => { upper(it) }
|
show outline.entry: it => {
|
||||||
|
let el = it.element
|
||||||
|
if el.func() == figure {
|
||||||
|
let num = numbering(el.numbering, ..el.counter.at(el.location()))
|
||||||
|
let pg = counter(page).at(el.location()).first()
|
||||||
|
return block[#link(
|
||||||
|
el.location(),
|
||||||
|
)[#num #el.supplement. #el.caption.body] #box(width: 1fr, it.fill) #pg]
|
||||||
|
}
|
||||||
|
it
|
||||||
|
}
|
||||||
|
|
||||||
outline(
|
outline(
|
||||||
depth: 3,
|
depth: 3,
|
||||||
indent: 1cm,
|
indent: 1cm,
|
||||||
title: text(size: 14pt, outline-title),
|
title: text(size: 14pt, outline-title),
|
||||||
|
target: selector(heading).or(figure.where(kind: "attachment")),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Display the paper's contents.
|
// Display the paper's contents.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#import "@preview/solo-lu-df:0.1.4": *
|
#import "@preview/solo-lu-df:1.0.0": *
|
||||||
|
|
||||||
#show: ludf.with(
|
#show: ludf.with(
|
||||||
title: "Darba Nosaukums",
|
title: "Darba Nosaukums",
|
||||||
@@ -69,6 +69,7 @@
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
description: [Some random document description that will be wisible in the metadata],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "solo-lu-df"
|
name = "solo-lu-df"
|
||||||
version = "0.1.4"
|
version = "1.0.0"
|
||||||
entrypoint = "src/lib.typ"
|
entrypoint = "src/lib.typ"
|
||||||
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
||||||
license = "MIT-0"
|
license = "MIT-0"
|
||||||
@@ -16,7 +16,7 @@ keywords = [
|
|||||||
]
|
]
|
||||||
categories = ["paper"]
|
categories = ["paper"]
|
||||||
disciplines = ["computer-science"]
|
disciplines = ["computer-science"]
|
||||||
compiler = "0.13.0"
|
compiler = "0.14.0"
|
||||||
exclude = []
|
exclude = []
|
||||||
|
|
||||||
[template]
|
[template]
|
||||||
|
|||||||
Reference in New Issue
Block a user