Compare commits

...

8 Commits

5 changed files with 46 additions and 17 deletions

View File

@@ -32,10 +32,15 @@ configure the whole document and `attachment` helper function. Important argumen
- `abstract`: A record with `primary` and `secondary` abstracts. Each has
`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).
- `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`.
- `description`: Document description for PDF metadata. Defaults to `none`.
- 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 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:
```typst
#import "@preview/solo-lu-df:0.1.4": *
#import "@preview/solo-lu-df:1.0.0": *
#show: ludf.with(
title: "Darba Nosaukums",
@@ -53,6 +58,7 @@ template, you can add a show rule like this at the top of your file:
advisors: (
(title: "Mg. dat.", name: "Ivars Ozoliņš"),
),
reviewer: (name: "Prof. Anna Liepa"),
date: datetime(year: 2025, month: 1, day: 1),
place: "Rīga",
bibliography: bibliography("bibliography.yml"),

View File

@@ -1,8 +1,10 @@
#import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node
#import fletcher.shapes: cylinder, ellipse
#import "@preview/solo-lu-df:0.1.4": *
#import "utils/tables.typ": function-table
#import "@preview/solo-lu-df:1.0.0": *
#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(
title: "Darba Nosaukums",
@@ -177,12 +179,12 @@ Funkciju sadalījums moduļos ir aprakstīts tabulā (@function-modules[tab.]).
table(
columns: (auto, 1fr, auto),
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]],
table.cell(rowspan: 2)[B modulis],
cell(rowspan: 2)[B modulis],
[B saskarne], [#link(<BF01>)[BF01]],
[B apstrāde], [#link(<BF02>)[BF02]],
),

View File

@@ -48,10 +48,20 @@
attachments: (),
attachment-title: "Pielikumi",
display-documentary: true,
description: none,
body,
) = {
// 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 text(
@@ -124,9 +134,7 @@
},
)
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
@@ -233,6 +241,7 @@
"JetBrains Mono",
"Fira Code",
"TeX Gyre Cursor",
"DejaVu Sans Mono",
),
features: (calt: 0),
ligatures: false,
@@ -263,13 +272,24 @@
}
// Table of contents.
// Uppercase 1st level headings in ToC
show outline.entry.where(level: 1): it => { upper(it) }
// Format attachment entries in outline
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(
depth: 3,
indent: 1cm,
title: text(size: 14pt, outline-title),
target: selector(heading).or(figure.where(kind: "attachment")),
)
// Display the paper's contents.

View File

@@ -1,4 +1,4 @@
#import "@preview/solo-lu-df:0.1.4": *
#import "@preview/solo-lu-df:1.0.0": *
#show: ludf.with(
title: "Darba Nosaukums",
@@ -69,6 +69,7 @@
),
),
),
description: [Some random document description that will be wisible in the metadata],
)

View File

@@ -1,6 +1,6 @@
[package]
name = "solo-lu-df"
version = "0.1.4"
version = "1.0.0"
entrypoint = "src/lib.typ"
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
license = "MIT-0"
@@ -16,7 +16,7 @@ keywords = [
]
categories = ["paper"]
disciplines = ["computer-science"]
compiler = "0.13.0"
compiler = "0.14.0"
exclude = []
[template]