add presentation base
This commit is contained in:
3
Makefile
3
Makefile
@@ -108,6 +108,9 @@ $(BUILD_DIR)/documentation.pdf: documentation.typ $(TEMPLATE_SRCS) | $(BUILD_DIR
|
||||
|
||||
# == THESES EXAMPLES ==
|
||||
|
||||
$(BUILD_DIR)/presentation_%.typ: theses/presentation_%.typ | $(BUILD_DIR)
|
||||
ln -f $< $@
|
||||
|
||||
$(BUILD_DIR)/subs_%.txt: theses/%.typ | $(BUILD_DIR)
|
||||
awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' $< > $@
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
),
|
||||
acknowledgement: "dictionary[string : string | content] | none",
|
||||
assignment: "dictionary[string : any] | content | string | none",
|
||||
presentation_info: "dictionary[string: any] | none",
|
||||
citations: "string",
|
||||
);
|
||||
|
||||
@@ -36,6 +37,10 @@
|
||||
content: "content",
|
||||
);
|
||||
|
||||
#let presentation_structure = (
|
||||
append_thanks: "boolean",
|
||||
)
|
||||
|
||||
|
||||
#let check_arguments(args, structure: arguments_structure, namespace: none) = {
|
||||
let check_arguments_dict(structure, args, argument_path) = {
|
||||
@@ -137,6 +142,13 @@
|
||||
assignment
|
||||
}
|
||||
|
||||
#let presentation_info(presentation) = {
|
||||
if not is_none(presentation) {
|
||||
check_arguments(presentation, structure: presentation_structure, namespace: "presentation")
|
||||
}
|
||||
presentation
|
||||
}
|
||||
|
||||
#let arguments(
|
||||
document_info,
|
||||
title_pages,
|
||||
@@ -146,6 +158,7 @@
|
||||
abstract_info,
|
||||
acknowledgement,
|
||||
assignment,
|
||||
presentation,
|
||||
citations,
|
||||
) = {
|
||||
(
|
||||
@@ -157,6 +170,7 @@
|
||||
abstract: abstract_info,
|
||||
acknowledgement: acknowledgement,
|
||||
assignment: assignment_info(assignment),
|
||||
presentation_info: presentation_info(presentation),
|
||||
citations: citations,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,16 +12,18 @@
|
||||
#import "sp.typ": sp
|
||||
#import "other.typ": other_title_page, other_base
|
||||
#import "thesis_base.typ": thesis_base, thesis_base_title_pages
|
||||
#import "presentation.typ": presentation
|
||||
|
||||
#let document_types = (
|
||||
"bp": (bp, thesis_base, thesis_base_title_pages),
|
||||
"dp": (dp, thesis_base, thesis_base_title_pages),
|
||||
"prj": (prj, thesis_base, thesis_base_title_pages),
|
||||
"sp": (sp, thesis_base.with(
|
||||
"bp": (root: bp, base: thesis_base, title_pages: thesis_base_title_pages),
|
||||
"dp": (root: dp, base: thesis_base, title_pages: thesis_base_title_pages),
|
||||
"prj": (root: prj, base: thesis_base, title_pages: thesis_base_title_pages),
|
||||
"sp": (root: sp, base: thesis_base.with(
|
||||
show_disclaimer: false,
|
||||
require_abstract: false,
|
||||
), thesis_base_title_pages),
|
||||
"other": (other_title_page, other_base, (args) => {}),
|
||||
), title_pages: thesis_base_title_pages),
|
||||
"other": (root: other_title_page, base: other_base),
|
||||
"presentation": (base: presentation,),
|
||||
)
|
||||
|
||||
#let prep_args(args) = {
|
||||
@@ -54,18 +56,31 @@
|
||||
#let template_classic(args, content) = {
|
||||
let args = prep_args(args);
|
||||
|
||||
if not is_none(get_arg(args, "title_pages")) {
|
||||
external_title_pages(req_arg(args, "title_pages"));
|
||||
document_types.at(req_arg(args, "document.type")).at(1)(args, content);
|
||||
let doctype = req_arg(args, "document.type");
|
||||
let doc = document_types.at(doctype);
|
||||
if "root" in doc {
|
||||
if not is_none(get_arg(args, "title_pages")) {
|
||||
external_title_pages(req_arg(args, "title_pages"));
|
||||
doc.at("base")(args, content);
|
||||
} else {
|
||||
doc.at("root")(args);
|
||||
doc.at("base")(args, content);
|
||||
}
|
||||
} else {
|
||||
document_types.at(req_arg(args, "document.type")).at(0)(args);
|
||||
document_types.at(req_arg(args, "document.type")).at(1)(args, content);
|
||||
doc.at("base")(args, content);
|
||||
}
|
||||
}
|
||||
|
||||
#let title_pages_classic(args) = {
|
||||
let args = prep_args(args);
|
||||
|
||||
document_types.at(req_arg(args, "document.type")).at(0)(args);
|
||||
document_types.at(req_arg(args, "document.type")).at(2)(args);
|
||||
let doctype = req_arg(args, "document.type");
|
||||
let doc = document_types.at(doctype);
|
||||
if "title_pages" in doc {
|
||||
doc.at("root")(args);
|
||||
doc.at("title_pages")(args);
|
||||
} else {
|
||||
let panic_message = "document of type '" + doctype + "' can't generate title pages";
|
||||
panic(panic_message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#let base_font = "Inter";
|
||||
#let mono_font = "Noto Sans Mono";
|
||||
#let serif_font = "Merriweather";
|
||||
#let tul_logomark_size = 6.5em;
|
||||
|
||||
// COUNTERS
|
||||
|
||||
@@ -15,25 +14,7 @@
|
||||
|
||||
// TYPST ELEMENT STYLING
|
||||
|
||||
#let default_styling(flip_bonding, faculty_color, content, language) = {
|
||||
// page
|
||||
set page(
|
||||
margin: if flip_bonding {
|
||||
(inside: 4cm, top: 3cm, bottom: 3cm)
|
||||
} else {
|
||||
(left: 4cm, top: 3cm, bottom: 3cm)
|
||||
},
|
||||
numbering: "1", footer: {
|
||||
context {
|
||||
let page = counter(page).get().at(0);
|
||||
if flip_bonding {
|
||||
align(str(page), if calc.rem(page, 2) == 1 { right } else { left });
|
||||
} else {
|
||||
align(str(page), right);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
#let common_styling(faculty_color, language, content) = {
|
||||
// text
|
||||
set text(font: base_font);
|
||||
set par(justify: true);
|
||||
@@ -41,45 +22,11 @@
|
||||
content = set_czech_nonbreakable_terms(content);
|
||||
}
|
||||
|
||||
// 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 ");
|
||||
// headings
|
||||
show heading: it => {
|
||||
set par(justify: false);
|
||||
block(
|
||||
above: 2em,
|
||||
below: 2em,
|
||||
text(it, faculty_color, font: "TUL Mono", size: 1.2em)
|
||||
);
|
||||
text(it, faculty_color, font: "TUL Mono", size: 1.2em)
|
||||
};
|
||||
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
|
||||
};
|
||||
show heading.where(): it => {
|
||||
if it.level > 3 {
|
||||
panic("maximum allowed heading level is 3");
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
// other
|
||||
show raw.where(block: false): set text(font: mono_font, size: 1.25em);
|
||||
@@ -100,12 +47,70 @@
|
||||
content
|
||||
}
|
||||
|
||||
#let default_styling(flip_bonding, faculty_color, content, language) = {
|
||||
// page
|
||||
set page(
|
||||
margin: if flip_bonding {
|
||||
(inside: 4cm, top: 3cm, bottom: 3cm)
|
||||
} else {
|
||||
(left: 4cm, top: 3cm, bottom: 3cm)
|
||||
},
|
||||
numbering: "1", footer: {
|
||||
context {
|
||||
let page = counter(page).get().at(0);
|
||||
if flip_bonding {
|
||||
align(str(page), if calc.rem(page, 2) == 1 { right } else { left });
|
||||
} else {
|
||||
align(str(page), right);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 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.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);
|
||||
block(
|
||||
above: 2em,
|
||||
below: 2em,
|
||||
it,
|
||||
);
|
||||
};
|
||||
show heading.where(): it => {
|
||||
if it.level > 3 {
|
||||
panic("maximum allowed heading level is 3");
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
common_styling(faculty_color, language, content);
|
||||
}
|
||||
|
||||
|
||||
#let header(faculty_id, language) = {
|
||||
let logotype = faculty_logotype(faculty_id, language);
|
||||
grid(
|
||||
block(logotype, width: 100%),
|
||||
block(align(right, block(tul_logomark(faculty_id), height: tul_logomark_size))),
|
||||
block(align(right, tul_logomark(faculty_id))),
|
||||
columns: 2
|
||||
);
|
||||
}
|
||||
|
||||
98
template/classic/presentation.typ
Normal file
98
template/classic/presentation.typ
Normal file
@@ -0,0 +1,98 @@
|
||||
#import "../arguments.typ": req_arg
|
||||
#import "../utils.typ": assert_dict_has, is_none
|
||||
#import "../theme.typ": faculty_color, faculty_logotype, faculty_logotype_text, tul_logomark
|
||||
#import "../lang.typ": get_lang_item
|
||||
#import "common.typ": common_styling, bibliogr, base_font
|
||||
|
||||
#let paper = "presentation-4-3"
|
||||
|
||||
#let set_page_style(lang, faculty, faculty_color, content) = {
|
||||
context {
|
||||
let footer_margin = 20pt
|
||||
let footer_logotype = faculty_logotype(faculty, lang)
|
||||
let footer_height = measure(footer_logotype).height + footer_margin
|
||||
set page(paper: paper, margin: (bottom: footer_height, rest: 1cm), footer-descent: 0%, footer: {
|
||||
box(outset: (top: footer_margin, bottom: footer_margin), {
|
||||
footer_logotype
|
||||
h(1fr)
|
||||
context text(
|
||||
str(counter(page).get().at(0)) + " / " + str(counter(page).final().at(0)),
|
||||
font: "TUL Mono",
|
||||
faculty_color,
|
||||
)
|
||||
})
|
||||
})
|
||||
content
|
||||
}
|
||||
}
|
||||
|
||||
#let set_heading_styles(content) = {
|
||||
show heading.where(level: 1): it => {
|
||||
pagebreak(weak: true)
|
||||
box(text(it, size: 1.25em), inset: (top: 2em, bottom: 2em))
|
||||
}
|
||||
content
|
||||
}
|
||||
|
||||
#let apply_style(language, faculty, faculty_color, content) = {
|
||||
common_styling(
|
||||
faculty_color, language,
|
||||
set_page_style(language, faculty, faculty_color, set_heading_styles(content))
|
||||
)
|
||||
}
|
||||
|
||||
#let fullpage(language, faculty, faculty_color, content) = {
|
||||
page(
|
||||
background: rect(fill: faculty_color, width: 100%, height: 100%), paper: paper, margin: 1cm,
|
||||
{
|
||||
grid(
|
||||
columns: 3,
|
||||
faculty_logotype(faculty, language, color: white),
|
||||
h(1fr),
|
||||
tul_logomark(faculty, color: white),
|
||||
)
|
||||
content
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
#let signedpage(language, faculty, faculty_color, author, content) = {
|
||||
fullpage(language, faculty, faculty_color, {
|
||||
content
|
||||
place(center + bottom, text(author, white.transparentize(30%), size: 1.25em, font: base_font))
|
||||
})
|
||||
}
|
||||
|
||||
#let mainpage(language, faculty, faculty_color, title, author) = {
|
||||
signedpage(language, faculty, faculty_color, author, {
|
||||
place(center + horizon, text(title, size: 2em, font: "TUL Mono", white))
|
||||
})
|
||||
}
|
||||
|
||||
#let thankspage(language, faculty, faculty_color, author) = {
|
||||
signedpage(language, faculty, faculty_color, author, {
|
||||
place(center + horizon, text(
|
||||
get_lang_item(language, "thanks_for_attention"), size: 2em, font: "TUL Mono", white
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
#let presentation(args, content) = {
|
||||
let language = req_arg(args, "document.language")
|
||||
let faculty = req_arg(args, "document.faculty")
|
||||
let faculty_color = faculty_color(faculty)
|
||||
let presentation_args = req_arg(args, "presentation_info")
|
||||
let author = req_arg(args, "author.name")
|
||||
|
||||
mainpage(
|
||||
language, faculty, faculty_color,
|
||||
req_arg(args, "title").at(language), author,
|
||||
)
|
||||
apply_style(language, faculty, faculty_color, {
|
||||
content
|
||||
bibliogr(args)
|
||||
})
|
||||
if presentation_args.at("append_thanks") {
|
||||
thankspage(language, faculty, faculty_color, author)
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,8 @@
|
||||
|
||||
"place_assignment": "Sem vložte zadání",
|
||||
|
||||
"thanks_for_attention": "Děkuji za pozornost",
|
||||
|
||||
"break_rules": {
|
||||
"space_after": [
|
||||
"((?i)[kosuvzai])",
|
||||
@@ -163,6 +165,8 @@
|
||||
"next_page_attachment": "begins on the next page",
|
||||
"attached_bellow": "attached bellow",
|
||||
|
||||
"place_assignment": "Insert your assignment here"
|
||||
"place_assignment": "Insert your assignment here",
|
||||
|
||||
"thanks_for_attention": "Thank you for your attention"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
// - keywords (dictionary): The abstract keywords.
|
||||
// - assignment (str): Filepath of the assignment document/page.
|
||||
// - citations (str): The location of the citation file.
|
||||
// - presentation (dictionary): Arguments for the presentation
|
||||
// - content (content): The content of the document
|
||||
//
|
||||
//-> none
|
||||
@@ -52,8 +53,10 @@
|
||||
author_pronouns: none, supervisor: none, consultant: none, programme: none,
|
||||
specialization: none, year_of_study: none,
|
||||
|
||||
// links
|
||||
assignment: none, citations: "citations.bib",
|
||||
// nested
|
||||
assignment: none, presentation: none,
|
||||
|
||||
citations: "citations.bib",
|
||||
|
||||
// content
|
||||
content,
|
||||
@@ -77,6 +80,7 @@
|
||||
abstract_info(abstract, keywords),
|
||||
acknowledgement,
|
||||
assignment,
|
||||
presentation,
|
||||
citations,
|
||||
);
|
||||
check_arguments(args);
|
||||
@@ -129,6 +133,7 @@
|
||||
abstract_info(none, none),
|
||||
none,
|
||||
assignment,
|
||||
none,
|
||||
"",
|
||||
);
|
||||
check_arguments(args);
|
||||
|
||||
@@ -96,14 +96,22 @@
|
||||
return logotype_text;
|
||||
}
|
||||
|
||||
#let faculty_logotype(faculty_id, lang) = {
|
||||
let theme_color = faculty_color(faculty_id);
|
||||
#let faculty_logotype(faculty_id, lang, color: none) = {
|
||||
let theme_color = if type(color) == type(none) {
|
||||
faculty_color(faculty_id)
|
||||
} else {
|
||||
color
|
||||
};
|
||||
let logotype_text = faculty_logotype_text(faculty_id, lang);
|
||||
text(logotype_text, font: "TUL Mono", theme_color, weight: "black");
|
||||
}
|
||||
|
||||
#let tul_logomark(faculty_id) = {
|
||||
let theme_color = faculty_color(faculty_id);
|
||||
#let tul_logomark(faculty_id, color: none) = {
|
||||
let theme_color = if type(color) == type(none) {
|
||||
faculty_color(faculty_id)
|
||||
} else {
|
||||
color
|
||||
};
|
||||
let image_raw = bytes(read("./assets/tul_logo.svg").replace("black", theme_color.to-hex()));
|
||||
image(image_raw, fit: "contain")
|
||||
image(image_raw, fit: "contain", height: 6.5em)
|
||||
}
|
||||
|
||||
32
theses/presentation_cs.typ
Normal file
32
theses/presentation_cs.typ
Normal file
@@ -0,0 +1,32 @@
|
||||
#import "../template/template.typ": *
|
||||
|
||||
#show: tultemplate2.with(
|
||||
style: "classic",
|
||||
faculty: "fm",
|
||||
lang: "cs",
|
||||
document: "presentation",
|
||||
author: [Ondřej Mekina],
|
||||
title: (
|
||||
cs: [Ukázka prezentace v šabloně tultemplate2],
|
||||
),
|
||||
presentation: (
|
||||
append_thanks: true,
|
||||
),
|
||||
citations: "citations.bib",
|
||||
)
|
||||
|
||||
= První slide
|
||||
|
||||
== Úvod
|
||||
|
||||
Tohle je úvod
|
||||
|
||||
== Text
|
||||
|
||||
Text text
|
||||
|
||||
= Další slide
|
||||
|
||||
Tohle je další slide
|
||||
|
||||
Tady jsou citace: @typst @bibtex
|
||||
Reference in New Issue
Block a user