3 Commits

Author SHA1 Message Date
8a76ee9e1e update documentation 2025-10-02 20:57:37 +02:00
d954a0e687 classic template fixes 2025-10-02 20:57:22 +02:00
eba0ec7826 add image and table listings 2025-10-02 20:39:26 +02:00
5 changed files with 131 additions and 14 deletions

View File

@@ -191,6 +191,34 @@ Tady je praktická ukázka jednoduchého vložení obrázku s popiskem:
Logo *TUL*
])
Obrázky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje).
== Tabulky
Tabulky lze vytvářet takto:
```typst
#figure(table(
columns: 3,
table.header([], [*Sloupec 1*], [*Sloupec 2*]),
[*Řádek 1*], [a], [b],
[*Řádek 2*], [c], [d],
), caption: "Moje krásná tabulka")
```
#highlight[Hlavičku tabulky (první řádek) je dobré zabalit do funkce header (viz. výše)], to je
kvůli tomu, že Typst do vygenerovaného PDF souboru poté přidá metadata (například pro osoby se
zrakovým postižením).
#figure(table(
columns: 3,
table.header([], [*Sloupec 1*], [*Sloupec 2*]),
[*Řádek 1*], [a], [b],
[*Řádek 2*], [c], [d],
), caption: "Moje krásná tabulka")
Tabulky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje).
== Citace
Šablona podporuje správu citací pomocí standardního BibTeX @bibtex souboru, stejně jako
@@ -300,7 +328,7 @@ Zvýrazněné hodnoty jsou základní -- pokud vynecháte parametr, pak bude pou
- Ve formátu `(<zkratka_jazyka>: "<nadpis>")`, například `(cs: "Můj nadpis")`
#line()
- `author` (autor/autoři dokumentu)
- Příklad: `"Pavel Novák"` nebo `"Petra Velká, Jindřich Peterka"` (oddělujte jména `", "`)
- Příklad: `"Pavel Novák"` nebo `"Petra Velká, Jindřich Peterka"`
#line()
- `author_gender` (rod autora v českém jazyce - není potřeba pro angličtinu)
- `"masculine"` - Mužský rod
@@ -311,13 +339,13 @@ Zvýrazněné hodnoty jsou základní -- pokud vynecháte parametr, pak bude pou
- Příklad: `"prof. Jindřich Jindřich"`
#line()
- `programme` (studijní program autora)
- Příklad: `"4242 - Odborná tvorba a zpracování krásných šablon"`
- Ve formátu `(<zkratka_jazyka>: "<název_programu>")`
#line()
- `abstract` (abstrakt)
- Ve formátu `(<zkratka_jazyka>: [<abstrakt>])`, například `(cs: [Můj *krásný* abstrakt.])`
#line()
- `keywords` (klíčová slova zobrazovaná pod abstraktem)
- Ve formátu `("slovo1", "slovo2", ...)`
- Ve formátu `(<zkratka_jazyka>: ("slovo1", "slovo2", ...))`
#line()
- `assignment` (PDF soubor se zadáním)
- Ve formě cesty k souboru, například: `"zadani.pdf"`. Pokud je tento argument vynechán, bude

View File

@@ -7,6 +7,8 @@
abstract,
toc,
abbrlist,
imagelist,
tablelist,
bibliogr
)
#import "../utils.typ": is_none, assert_dict_has, assert_not_none
@@ -47,6 +49,8 @@
abstract("en", title, abstract_content, keywords);
toc(language);
abbrlist(language);
imagelist(language);
tablelist(language);
content
bibliogr(language, citation_file);
});

View File

@@ -7,6 +7,11 @@
#let serif_font = "Merriweather";
#let tul_logomark_size = 6.5em;
// COUNTERS
#let image_count = counter("image_count");
#let table_count = counter("table_count");
// TYPST ELEMENT STYLING
#let default_styling(flip_bonding, faculty_color, content) = {
@@ -32,6 +37,19 @@
set text(font: serif_font);
set par(justify: true);
// figures
let figure_numbering(realcount, c) = {
context realcount.step();
context numbering("1. 1", counter(heading).get().at(0), c)
};
show figure.where(kind: image): set figure(numbering: figure_numbering.with(image_count));
show figure.where(kind: table): set figure(numbering: figure_numbering.with(table_count));
show figure.where(kind: table): set figure.caption(position: top);
show figure: it => {
block(it, above: 2em, below: 2em);
}
set image(width: 80%);
// heading
set heading(numbering: "1.1.1 ");
show heading: it => {
@@ -43,6 +61,10 @@
);
};
show heading.where(level: 1): it => {
// reset figure counters
context counter(figure.where(kind: image)).update(0);
context counter(figure.where(kind: table)).update(0);
pagebreak(weak: true);
v(2cm);
it
@@ -54,7 +76,6 @@
block(it, fill: rgb("#eee"), inset: 1em)
};
set highlight(fill: faculty_color.lighten(90%));
set image(width: 80%);
content
}
@@ -111,13 +132,13 @@
}), info_name_min_width.to-absolute());
grid(
columns: 2,
rows: (auto, 1.2em),
gutter: .5em,
..info_fields.filter((v) => { type(v.at(1)) != type(none) }).map((v) => {
(
block(
align(top, block(
text(get_lang_item(language, v.at(0)) + ":", style: "italic", font: base_font),
width: max_field_name_width + info_name_value_padding,
),
width: max_field_name_width + info_name_value_padding
)),
text(v.at(1), font: base_font, weight: if v.at(2) { "bold" } else { "regular" })
)
}).flatten(),
@@ -218,6 +239,59 @@
}
}
// _ OUTLINE
#let _outline_figure_inner(selector, title, body_mapper) = {
show outline.entry: it => {
link(
it.element.location(),
grid(
columns: 3,
gutter: .5em,
stack(
dir: ltr,
text(numbering(
"1. 1",
counter(heading).at(it.element.location()).at(0),
counter(selector).at(it.element.location()).at(0),
)),
h(.5em),
text(body_mapper(it)),
),
box(repeat([.], gap: 0.15em)),
str(it.element.location().page()),
),
)
}
if not is_none(selector) {
outline(target: selector, title: title);
} else {
outline(title: title);
}
}
// _ FIGURE OUTLINE
#let _figure_outline(realcount, target, title) = {
context {
if realcount.final().at(0) == 0 {
return;
}
_outline_figure_inner(figure.where(kind: target), title, (it) => it.element.caption.body);
}
}
// IMAGE LIST
#let imagelist(language) = {
_figure_outline(image_count, image, get_lang_item(language, "image_list"));
}
// TABLE LIST
#let tablelist(language) = {
_figure_outline(table_count, table, get_lang_item(language, "table_list"));
}
// ABBREVIATION LIST
#let abbrlist(language) = {

View File

@@ -1,5 +1,15 @@
#import "../lang.typ": get_lang_item
#import "common.typ": mainpage, default_styling, assignment, disclaimer, abstract, toc, abbrlist
#import "common.typ": (
mainpage,
default_styling,
assignment,
disclaimer,
abstract,
toc,
abbrlist,
imagelist,
tablelist,
)
#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr
#let other(
@@ -18,7 +28,8 @@
default_styling(true, faculty_color, {
toc(language);
abbrlist(language);
imagelist(language);
tablelist(language);
pagebreak(to: "even", weak: true);
content

View File

@@ -7,8 +7,6 @@
"study_branch": "Studijní obor",
"bp": "Bakalářská práce",
"dp": "Diplomová práce",
"dis": "Disertační práce",
"city": "Liberec",
@@ -39,6 +37,8 @@
"abstract": "Abstrakt",
"keywords": "Klíčová slova",
"abbrs": "Seznam zkratek",
"image_list": "Seznam obrázků",
"table_list": "Seznam tabulek",
"place_assignment": "Sem vložte zadání"
},
@@ -51,8 +51,6 @@
"study_branch": "Study branch",
"bp": "Bachelor thesis",
"dp": "Diploma thesis",
"dis": "Dissertation thesis",
"city": "Liberec",
@@ -72,6 +70,8 @@
"abstract": "Abstract",
"keywords": "Keywords",
"abbrs": "List of abbreviations",
"image_list": "List of images",
"table_list": "List of tables",
"place_assignment": "Insert your assignment here"
}