65 Commits

Author SHA1 Message Date
73e0c700ad add content-only option 2025-12-08 23:18:42 +01:00
57e97bf64d output documentation in nix build theses 2025-12-08 22:59:34 +01:00
7e635c2c06 finish arguments translation 2025-12-08 21:30:37 +00:00
0f03fc2788 add custom formatter rules 2025-12-08 21:30:37 +00:00
bece26ad41 arguments cleanup 2025-12-08 21:30:37 +00:00
1494ef0ba5 switch to new argument checking 2025-12-08 21:30:37 +00:00
a77505683c remove previous argument signatures 2025-12-08 21:30:37 +00:00
72771bcbe8 Re-apply improved argument checking
This reverts commit b846fb2b7d.
2025-12-08 21:30:37 +00:00
cb7131d0ae handle citation path mapping for arrays 2025-12-08 22:29:45 +01:00
49fbe34ea5 udpate readme 2025-12-08 11:21:27 +01:00
cecc5c8f00 add minimal packs to build system 2025-12-08 00:07:45 +01:00
db1e83fad6 allow no title for other 2025-12-07 19:42:41 +01:00
359a0da640 allow underline for links 2025-12-05 11:32:56 +01:00
d21e0d3857 sort abbreviations alphabetically 2025-12-05 11:23:57 +01:00
54ea1bfb8e remove page numbering from abstract and acknowledgement 2025-12-05 11:23:37 +01:00
972cc19ecb update flake theses target 2025-12-03 10:04:08 +01:00
Matej-Zucha-TUL
c72eb5ef34 Add english presentation to Makefile, fix typo in title 2025-12-03 09:16:38 +01:00
Matej-Zucha-TUL
2aab573c07 Develop presentation examples 2025-12-03 09:14:06 +01:00
bdb12e887c add pack target to nix 2025-12-02 23:19:33 +01:00
de81180623 rename attachments to appendix in en 2025-12-02 23:19:23 +01:00
670d7f7340 compensate font sizes in presentations 2025-12-02 20:32:43 +01:00
ac87b6393e add presentation_cs to the build system and readme 2025-12-02 17:27:40 +01:00
Matej-Zucha-TUL
957bbc0060 Expand czech presentation example 2025-12-02 16:20:41 +00:00
97dfd40542 add fullpage heading support for presentation 2025-12-02 16:20:41 +00:00
Matej-Zucha-TUL
9cdb4cc9c2 Add aspect ratio switching 2025-12-02 16:20:41 +00:00
07a7170fb8 add presentation base 2025-12-02 16:20:41 +00:00
d9392b0fa2 add target for building theses to nix flake 2025-12-02 13:17:29 +01:00
613329c6ae fix typo in theses content 2025-12-01 22:29:42 +01:00
2bb4e4e87c Paritally revert "Add remaining appendix examples"
This partially reverts commit 9ceaea2594.
2025-11-28 11:16:01 +01:00
62155e014c allow for parallel make runs 2025-11-28 09:40:20 +01:00
290020cf6f bump flake 2025-11-27 19:01:04 +01:00
ae74b4f0b9 add generated assignment to bundles 2025-11-27 18:43:44 +01:00
af99873b1c make title pages wording clearer 2025-11-27 18:36:54 +01:00
b58492fdcd add generated title pages to bundles 2025-11-27 18:33:33 +01:00
d74d55dbff fix make build for tultemplategen 2025-11-27 18:32:46 +01:00
7c86295693 fix example appendix 2025-11-27 18:30:39 +01:00
76f72131c5 add bundle target for templategen 2025-11-27 12:03:05 +01:00
c5187d8620 add support for multi-page pdfs from stag 2025-11-26 23:45:50 +01:00
Matěj Žucha
90c0e28187 Refactor file structure 2025-11-26 08:26:12 +01:00
09dc48a98f fix pdf embed sizing issues 2025-11-25 18:08:36 +01:00
Matej-Zucha-TUL
9ceaea2594 Add remaining appendix examples 2025-11-25 13:22:04 +01:00
2d8722516b swap example email in theses content 2025-11-24 23:17:58 +01:00
7ccfe1cfe3 develop example theses content 2025-11-24 14:25:25 +01:00
de4f72aa54 add even more examples to theses examples 2025-11-22 21:20:14 +01:00
f871c5f7af add more formatting examples to theses examples 2025-11-22 20:23:05 +01:00
149bca950e reformat example theses content 2025-11-22 19:30:26 +01:00
d0f1f3c041 colorize rectangle border by default 2025-11-22 19:30:02 +01:00
67ca761fe7 add pack nix build target 2025-11-18 18:31:58 +01:00
f588ea1e3f add sp to templategen bundles 2025-11-18 18:17:52 +01:00
f79fcd51e1 corrections for thesis example content in cs and en 2025-11-17 23:01:40 +01:00
5694c95042 add non-breaking term 2025-11-17 22:53:40 +01:00
26f8326782 fix outline and bookmarking display logic 2025-11-17 22:21:03 +01:00
4562048de0 corrections for sp examples 2025-11-17 21:51:39 +01:00
6fbe20abfd update readme 2025-11-17 21:43:13 +01:00
c881b53ac6 add default nix build target 2025-11-17 21:38:34 +01:00
76cf70ec0c make no longer removes the target PDF when running thesis_% target 2025-11-17 20:57:26 +01:00
b4406bfd77 add nix build 2025-11-17 16:00:29 +01:00
24fbf789b9 change readme wording 2025-11-17 15:23:23 +01:00
cda7245997 fix datetime issues in nix envs 2025-11-17 15:22:08 +01:00
69272f6a35 add pdf embedding to documentation attachements examples 2025-11-17 14:16:06 +01:00
d038c7de14 switch to own pdf embedding implementation 2025-11-17 14:16:05 +01:00
a4643419ef implement tests for multipage pdf embedding 2025-11-17 14:16:05 +01:00
ab0c992dc0 add multipage pdf embedding 2025-11-17 14:16:02 +01:00
Matěj Žucha
5f17ee6f5c Fix title in English examples 2025-11-15 09:13:55 +01:00
Matěj Žucha
5b610ebd75 Add seminar thesis examples 2025-11-15 09:13:29 +01:00
33 changed files with 2713 additions and 522 deletions

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@
/pack
/result
/target
/template/lib/
/template/example_appendix.pdf

144
Makefile
View File

@@ -1,19 +1,38 @@
TYPST_PACKAGES ?=
BUILD_DIR := target
PACKS_ROOT := $(BUILD_DIR)/pack
PACKSTAGING := $(PACKS_ROOT)/staging
PACKDIR := $(PACKS_ROOT)/tultemplate2
BUNDLEDIR := $(PACKS_ROOT)/bundle
MINIMALDIR := $(PACKS_ROOT)/minimal
TO_PACK := $(shell find template -type f) template/LICENSE
BUNDLE_THESES := bp_cs bp_en dp_cs dp_en prj_cs prj_en
LIBDIR := template/lib
LIB_MUCHPDFTOOLS := $(LIBDIR)/much_pdf_tools
LIB_TARGETS_MUCHPDFTOOLS := lib.typ much_pdf_tools.wasm
LIB_URL_MUCHPDFTOOLS := https://tulsablona.zumepro.cz/lib/much_pdf_tools
MINIMAL_ASSET_ROOTS := template/assets template/fonts template/citations
MINIMAL_SRCS := $(shell find template -type f -regex '^.*\.typ$$') \
$(shell find $(MINIMAL_ASSET_ROOTS) -type f) \
template/lang.json \
$(LIB_TARGETS_MUCHPDFTOOLS:%=$(LIB_MUCHPDFTOOLS)/%)
TEMPLATE_SRCS := $(MINIMAL_SRCS) template/example_appendix.pdf
ADD_TO_PACK := template/LICENSE
TO_PACK_MINIMAL := $(MINIMAL_SRCS) $(ADD_TO_PACK)
TO_PACK := $(TEMPLATE_SRCS) $(ADD_TO_PACK)
BUNDLE_THESES := bp_cs bp_en dp_cs dp_en prj_cs prj_en sp_cs sp_en presentation_cs presentation_en
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp_cs.typ \
$(BUNDLE_THESES:%=$(BUNDLEDIR)/%.typ) $(BUNDLEDIR)/Makefile
$(BUNDLE_THESES:%=$(BUNDLEDIR)/%.typ) $(BUNDLEDIR)/Makefile \
$(BUNDLEDIR)/title-pages.pdf $(BUNDLEDIR)/assignment.pdf
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib $(PACKDIR)/Makefile
TEMPLATE_SRCS := $(shell find template -type f)
MINIMAL_TARGETS := $(TO_PACK_MINIMAL:%=$(MINIMALDIR)/%)
# == MAIN TARGETS ==
.PRECIOUS: $(BUILD_DIR)/%.pdf
.PHONY: view_documentation
view_documentation: $(BUILD_DIR)/documentation.pdf
xdg-open $<
@@ -25,6 +44,9 @@ pack: $(PACKDIR)/tultemplate2.zip
bundle: $(BUNDLE_TARGETS)
@echo "!! Bundles are made for tultemplategen and not for direct use !!"
.PHONY: minimal
minimal: $(MINIMAL_TARGETS) $(MINIMALDIR)/tultemplate2_minimal.zip
.PHONY: watch_documentation
watch_documentation: $(BUILD_DIR)/documentation.pdf
xdg-open $< & typst watch --font-path template/fonts documentation.typ $<
@@ -39,6 +61,7 @@ documentation: $(BUILD_DIR)/documentation.pdf
.PHONY: clean
clean:
rm -rf target
rm -rf template/lib
# == ROOTS ==
@@ -48,12 +71,18 @@ $(BUILD_DIR):
$(PACKS_ROOT): | $(BUILD_DIR)
mkdir $@
$(PACKSTAGING): | $(PACKS_ROOT)
mkdir $@
$(PACKDIR): | $(PACKS_ROOT)
mkdir $@
$(BUNDLEDIR): | $(PACKS_ROOT)
mkdir $@
$(MINIMALDIR): | $(PACKS_ROOT)
mkdir $@
# == UTILS ==
define minify_csl
@@ -68,13 +97,38 @@ define replace_with_file_line
sed "s/$(1)/$$(sed '$(3)q;d' $(2))/g"
endef
define typst_pkgs
$(if $(TYPST_PACKAGES), --package-cache-path $(TYPST_PACKAGES))
endef
define typst_compile
typst compile --font-path template/fonts$(call typst_pkgs) --root .
endef
# == LIBS ==
$(LIBDIR):
mkdir $@
$(LIB_MUCHPDFTOOLS): | $(LIBDIR)
mkdir $@
template/lib/much_pdf_tools/lib.typ: | $(LIB_MUCHPDFTOOLS)
cd $(LIB_MUCHPDFTOOLS) && wget "$(LIB_URL_MUCHPDFTOOLS)/lib.typ"
template/lib/much_pdf_tools/much_pdf_tools.wasm: | $(LIB_MUCHPDFTOOLS)
cd $(LIB_MUCHPDFTOOLS) && wget "$(LIB_URL_MUCHPDFTOOLS)/much_pdf_tools.wasm"
# == DOCUMENTATION ==
$(BUILD_DIR)/documentation.pdf: documentation.typ $(TEMPLATE_SRCS) | $(BUILD_DIR)
typst compile --font-path template/fonts $< $@
$(call typst_compile) $< $@
# == 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}' $< > $@
@@ -95,66 +149,82 @@ $(BUILD_DIR)/%.typ: $(BUILD_DIR)/header_%.txt $(BUILD_DIR)/content_%.txt | $(BUI
cat $^ > $@
$(BUILD_DIR)/%.pdf: $(BUILD_DIR)/%.typ $(TEMPLATE_SRCS) | $(BUILD_DIR)
typst compile --font-path template/fonts --root . $< $@
$(call typst_compile) $< $@
# == PACKS - clean builds for direct use ==
template/example_appendix.pdf: theses/example_appendix.typ
$(call typst_compile) $< $@
$(PACKDIR)/%: % | $(PACKDIR)
ln -f $< $@
# == PACK STAGING - files prepared for packing or bundling ==
$(PACKDIR)/template: | $(PACKDIR)
$(PACKSTAGING)/template: | $(PACKSTAGING)
mkdir $@
$(PACKDIR)/template/LICENSE: LICENSE | $(PACKDIR)/template
$(PACKSTAGING)/template/citations: | $(PACKSTAGING)/template
mkdir $@
$(PACKSTAGING)/template/LICENSE: LICENSE | $(PACKSTAGING)/template
ln -f $< $@
$(PACKDIR)/Makefile: packed.mk | $(PACKDIR)
ln -f $< $@
$(PACKDIR)/template/tul_citace.csl: template/tul_citace.csl | $(PACKDIR)/template
$(PACKSTAGING)/template/citations/%: template/citations/% | $(PACKSTAGING)/template/citations
$(call minify_csl,$<,$@)
$(PACKDIR)/template/lang.json: template/lang.json | $(PACKDIR)/template
$(PACKSTAGING)/template/lang.json: template/lang.json | $(PACKSTAGING)/template
$(call minify_json,$<,$@)
$(PACKDIR)/template/%: template/% | $(PACKDIR)/template
$(PACKSTAGING)/documentation.pdf: $(BUILD_DIR)/documentation.pdf | $(PACKSTAGING)
ln -f $< $@
$(PACKSTAGING)/%.pdf: $(BUILD_DIR)/%.pdf | $(PACKSTAGING)
ln -f $< $@
$(PACKSTAGING)/%: % | $(PACKSTAGING)
@mkdir -p $(@D)
ln -f $< $@
$(PACKDIR)/%.pdf: $(BUILD_DIR)/%.pdf | $(PACKDIR)
# == PACKS - clean builds for direct use ==
$(PACKDIR)/Makefile: packed.mk | $(PACKDIR)
ln -f $< $@
$(PACKDIR)/tultemplate2.zip: $(PACK_TARGETS) | $(PACKDIR)
rm -f $@
cd $(PACKS_ROOT) && zip -r tultemplate2.zip tultemplate2
# == BUNDLES - packs for tultemplategen ==
$(BUNDLEDIR)/template: | $(BUNDLEDIR)
mkdir $@
$(BUNDLEDIR)/template/LICENSE: LICENSE | $(BUNDLEDIR)/template
$(PACKDIR)/%: $(PACKSTAGING)/% | $(PACKDIR)
@mkdir -p $(@D)
ln -f $< $@
# == BUNDLES - packs for tultemplategen ==
$(BUNDLEDIR)/Makefile: templategen.mk | $(BUNDLEDIR)
ln -f $< $@
$(BUNDLEDIR)/template/tul_citace.csl: template/tul_citace.csl | $(BUNDLEDIR)/template
$(call minify_csl,$<,$@)
$(BUNDLEDIR)/template/lang.json: template/lang.json | $(BUNDLEDIR)/template
$(call minify_json,$<,$@)
$(BUNDLEDIR)/citations.bib: citations.bib | $(BUNDLEDIR)
ln -f $< $@
$(BUNDLEDIR)/template/%: template/% | $(BUNDLEDIR)/template
@mkdir -p $(@D)
ln -f $< $@
$(BUNDLEDIR)/presentation_%.typ: theses/presentation_%.typ | $(BUNDLEDIR)
cat $< | awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' > $@
$(BUNDLEDIR)/%.typ: $(BUILD_DIR)/content_%.txt | $(BUNDLEDIR)
sed 's/\.\.\/template\//template\//' $< > $@
$(BUNDLEDIR)/title-pages.pdf: theses/title_pages.typ | $(BUNDLEDIR)
$(call typst_compile) $< $@
$(BUNDLEDIR)/assignment.pdf: theses/assignment.typ | $(BUNDLEDIR)
$(call typst_compile) $< $@
$(BUNDLEDIR)/%: $(PACKSTAGING)/% | $(BUNDLEDIR)
@mkdir -p $(@D)
ln -f $< $@
# == MINIMAL - stripped-down template packs ==
$(MINIMALDIR)/%: $(PACKSTAGING)/% | $(MINIMALDIR)
@mkdir -p $(@D)
ln -f $< $@
$(MINIMALDIR)/tultemplate2_minimal.zip: $(MINIMAL_TARGETS) | $(MINIMALDIR)
rm -f $@
cd $(MINIMALDIR) && zip -r $(notdir $@) template
# == TESTS ==
include tests/make.mk

View File

@@ -20,7 +20,7 @@ to the maintainer:
Ondřej Mekina <ondrej@mekina.cz>
## Our goals and dreams
## The goals of this template
We dream of a simple way for students to make documents. Of a workflow revolving not around
citations, fonts, paragraphs and other formal nonsense, but around the actual content of the
@@ -135,11 +135,7 @@ Using:
make thesis_bp_cs
```
Will view an example bachelor's thesis in czech. If you want to keep the PDF file after viewing:
```sh
make target/bp_cs.pdf
```
Will make and view an example bachelor's thesis in czech.
We also have (at the moment):
- `bp_en`
@@ -147,3 +143,7 @@ We also have (at the moment):
- `dp_en`
- `prj_cs`
- `prj_en`
- `sp_cs`
- `sp_en`
- `presentation_cs`
- `presentation_en`

View File

@@ -426,7 +426,20 @@ do požadavků. Pak můžete postupně přepisovat/vyplňovat.
Funkce `todo` vám zároveň zabrání v tom, aby se text Lorem Ipsum vyskytl ve výsledném dokumentu.
#pagebreak(weak: true)
= Argumenty šablony
Následujících pár stránek je kompletní soupis argumentů, které tato šablona přijímá.
Pokud s šablonou nemáte rozsáhlé zkušenosti, doporučujeme raději využít generátoru
(https://tulsablona.zumepro.cz/generate/).
// Automaticky generovaný seznam argumentů
#import "template/arguments.typ": print_argument_docs
#print_argument_docs(lang: "cs")
#attachments(
attach_link("Zdrojový kód této šablony", "https://git.zumepro.cz/tul/tultemplate2"),
attach_content("Testovací obsah vygenerovaný Typstem", [Sem lze psát _stylovaný_ obsah.]),
attach_pdf("Ukázkový PDF soubor s dvěma stranami", "template/example_appendix.pdf"),
)

95
flake.lock generated
View File

@@ -1,12 +1,81 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"much_pdf_tools": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"systems": "systems"
},
"locked": {
"lastModified": 1764192868,
"narHash": "sha256-0h4Fqg3C+VMS2+gvJUKKEjJJDWEeRcMCFkXerl9kPc0=",
"ref": "refs/heads/master",
"rev": "bf65c77e3b0e02b6f22bd20840277c603cd9c2bf",
"revCount": 1,
"type": "git",
"url": "https://git.zumepro.cz/ondrej.mekina/much_pdf_tools.git"
},
"original": {
"type": "git",
"url": "https://git.zumepro.cz/ondrej.mekina/much_pdf_tools.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1762482733,
"narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=",
"lastModified": 1745804731,
"narHash": "sha256-v/sK3AS0QKu/Tu5sHIfddiEHCvrbNYPv8X10Fpux68g=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc",
"rev": "29335f23bea5e34228349ea739f31ee79e267b88",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1743296961,
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1764167966,
"narHash": "sha256-nXv6xb7cq+XpjBYIjWEGTLCqQetxJu6zvVlrqHMsCOA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5c46f3bd98147c8d82366df95bbef2cab3a967ea",
"type": "github"
},
"original": {
@@ -18,7 +87,8 @@
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"much_pdf_tools": "much_pdf_tools",
"nixpkgs": "nixpkgs_2",
"utils": "utils"
}
},
@@ -37,9 +107,24 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,

115
flake.nix
View File

@@ -2,18 +2,127 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
much_pdf_tools.url = "git+https://git.zumepro.cz/ondrej.mekina/much_pdf_tools.git";
};
outputs = { self, nixpkgs, utils }:
outputs = { self, nixpkgs, utils, much_pdf_tools }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
dependencies = with pkgs; [ typst gnumake jq xdg-utils zip ];
buildInputs = with pkgs; [ typst gnumake jq xdg-utils zip wget ];
name = "tultemplate2";
envSetup = ''
unset SOURCE_DATE_EPOCH
LIB=template/lib
if [ ! -e $LIB ]; then mkdir $LIB; fi
if [ ! -e $LIB/much_pdf_tools ]
then
cp -R ${much_pdf_tools.packages.${system}.much_pdf_tools} $LIB/much_pdf_tools
chmod +w $LIB/much_pdf_tools
fi
'';
typstPkgs = [
{
name = "alchemist";
version = "0.1.8";
hash = "18ckw65wq7q8ksayp1g86c9j6d9l1kfg9m100q0gddaw7ksqjqqq";
}
{
name = "cetz";
version = "0.4.1";
hash = "18xinq5agk6zi0r064l6qg09far170n9965a9z2zznz3zsv1h6is";
}
{
name = "oxifmt";
version = "1.0.0";
hash = "0bqc5ahiavjds966a8v5llw9imqqaa43x89ha9dl5nlp51vqmla6";
}
];
pull_typst_package = pkg: pkgs.stdenv.mkDerivation {
name = "typst_package-${pkg.name}-${pkg.version}";
src = fetchTarball {
url = "https://packages.typst.org/preview/${pkg.name}-${pkg.version}.tar.gz";
sha256 = pkg.hash;
};
installPath = "${pkg.name}/${pkg.version}";
installPhase = ''
mkdir -p $out/$installPath
cp -R . $out/$installPath
'';
};
pull_typst_packages = pkgList: pkgs.stdenv.mkDerivation {
name = "typst-packages";
src = null;
dontUnpack = true;
buildInputs = builtins.map (pkg: pull_typst_package pkg) pkgList;
installPhase = ''
mkdir -p $out/preview
for input in $buildInputs
do
ln -s $input/$(ls $input) $out/preview
done
'';
};
build_with_targets = id: targets: buildOutputs: typstPkgs: pkgs.stdenv.mkDerivation {
inherit buildInputs targets buildOutputs;
name = name + "-" + id;
src = ./.;
buildPhase = ''
${envSetup}
${
if builtins.length typstPkgs > 0
then
"ln -s ${pull_typst_packages typstPkgs} typst_packages"
else ""
}
for target in $targets
do
make $target ${
if builtins.length typstPkgs > 0 then "TYPST_PACKAGES=typst_packages" else ""
}
done
'';
installPhase = ''
mkdir $out
for buildOutput in $buildOutputs
do
cp -R $buildOutput $out
done
'';
};
build = id: targets: typstPkgs: (let
targetFiles = builtins.map (target: "target/${target}") targets;
in
build_with_targets id [targetFiles] [targetFiles] typstPkgs);
in
{
devShell = with pkgs; mkShell {
buildInputs = dependencies;
buildInputs = buildInputs ++ [ (pkgs.stdenv.mkDerivation {
name = name + "-typstfmt";
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
ln -s ${typstyle}/bin/typstyle $out/bin/typstyle
ln -s ${writeShellScript "tultypstfmt" ''
typstyle --inplace -l 100 $@
''} $out/bin/ttfmt
'';
}) ];
shellHook = envSetup;
};
packages.bundle = build_with_targets "bundle" ["bundle"] ["target/pack/bundle/."] [];
packages.theses = build "theses" (builtins.map (file: "${file}.pdf") [
"documentation"
"bp_cs" "bp_en"
"dp_cs" "dp_en"
"prj_cs" "prj_en"
"sp_cs" "sp_en"
"presentation_cs" "presentation_en"
]) typstPkgs;
packages.pack = build_with_targets "pack" ["pack"] ["target/pack/."] [];
packages.minimal = build_with_targets "minimal" ["minimal"] [
"target/pack/minimal/."
] [];
}
);
}

View File

@@ -1,142 +1,464 @@
#import "utils.typ": assert_type_signature, is_none, map_none, deref, assert_dict_has
#let arguments_structure = (
document: (
visual_style: "string",
faculty: "string",
language: "string",
type: "string",
),
title_pages: "string | boolean | none",
title: "dictionary[string : string | content] | none",
author: (
name: "string | content | none",
pronouns: "string | none",
programme: "dictionary[string : string | content] | none",
specialization: "dictionary[string : string | content] | none",
year_of_study: "string | content | none",
),
project: (
supervisor: "string | content | dictionary[string : string | content] | none",
consultant: "string | content | dictionary[string : string | content] | none",
),
abstract: (
content: "dictionary[string : string | content] | none",
keywords: "dictionary[string : string | content | array[string]] | none",
),
acknowledgement: "dictionary[string : string | content] | none",
assignment: "dictionary[string : any] | content | string | none",
citations: "string",
);
#let assignment_structure = (
personal_number: "string | content",
department: "string | content",
academical_year: "string | content",
content: "content",
);
#import "utils.typ": assert_dict_has, assert_type_signature, deref, is_none, map_none
#import "type_signature.typ": *
#let check_arguments(args, structure: arguments_structure, namespace: none) = {
let check_arguments_dict(structure, args, argument_path) = {
for (key, value) in structure.pairs() {
argument_path.push(str(key).replace("_", " "));
#let arguments_structure = {
let lang_keys = variants(literal("cs"), literal("en"))
let nonrec_str = doc(string, none, (
cs: "Je doporučeno použít 'content', pokud je to možné",
en: "It is recommended to use 'content' where that's possible",
))
let cont_or_str = variants(cont, nonrec_str)
let opt_cont_or_str = variants(cont, nonrec_str, null)
if not key in args {
panic("invalid arguments definition");
}
let arg = args.at(key);
// == DOCUMENT ==
let document = {
let visual_style = doc(keyval(literal("visual_style"), variants(literal("classic"))), "style", (
cs: "Vizuální styl šablony",
en: "Visual style of the template",
))
if type(value) == dictionary {
check_arguments_dict(value, arg, argument_path);
} else if type(value) == str {
assert_type_signature(arg, value, argument_path.join(" "));
} else {
panic("invalid arguments definition");
}
let faculty = doc(
keyval(literal("faculty"), variants(
doc(literal("fs"), none, (cs: "Fakulta strojní", en: "Faculty of mechanical engineering")),
doc(literal("ft"), none, (cs: "Fakulta textilní", en: "Faculty of textile engineering")),
doc(literal("fp"), none, (
cs: "Fakulta přírodovědně-humanitní a pedagogická",
en: "Faculty of science, humanities and education",
)),
doc(literal("ef"), none, (cs: "Ekonomická fakulta", en: "Faculty of economics")),
doc(literal("fua"), none, (
cs: "Fakulta umění a architektury",
en: "Faculty of arts and architecture",
)),
doc(literal("fm"), none, (
cs: "Fakulta mechatroniky, informatiky a mezioborových studií",
en: "Faculty of mechatronics, informatics and interdisciplinary studies",
)),
doc(literal("fzs"), none, (
cs: "Fakulta zdravotnických studií",
en: "Faculty of health studies",
)),
doc(literal("cxi"), none, (
cs: "Ústav pro nanomateriály, pokročilé technologie a inovace",
en: "Institute for nanomaterials, advanced technology and innovation",
)),
doc(literal("tul"), none, (cs: "Obecný styl TUL", en: "Generic TUL theme")),
)),
"faculty",
(
cs: "Fakulta (na základě toho budou vybrány barvy, logotypy, ...)",
en: "Faculty (based on this, the theme of the document will be chosen)",
),
)
let _ = argument_path.pop();
}
let language = doc(
keyval(literal("language"), variants(
doc(literal("cs"), none, (cs: "Čeština", en: "Czech")),
doc(literal("en"), none, (cs: "Angličtina", en: "English")),
)),
"lang",
(cs: "Primární jazyk dokumentu", en: "Primary language of the document"),
)
let type = doc(
keyval(literal("type"), variants(
doc(literal("bp"), none, (cs: "Bakalářská práce", en: "Bachelor's thesis")),
doc(literal("dp"), none, (cs: "Diplomová práce", en: "Diploma thesis")),
doc(literal("prj"), none, (
cs: "Projekt (ročník před odevzdáním bakalářské práce)",
en: "Project (the year before bachelor's thesis)",
)),
doc(literal("sp"), none, (cs: "Semestrální práce", en: "Term paper")),
doc(literal("presentation"), none, (cs: "Prezentace", en: "Presentation")),
doc(literal("other"), none, (cs: "Obecný dokument", en: "Generic dokument")),
)),
"document",
(cs: "Typ dokumentu", en: "The type of the document"),
)
let content_only = doc(
keyval(literal("content_only"), bool),
"content_only",
(
cs: "Zda u dokumentu typu `other` generovat pouze obsah",
en: "Whether to generate only content for document of type `other`",
),
)
keyval(literal("document"), struct(visual_style, faculty, language, type, content_only))
}
check_arguments_dict(structure, args, if is_none(namespace) { () } else { (namespace,) });
// == TITLE PAGES ==
let title_pages = doc(
keyval(
literal("title_pages"),
variants(
doc(string, none, (
cs: "Cesta k souboru PDF, který má být vložen",
en: "The path to the PDF document to insert",
)),
doc(
null,
none,
(
cs: "Stránky jsou generovány pomocí šablony. Tohle u některých prací může vyžadovat doplnění informací (argumentů).",
en: "The pages are generated through the template. This can require more arguments for certain documents.",
),
),
),
),
"title_pages",
(
cs: "Způsob generování stránek na začátku dokumentu",
en: "Method of inserting/generating the first few pages of the document",
),
)
// == TITLE ==
let title = doc(
keyval(literal("title"), dict(keyval(
variants(
// title
doc(literal("cs"), none, (cs: "Název práce v češtině", en: "Document title in Czech")),
doc(literal("en"), none, (cs: "Název práce v angličtině", en: "Document title in English")),
),
cont_or_str,
))),
"title",
(cs: "Název práce", en: "Document title"),
)
// == AUTHOR ==
let author = {
let name = doc(keyval(literal("name"), opt_cont_or_str), "author", (
cs: "Jméno autora včetně titulů",
en: "The name of the author including titles",
))
let pronouns = doc(
keyval(literal("pronouns"), variants(
doc(literal("masculine"), none, (
cs: "Pro češtinu, oslovení v mužském rodě",
en: "For Czech (masculine)",
)),
doc(literal("feminine"), none, (
cs: "Pro češtinu, oslovení v ženském rodě",
en: "For Czech (feminine)",
)),
doc(literal("we"), none, (
cs: "Pro češtinu a angličtinu, oslovení v množném čísle",
en: "For Czech and English, plural",
)),
doc(literal("me"), none, (
cs: "Pro angličtinu, oslovení v jednotném čísle",
en: "For English, singular",
)),
doc(null, none, (
cs: "Pro angličtinu, oslovení v jednotném čísle",
en: "Fallback for English, singular",
)),
)),
"author",
(cs: "Oslovení autora / autorů", en: "Author pronouns"),
)
let programme = doc(
keyval(literal("programme"), variants(dict(keyval(lang_keys, cont_or_str)), null)),
"programme",
(
cs: "Studijní program, pod kterým byl tento dokument vytvořen",
en: "Study programme of the author",
),
)
let specialization = doc(
keyval(literal("specialization"), variants(dict(keyval(lang_keys, cont_or_str)), null)),
"specialization",
(
cs: "Specializace, pod kterou byl tento dokument vytvořen",
en: "Specialization of the author",
),
)
let year_of_study = doc(keyval(literal("year_of_study"), opt_cont_or_str), "year_of_study", (
cs: "Ročník studia autora",
en: "The year of study of the author",
))
keyval(literal("author"), struct(name, pronouns, programme, specialization, year_of_study))
}
// == PROJECT ==
let project = {
let supervisor = doc(
keyval(literal("supervisor"), variants(
cont,
nonrec_str,
struct(
doc(keyval(literal("name"), cont_or_str), none, (
cs: "Jméno vedoucího projektu",
en: "The name of the project's supervisor",
)),
doc(keyval(literal("institute"), cont_or_str), none, (
cs: "Ústav vedoucího projektu",
en: "The institute of the project's supervisor",
)),
),
null,
)),
"supervisor",
(cs: "Vedoucí projektu", en: "Project supervisor"),
)
let consultant = doc(
keyval(literal("consultant"), variants(
cont,
nonrec_str,
struct(
doc(keyval(literal("name"), cont_or_str), none, (
cs: "Jméno konzultanta projektu",
en: "Name of the project's consultant",
)),
doc(keyval(literal("institute"), cont_or_str), none, (
cs: "Ústav konzultanta projektu",
en: "The institute of the project's consultant",
)),
),
null,
)),
"consultant",
(cs: "Konzultant projektu", en: "Project's consultant"),
)
keyval(literal("project"), struct(supervisor, consultant))
}
// == ABSTRACT ==
let abstract = {
let content = doc(
keyval(literal("content"), variants(
struct(..lang_keys.variants.map(k => {
keyval(k, variants(cont, nonrec_str, slice(string)))
})),
null,
)),
"abstract",
(cs: "Abstrakt projektu", en: "Project's abstract"),
)
let keywords = doc(
keyval(literal("keywords"), variants(
struct(..lang_keys.variants.map(k => {
keyval(k, variants(cont, nonrec_str, slice(string)))
})),
null,
)),
"keywords",
(cs: "Klíčová slova projektu", en: "Project's keywords"),
)
keyval(literal("abstract"), struct(content, keywords))
}
// == ACKNOWLEDGEMENT ==
let acknowledgement = doc(
keyval(literal("acknowledgement"), variants(dict(keyval(lang_keys, cont_or_str)), null)),
"acknowledgement",
(cs: "Poděkování", en: "Acknowledgement"),
)
// == ASSIGNMENT ==
let assignment = doc(
// assignment
keyval(
literal("assignment"),
variants(
doc(string, none, (
cs: "Zadání bude vloženo z PDF souboru s touto cestou",
en: "The assignment will be inserted from a PDF file with this path",
)),
doc(
struct(
keyval(literal("personal_number"), cont_or_str),
keyval(literal("department"), cont_or_str),
keyval(literal("academical_year"), cont_or_str),
doc(keyval(literal("content"), cont), none, (
cs: "Obsah zadání (zobrazen pod informacemi)",
en: "Content of the assignment (shown bellow informations)",
)),
),
none,
(
cs: "Zadání bude vygenerováno šablonou",
en: "The assignment will be creating through this template",
),
),
doc(
null,
none,
(
cs: "Pokud je zadání vyžadováno typem dokumentu, bude vložena strana s upozorněním na vložení",
en: "If the assignment is required by the document type, a page with a warning will be inserted",
),
),
doc(cont, none, (
cs: "Zdrojový kód se zadáním (tato možnost se nedoporučuje)",
en: "Source code for the page (is not recommended)",
)),
),
),
"assignment",
(cs: "Stránka / stránky se zadáním", en: "Page / pages with the assignment"),
)
// == PRESENTATION ==
let presentation_info = {
let append_thanks = doc(keyval(literal("append_thanks"), bool), none, (
cs: "Zda na konec prezentace vložit poděkování za pozornost",
en: "Whether to thank for attention at the end of the presentation",
))
let wide = doc(keyval(literal("wide"), bool), none, (
cs: "Jestli použít široký režim (16:9 - `true`) nebo úzký (4:3 - `false`)",
en: "Whether to use widescreen format (16:9 - `true`) or narrow format (4:3 - `false`)",
))
let first_heading_is_fullpage = doc(
keyval(literal("first_heading_is_fullpage"), bool),
none,
(
cs: "Pokud je nastaveno `true`, pak se nadpisy první úrovně budou vkládat na samostatnou stránku",
en: "When set to `true`, headings of first level will be on a separate page",
),
)
doc(
keyval(literal("presentation_info"), variants(null, struct(
append_thanks,
wide,
first_heading_is_fullpage,
))),
"presentation",
(
cs: "Argumenty pro dokument typu `presentation`",
en: "Arguments for a document of type `presentation`",
),
)
}
// == CITATIONS ==
let citations = doc(
// citations
keyval(literal("citations"), variants(
doc(string, none, (
cs: "Cesta k souboru s bibliografií",
en: "The path to the bibliography file",
)),
doc(slice(string), none, (
cs: "Cesty k souborům s bibliografií",
en: "Paths to the bibliography files",
)),
)),
"citations",
(cs: "Zdroj bibliografie", en: "Bibliography source"),
)
struct(
document,
title_pages,
title,
author,
project,
abstract,
acknowledgement,
assignment,
presentation_info,
citations,
)
}
#let print_argument_docs(lang: "en") = {
signature_docs(arguments_structure, lang: lang)
}
#let check_arguments(args, structure: arguments_structure, namespace: none) = {
let res = signature_check(args, structure, "")
if not res.at(0) {
let panic_message = res.at(1)
panic(panic_message)
}
}
#let get_arg_single(args, path) = {
let args = args;
let args = args
for segment in path.split(".") {
if segment not in args {
panic("invalid argument query path: " + str(path));
panic("invalid argument query path: " + str(path))
}
args = args.at(segment);
args = args.at(segment)
}
args
}
#let get_arg(args, path) = {
if type(path) == array {
let res = ();
let res = ()
for path in path {
res.push(get_arg_single(args, path));
res.push(get_arg_single(args, path))
}
res
} else if type(path) == str {
get_arg_single(args, path)
} else {
panic("invalid argument path");
panic("invalid argument path")
}
}
#let req_arg_single(args, path) = {
let arg = get_arg_single(args, path);
let arg = get_arg_single(args, path)
if is_none(arg) {
let panic_message = path.split(".").join(" ").replace("_", " ") + " is missing";
panic(panic_message);
let panic_message = (
path.split(".").join(" ").replace("_", " ") + " is missing"
)
panic(panic_message)
}
arg
}
#let req_arg(args, path) = {
if type(path) == array {
let res = ();
let res = ()
for path in path {
res.push(req_arg_single(args, path));
res.push(req_arg_single(args, path))
}
res
} else if type(path) == str {
req_arg_single(args, path)
} else {
panic("invalid argument path");
panic("invalid argument path")
}
}
#let map_arg_single(args, path, mapper) = {
let arg = get_arg(args, path);
let arg = get_arg(args, path)
map_none(arg, mapper)
}
#let map_arg(args, path, mapper) = {
if type(path) == array {
let res = ();
let res = ()
for path in path {
res.push(map_arg_single(args, path, mapper));
res.push(map_arg_single(args, path, mapper))
}
res
} else if type(path) == str {
map_arg_single(args, path, mapper)
} else {
panic("invalid argument path");
panic("invalid argument path")
}
}
#let assignment_info(assignment) = {
if type(assignment) == dictionary {
assert_dict_has(assignment_structure.keys(), assignment, "assignment");
check_arguments(assignment, structure: assignment_structure, namespace: "assignment");
}
assignment
}
#let arguments(
document_info,
title_pages,
@@ -146,6 +468,7 @@
abstract_info,
acknowledgement,
assignment,
presentation,
citations,
) = {
(
@@ -156,17 +479,25 @@
project: project_info,
abstract: abstract_info,
acknowledgement: acknowledgement,
assignment: assignment_info(assignment),
assignment: assignment,
presentation_info: presentation,
citations: citations,
)
}
#let document_info(visual_style, faculty_abbreviation, language_abbreviation, document_type) = {
#let document_info(
visual_style,
faculty_abbreviation,
language_abbreviation,
document_type,
content_only,
) = {
(
visual_style: visual_style,
faculty: faculty_abbreviation,
language: language_abbreviation,
type: document_type,
content_only: content_only,
)
}

View File

@@ -154,7 +154,7 @@
);
query(label(attachment.at(1))).at(0).value;
} else if attachment_type == "pdf" {
import "@preview/muchpdf:0.1.1": muchpdf
import "./pdf.typ": embed_full
page(place(center + horizon, heading(
level: 2,
get_lang_item(language, "attachment") + " " +
@@ -164,7 +164,7 @@
outlined: false,
)), margin: 0em);
set page(margin: 0em);
muchpdf(read("../" + attachment.at(1), encoding: none), width: 100%);
embed_full(read("../" + attachment.at(1), encoding: none));
}
}
}

View File

@@ -1,8 +1,8 @@
// tools & utils
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
#import "../lang.typ": lang_id, get_lang_item
#import "../utils.typ": assert_in_dict, assert_in_arr, map_none, assert_dict_has, is_none
#import "../arguments.typ": req_arg, map_arg, get_arg
#import "../theme.typ": faculty_color, faculty_logotype, tul_logomark
#import "../lang.typ": get_lang_item, lang_id
#import "../utils.typ": assert_dict_has, assert_in_arr, assert_in_dict, is_none, map_none
#import "../arguments.typ": get_arg, map_arg, req_arg
#import "common.typ": default_styling, external_title_pages
// thesis types
@@ -10,62 +10,93 @@
#import "dp.typ": dp
#import "prj.typ": prj
#import "sp.typ": sp
#import "other.typ": other_title_page, other_base
#import "other.typ": other_base, other_title_page
#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(
show_disclaimer: false,
require_abstract: false,
), thesis_base_title_pages),
"other": (other_title_page, other_base, (args) => {}),
"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,
),
title_pages: thesis_base_title_pages,
),
"other": (root: other_title_page, base: other_base),
"presentation": (base: presentation),
)
#let prep_args(args) = {
let language = req_arg(args, "document.language");
let language = req_arg(args, "document.language")
// argument pre-checking
assert_in_dict(req_arg(args, "document.type"), document_types, "document type");
map_arg(args, "title", (v) => assert_dict_has((language,), v, "title"));
map_arg(args, "author.programme", (v) => assert_dict_has((language,), v, "study programme"));
assert_in_dict(req_arg(args, "document.type"), document_types, "document type")
map_arg(args, "title", v => assert_dict_has((language,), v, "title"))
map_arg(args, "author.programme", v => assert_dict_has((language,), v, "study programme"))
map_arg(
args, "author.specialization", (v) => assert_dict_has((language,), v, "study specialization")
);
args,
"author.specialization",
v => assert_dict_has((language,), v, "study specialization"),
)
map_arg(
args, "acknowledgement", (v) => assert_dict_has((language,), v, "acknowledgement content")
);
args,
"acknowledgement",
v => assert_dict_has((language,), v, "acknowledgement content"),
)
args.assignment = map_arg(args, "assignment", (v) => {
args.assignment = map_arg(args, "assignment", v => {
if type(v) == str {
"../../" + v
} else {
v
}
});
args.citations = map_arg(args, "citations", (v) => "../../" + v);
args.title_pages = map_arg(args, "title_pages", (v) => "../../" + v);
})
args.citations = map_arg(args, "citations", v => {
if type(v) == array {
v.map(v => { "../../" + v })
} else if type(v) == str {
"../../" + v
} else {
panic()
}
})
args.title_pages = map_arg(args, "title_pages", v => "../../" + v)
args
}
#let template_classic(args, content) = {
let args = prep_args(args);
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);
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)
}
}

View File

@@ -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,6 +14,39 @@
// TYPST ELEMENT STYLING
#let common_styling(faculty_color, language, content) = {
// text
set text(font: base_font);
set par(justify: true);
if language == "cs" {
content = set_czech_nonbreakable_terms(content);
}
// headings
show heading: it => {
set par(justify: false);
text(it, faculty_color, font: "TUL Mono", size: 1.2em)
};
// other
show raw.where(block: false): set text(font: mono_font, size: 1.25em);
show raw.where(block: true): it => {
block(it, fill: rgb("#eee"), inset: 1em)
};
show link: it => {
if type(it.dest) == label or type(it.dest) == location {
it;
} else {
text(underline(it), fill: faculty_color);
}
}
set highlight(fill: faculty_color.lighten(90%));
set line(stroke: (paint: faculty_color, thickness: .7pt), length: 100%);
set rect(stroke: (paint: faculty_color, thickness: .7pt));
content
}
#let default_styling(flip_bonding, faculty_color, content, language) = {
// page
set page(
@@ -34,13 +66,6 @@
}
});
// text
set text(font: base_font);
set par(justify: true);
if language == "cs" {
content = set_czech_nonbreakable_terms(content);
}
// figures
let figure_numbering(realcount, c) = {
context realcount.step();
@@ -56,14 +81,6 @@
// heading
set heading(numbering: "1.1.1 ");
show heading: it => {
set par(justify: false);
block(
above: 2em,
below: 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);
@@ -71,7 +88,11 @@
pagebreak(weak: true);
v(2cm);
it
block(
above: 2em,
below: 2em,
it,
);
};
show heading.where(): it => {
if it.level > 3 {
@@ -81,22 +102,7 @@
}
}
// other
show raw.where(block: false): set text(font: mono_font, size: 1.25em);
show raw.where(block: true): it => {
block(it, fill: rgb("#eee"), inset: 1em)
};
show link: it => {
if type(it.dest) == label or type(it.dest) == location {
it;
} else {
text(it, fill: faculty_color);
}
}
set highlight(fill: faculty_color.lighten(90%));
set line(stroke: (paint: faculty_color, thickness: .7pt), length: 100%);
content
common_styling(faculty_color, language, content);
}
@@ -104,7 +110,7 @@
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
);
}
@@ -241,9 +247,9 @@
set page(margin: 2cm);
pagebreak(weak: true);
if has_all_none((
document_type, title, author, supervisor, consultant, study_programme,
title, author, supervisor, consultant, study_programme, study_specialization, year_of_study
)) {
place(center + horizon, align(left, faculty_logotype(faculty_id, language)));
place(center + horizon, align(left, text(faculty_logotype(faculty, language), size: 1.5em)));
} else {
header(faculty, language);
align({
@@ -261,6 +267,7 @@
let (personal_number, department, academical_year) = req_arg(args, (
"personal_number", "department", "academical_year",
));
set heading(bookmarked: false, outlined: false);
set text(font: base_font);
set page(margin: 2cm);
pagebreak(weak: true);
@@ -278,9 +285,8 @@
// _ EMBEDDED
#let pdfembed(path) = {
import "@preview/muchpdf:0.1.1": muchpdf
set page(margin: 0em);
muchpdf(read(path, encoding: none));
import "../pdf.typ": embed_full
embed_full(read(path, encoding: none));
}
// ASSIGNMENT PAGE
@@ -337,6 +343,7 @@
"author.name",
));
let author_pronouns = get_arg(args, "author.pronouns");
set page(footer: none)
heading(get_lang_item(language, "disclaimer"), numbering: none, outlined: false);
par(
text(disclaimer(language, disclaimer_type, author_pronouns))
@@ -360,6 +367,7 @@
if is_none(content) {
return;
}
set page(footer: none)
heading(get_lang_item(language, "acknowledgement"), numbering: none, outlined: false);
par(content.at(language));
v(2em);
@@ -380,6 +388,7 @@
if not require and is_none(get_arg(args, "abstract.content")) {
return;
}
set page(footer: none)
heading(
text(req_arg(args, "title").at(language), font: base_font), numbering: none, outlined: false
);
@@ -457,19 +466,29 @@
// ABBREVIATION LIST
#let abbrlist(language) = {
#let abbrlist(language, hidden: false) = {
import "../abbreviations.typ": abbrlist
if hidden {
context {
let abbrs = abbrlist()
for abbr in abbrs.pairs() {
[#metadata("empty")#label("abbr_" + abbr.at(0))]
}
}
return
}
context {
let abbrs = abbrlist();
let max_abbr_width = if abbrs.len() > 0 {
calc.max(abbrs.keys().map((v) => measure(v).width)).at(0)
} else { return };
let abbr_pairs = abbrs.pairs().sorted(key: it => it.at(0))
pagebreak(weak: true);
heading(get_lang_item(language, "abbrs"), numbering: none);
align(center, grid(
columns: 2,
gutter: 1em,
..abbrs.pairs().map((a) => {
..abbr_pairs.map((a) => {
(
align(left, {
[
@@ -477,7 +496,7 @@
#label("abbr_" + a.at(0))
]
}),
text(a.at(1))
align(left, text(a.at(1)))
)
}).flatten()
));
@@ -492,7 +511,7 @@
block(text(it, weight: "bold", size: 1.2em), above: 1.5em);
};
context {
if query(heading.where(bookmarked: true)).len() > 0 {
if query(heading.where(outlined: true)).len() > 0 {
outline(title: get_lang_item(language, "toc"));
}
}
@@ -501,7 +520,7 @@
// BIBLIOGRAPHY
#let bibliogr(args) = {
let (language, citations_file) = req_arg(args, ("document.language", "citations"));
let (language, citations) = req_arg(args, ("document.language", "citations"));
let styles = (
"cs": "../citations/tul-csn690-numeric-square_brackets.csl",
"en": "../citations/iso690-numeric-square_brackets.csl",
@@ -510,7 +529,7 @@
context {
if query(ref.where(element: none)).len() > 0 {
bibliography(
citations_file,
citations,
style: style,
title: get_lang_item(language, "bibliography"),
);

View File

@@ -1,38 +1,43 @@
#import "../lang.typ": get_lang_item
#import "common.typ": (
mainpage,
default_styling,
assignment,
disclaimer,
abstract,
toc,
abbrlist,
imagelist,
tablelist,
bibliogr,
abbrlist, abstract, assignment, bibliogr, default_styling, disclaimer, imagelist, mainpage,
tablelist, toc,
)
#import "../attachments.typ": attachment_list
#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr
#import "../arguments.typ": req_arg
#import "../utils.typ": assert_dict_has, assert_in_arr, assert_not_none, is_none
#import "../arguments.typ": get_arg, map_arg, req_arg
#import "../theme.typ": faculty_color
#let other_title_page(args) = {
let (language, title) = req_arg(args, ("document.language", "title"));
assert_dict_has((language,), title, "title");
mainpage(args);
if req_arg(args, "document.content_only") {
return
}
let language = req_arg(args, "document.language")
let title = get_arg(args, "title")
map_arg(args, "title", v => { assert_dict_has((language,), v, "title") })
mainpage(args)
}
#let other_base(args, content) = {
let (language, title) = req_arg(args, ("document.language", "title"));
let language = req_arg(args, "document.language")
default_styling(true, faculty_color(req_arg(args, "document.faculty")), {
toc(language);
tablelist(language);
imagelist(language);
abbrlist(language);
pagebreak(to: "even", weak: true);
content;
bibliogr(args);
attachment_list(language);
}, language);
default_styling(
true,
faculty_color(req_arg(args, "document.faculty")),
{
if not req_arg(args, "document.content_only") {
toc(language)
tablelist(language)
imagelist(language)
abbrlist(language)
pagebreak(to: "even", weak: true)
} else {
abbrlist(language, hidden: true)
}
content
bibliogr(args)
attachment_list(language)
},
language,
)
}

View File

@@ -0,0 +1,133 @@
#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 header_margin = 20pt
#let footer_margin = header_margin
#let paper_compensation = (
presentation-4-3: 1.2570145903479237,
presentation-16-9: 1,
)
#let set_page_style(lang, faculty, faculty_color, paper, content) = {
context {
let footer_logotype = faculty_logotype(faculty, lang, long: false)
let footer_height = measure(footer_logotype).height + footer_margin
set page(paper: paper, margin: (bottom: footer_height, rest: 1cm), footer-descent: 0%, footer: {
text(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,
)
}), size: 11pt)
})
set text(size: 1.5em * paper_compensation.at(paper))
content
}
}
#let set_heading_styles(first_heading_is_fullpage, faculty_color, content) = {
let slide_title = (it) => {
pagebreak(weak: true)
box(it, inset: (top: 1em, bottom: 1em))
}
show heading.where(level: 1): it => {
if first_heading_is_fullpage {
page(place(center + horizon, it), header: none, margin: (top: 0em))
} else {
slide_title(it)
}
}
if first_heading_is_fullpage {
show heading.where(level: 2): it => {
slide_title(it)
}
content
} else {
content
}
}
#let apply_style(language, faculty, faculty_color, paper, first_heading_fullpage, content) = {
common_styling(
faculty_color, language,
set_page_style(
language, faculty, faculty_color, paper,
set_heading_styles(first_heading_fullpage, faculty_color, content)
)
)
}
#let fullpage(language, faculty, faculty_color, content, paper) = {
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, paper) = {
fullpage(language, faculty, faculty_color, {
content
place(center + bottom, text(author, white.transparentize(30%), size: 1.25em, font: base_font))
}, paper)
}
#let mainpage(language, faculty, faculty_color, title, author, paper) = {
signedpage(language, faculty, faculty_color, author, {
place(center + horizon, text(
title, size: 2em * paper_compensation.at(paper), font: "TUL Mono", white
))
}, paper)
}
#let thankspage(language, faculty, faculty_color, author, paper) = {
signedpage(language, faculty, faculty_color, author, {
place(center + horizon, text(
get_lang_item(language, "thanks_for_attention"),
size: 2em * paper_compensation.at(paper),
font: "TUL Mono",
white,
))
}, paper)
}
#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")
let paper = if presentation_args.at("wide") {
"presentation-16-9"
} else {
"presentation-4-3"
}
mainpage(
language, faculty, faculty_color,
req_arg(args, "title").at(language), author, paper,
)
apply_style(language, faculty, faculty_color, paper,
presentation_args.at("first_heading_is_fullpage"), {
content
bibliogr(args)
},
)
if presentation_args.at("append_thanks") {
thankspage(language, faculty, faculty_color, author, paper)
}
}

View File

@@ -91,10 +91,12 @@
"place_assignment": "Sem vložte zadání",
"thanks_for_attention": "Děkuji za pozornost",
"break_rules": {
"space_after": [
"((?i)[kosuvzai])",
"(tj|tzv|tzn)\\."
"(tj|tzv|tzn|např)\\."
],
"nonbreaking_terms": [
"(s\\. r\\. o|a\\. s|v\\. o\\. s)\\.",
@@ -158,11 +160,13 @@
"abbrs": "List of abbreviations",
"image_list": "List of images",
"table_list": "List of tables",
"attachments": "Attachments",
"attachment": "Attachment",
"attachments": "Appendix",
"attachment": "Appendix",
"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"
}
}

12
template/pdf.typ Normal file
View File

@@ -0,0 +1,12 @@
#let embed_full(src) = {
import "./lib/much_pdf_tools/lib.typ": pdf_count_pages;
let page_count = pdf_count_pages(src);
for idx in range(0, page_count) {
page(
place(center + horizon, image(src, page: idx + 1, fit: "contain", width: auto, height: auto)),
margin: 0cm,
footer: none,
header: none,
);
}
}

View File

@@ -39,6 +39,8 @@
// - 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_only (bool): Whether to output content only (this works for documents of type `other`)
// - content (content): The content of the document
//
//-> none
@@ -50,10 +52,12 @@
title_pages: none,
title: none, keywords: none, abstract: none, acknowledgement: none, author: none,
author_pronouns: none, supervisor: none, consultant: none, programme: none,
specialization: none, year_of_study: none,
specialization: none, year_of_study: none, content_only: false,
// links
assignment: none, citations: "citations.bib",
// nested
assignment: none, presentation: none,
citations: "citations.bib",
// content
content,
@@ -69,7 +73,7 @@
)
let args = arguments(
document_info(style, faculty, lang, document),
document_info(style, faculty, lang, document, content_only),
title_pages,
title,
author_info(author, author_pronouns, programme, specialization, year_of_study),
@@ -77,6 +81,7 @@
abstract_info(abstract, keywords),
acknowledgement,
assignment,
presentation,
citations,
);
check_arguments(args);
@@ -121,7 +126,7 @@
req_arg,
)
let args = arguments(
document_info(style, faculty, lang, document),
document_info(style, faculty, lang, document, false),
none,
title,
author_info(author, author_pronouns, programme, specialization, year_of_study),
@@ -129,6 +134,7 @@
abstract_info(none, none),
none,
assignment,
none,
"",
);
check_arguments(args);

View File

@@ -9,6 +9,10 @@
"TECHNICKÁ UNIVERZITA V LIBERCI&",
"TECHNICAL UNIVERSITY OF LIBEREC&",
),
(
"TUL&",
"TUL&",
),
),
fs: (
@@ -17,6 +21,10 @@
"FAKULTA STROJNÍ TUL&",
"FACULTY OF MECHANICAL ENGINEERING TUL&",
),
(
"FS TUL&",
"FME TUL&",
),
),
ft: (
@@ -25,6 +33,10 @@
"FAKULTA TEXTILNÍ TUL&",
"FACULTY OF TEXTILE ENGINEERING TUL&",
),
(
"FT TUL&",
"FT TUL&",
),
),
fp: (
@@ -33,6 +45,10 @@
"FAKULTA\nPŘÍRODOVĚDNĚ-HUMANITNÍ\nA PEDAGOGICKÁ TUL&",
"FACULTY OF SCIENCE,\nHUMANITIES AND\nEDUCATION TUL&",
),
(
"FP TUL&",
"FED TUL&",
),
),
ef: (
@@ -41,6 +57,10 @@
"EKONOMICKÁ FAKULTA TUL&",
"FACULTY OF ECONOMICS TUL&",
),
(
"EF TUL&",
"FE TUL&",
),
),
fua: (
@@ -49,6 +69,10 @@
"FAKULTA UMĚNÍ A ARCHITEKTURY TUL&",
"FACULTY OF ARTS AND ARCHITECTURE TUL&",
),
(
"FUA TUL&",
"FAA TUL&",
),
),
fm: (
@@ -57,6 +81,10 @@
"FAKULTA MECHATRONIKY,\nINFORMATIKY A MEZIOBOROVÝCH\nSTUDIÍ TUL&",
"FACULTY OF MECHATRONICS,\nINFORMATICS AND\nINTERDISCIPLINARY STUDIES TUL&",
),
(
"FM TUL&",
"FM TUL&",
),
),
fzs: (
@@ -65,6 +93,10 @@
"FAKULTA ZDRAVOTNICKÝCH STUDIÍ TUL&",
"FACULTY OF HEALTH STUDIES TUL&",
),
(
"FZS TUL&",
"FHS TUL&",
),
),
cxi: (
@@ -73,6 +105,10 @@
"ÚSTAV PRO NANOMATERIÁLY,\nPOKROČILÉ TECHNOLOGIE\nA INOVACE TUL&",
"INSTITUTE FOR NANOMATERIALS,\nADVANCED TECHNOLOGY\nAND INNOVATION TUL&",
),
(
"CXI TUL&",
"CXI TUL&",
),
),
);
@@ -89,21 +125,29 @@
return theme_color;
}
#let faculty_logotype_text(faculty_id, lang) = {
#let faculty_logotype_text(faculty_id, lang, long: true) = {
let theme = faculty_theme(faculty_id);
let logotype_text = theme.at(1).at(lang_id(lang));
let logotype_text = theme.at(if long { 1 } else { 2 }).at(lang_id(lang));
assert(type(logotype_text) == str);
return logotype_text;
}
#let faculty_logotype(faculty_id, lang) = {
let theme_color = faculty_color(faculty_id);
let logotype_text = faculty_logotype_text(faculty_id, lang);
#let faculty_logotype(faculty_id, lang, color: none, long: true) = {
let theme_color = if type(color) == type(none) {
faculty_color(faculty_id)
} else {
color
};
let logotype_text = faculty_logotype_text(faculty_id, lang, long: long);
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)
}

397
template/type_signature.typ Normal file
View File

@@ -0,0 +1,397 @@
#let doc(inner, argument_name, explanations) = {
inner.doc = (argname: argument_name, expl: explanations)
inner
}
#let type_primitive(id, name, cs_name, en_name) = {
(type: "primitive", type_id: id, type_name: name, primitive_expl: (cs: cs_name, en: en_name))
}
#let int = type_primitive("integer", "an 'integer'", "celé číslo", "a whole number");
#let float = type_primitive("float", "a 'float'", "desetinné číslo", "a decimal number");
#let bool = type_primitive("boolean", "a 'boolean'", "pravdivostní hodnota", "a truthiness value");
#let string = type_primitive("string", "a 'string'", "textový řetězec", "a text string");
#let cont = type_primitive(
"content",
"a 'content'",
"obsah generovaný Typst syntaxí",
"content generated with Typst syntax",
);
#let null = type_primitive("none", "a 'none'", "prázdná hodnota", "empty value");
#let literal(value) = {
(type: "literal", value: value)
}
#let variants(..variants) = {
(type: "variants", variants: variants.pos())
}
#let slice(items) = {
(type: "slice", items: items)
}
#let tuple(..items) = {
(type: "tuple", items: items.pos())
}
#let keyval(key, val) = {
(type: "keyval", key: key, val: val)
}
#let dict(keyval) = {
(type: "dictionary", key: keyval.key, val: keyval.val)
}
#let struct(..keyvals) = {
let copy_doc(from, to) = {
if "doc" in from {
let to = to
to.doc = from.doc
to
} else {
to
}
}
let keyvals = keyvals.pos()
let res = ().to-dict()
for keyval in keyvals {
if keyval.key.type != "literal" {
panic("invalid type signature, struct keys must be literals")
}
res.insert(keyval.key.value, copy_doc(keyval, keyval.val))
}
(type: "struct", pairs: res)
}
#let dbg_literal(literal, is_content: false) = {
let res = if type(literal) == str {
"\"" + literal + "\""
} else {
"'" + str(literal) + "'"
}
if is_content {
raw(res)
} else {
res
}
}
#let dbg_type(value) = {
str(type(value))
}
#let signature_check(value, signature, name_prefix) = {
let error_target_name(target, name_prefix) = {
name_prefix + if "doc" in target { " ('" + target.doc.argname + "')" } else { "" }
}
let error_value_name(value) = {
str(type(value))
}
let error_expected_type(target) = {
if target.type == "variants" {
let variants = target.variants
let last = variants.pop()
let res = (variants.map(v => { error_expected_type(v) })).join(", ")
if type(last) != type(none) {
if type(res) != type(none) {
res + " or " + error_expected_type(last)
} else {
error_expected_type(last)
}
} else {
res
}
} else if target.type == "slice" or target.type == "tuple" {
"an array"
} else if target.type == "dictionary" or target.type == "struct" {
"a dictionary/hashmap"
} else if target.type == "primitive" {
target.type_name
} else if target.type == "literal" {
dbg_literal(target.value)
} else {
panic()
}
}
let error(target, name_prefix, value, is_value: false, target_doc: none) = {
(
if type(target_doc) != type(none) {
error_target_name(target_doc)
} else {
error_target_name(target, name_prefix)
}
+ (
" of type '"
+ dbg_type(value)
+ "' is unexpected, expected "
+ error_expected_type(target)
)
)
}
let in_variants(value, variants, matcher) = {
for variant in variants {
if matcher(value, variant).at(0) == true {
return true
}
}
false
}
let opt_suffix(prefix, suffix: " ") = {
if prefix.len() == 0 {
""
} else {
prefix + suffix
}
}
let matches_type(value, target, name_prefix: "") = {
if target.type == "variants" {
return if in_variants(value, target.variants, matches_type.with(name_prefix: name_prefix)) {
(true,)
} else {
(false, error(target, name_prefix, value, is_value: true))
}
} else if target.type == "literal" {
return if value != target.value {
(false, error(target, name_prefix, value, is_value: true))
} else {
(true,)
}
}
if type(value) == dictionary {
if target.type == "struct" {
for key in target.pairs.keys() {
if key not in value {
return (
false,
(
error_target_name(target, name_prefix)
+ " is missing an entry for key "
+ dbg_literal(key)
),
)
}
}
for (key, val) in value.pairs() {
if key not in target.pairs {
return (
false,
opt_suffix(name_prefix) + "contains an unexpected key " + dbg_literal(key),
)
}
let res = matches_type(
val,
target.pairs.at(key),
name_prefix: opt_suffix(name_prefix) + str(key),
)
if not res.at(0) {
return res
} else {
res
}
}
} else if target.type == "dictionary" {
for (key, val) in value.pairs() {
let cur = matches_type(key, target.key, name_prefix: opt_suffix(name_prefix) + "key")
if not cur.at(0) {
return cur
}
let cur = matches_type(val, target.val, name_prefix: opt_suffix(name_prefix) + "value")
if not cur.at(0) {
return cur
}
}
(true,)
} else {
(false, error(target, name_prefix, value))
}
} else if type(value) == array {
if target.type == "slice" {
for (idx, val) in value.enumerate() {
let cur = matches_type(
val,
target.items,
name_prefix: opt_suffix(name_prefix) + "item at index " + str(idx),
)
if not cur.at(0) {
return cur
}
}
(true,)
} else if target.type == "tuple" {
for (idx, target) in target.items.enumerate() {
if idx >= value.len() {
return (
false,
opt_suffix(name_prefix) + "is missing an item: " + error_expected_type(target),
)
}
let cur = matches_type(
value.at(idx),
target,
name_prefix: opt_suffix(name_prefix) + "item at index " + str(idx),
)
if not cur.at(0) {
return cur
}
}
(true,)
} else {
(false, error(target, name_prefix, value))
}
} else {
if target.type != "primitive" or str(type(value)) != target.type_id {
(false, error(target, name_prefix, value))
} else {
(true,)
}
}
}
matches_type(value, signature, name_prefix: name_prefix)
}
#let signature_docs(target, is_nested: false, lang: "en") = {
let lang_expr = (
with_keys: (cs: "S klíči", en: "With keys"),
with_values: (cs: "S hodnotami", en: "With values"),
empty: (cs: [prádzné (_none_)], en: [empty (_none_)]),
struct: (
cs: [slovník s přesnými atributy (_dictionary_)],
en: [a dictionary with exact atributes (_dictionary_)],
),
dict: (cs: [slovník (_dictionary_)], en: [_dictionary_]),
slice: (cs: [pole různé délky (_array_): ], en: [variable-length array (_array_): ]),
tuple: (cs: [pole s přesnými prvky (_array_): ], en: [array with exact items (_array_): ]),
)
let typeinfo(target, flatten: false, disable_doc: false) = {
let try_doc(target, mapper: v => { v }) = {
if "doc" in target and not disable_doc {
mapper(target.doc.expl.at(lang))
} else {
""
}
}
if target.type == "struct" {
if not flatten {
lang_expr.struct.at(lang)
try_doc(target, mapper: v => {
[ -- ]
v
})
":"
}
list(..target
.pairs
.pairs()
.map(((key, val)) => {
raw(key)
try_doc(val, mapper: v => {
[ -- ]
text(v)
})
": "
typeinfo(val, disable_doc: true)
}))
} else if target.type == "dictionary" {
lang_expr.struct.at(lang)
try_doc(target, mapper: v => {
[ -- ]
v
})
":"
list(
{
lang_expr.with_keys.at(lang) + ": "
typeinfo(target.key)
},
{
lang_expr.with_values.at(lang) + ": "
typeinfo(target.val)
},
)
} else if target.type == "slice" {
try_doc(target, mapper: v => {
v
": "
})
lang_expr.slice.at(lang)
typeinfo(target.items, disable_doc: true)
} else if target.type == "tuple" {
try_doc(target, mapper: v => {
v
": "
})
lang_expr.tuple.at(lang)
list(..target.items.map(v => {
list.item({
typeinfo(v)
})
}))
} else if target.type == "primitive" {
if target.type_id == "none" {
lang_expr.empty.at(lang)
try_doc(target, mapper: v => {
[ -- ]
text(v)
})
} else {
text(target.primitive_expl.at(lang) + " (")
text(target.type_id, style: "italic")
text(")")
try_doc(target, mapper: v => {
[ -- ]
text(v)
})
}
} else if target.type == "variants" {
try_doc(target, mapper: v => {
text(v)
":"
})
list(..target.variants.map(v => {
list.item({
typeinfo(v)
})
}))
} else if target.type == "literal" {
dbg_literal(target.value, is_content: true)
try_doc(target, mapper: v => {
[ -- ]
text(v)
})
} else {
panic()
}
}
let args = ()
if target.type == "struct" {
for val in target.pairs.values() {
args.push(signature_docs(val, is_nested: true, lang: lang))
}
} else {
if "doc" in target and type(target.doc.argname) != type(none) {
args.push({
raw(target.doc.argname)
[ -- ]
typeinfo(target)
})
}
}
if not is_nested {
list(spacing: 2em, ..args.flatten())
} else {
args.flatten()
}
}

17
tests/pdf_embedding.typ Normal file
View File

@@ -0,0 +1,17 @@
#import "../template/pdf.typ": number_of_pages, embed_full
#let pdfinfo(src, target_pagecount) = {
let pdf = read(src, encoding: none);
let pagecount = number_of_pages(pdf);
[
= #src
Pagecount: #pagecount
];
place(bottom + right, [Starting on next page]);
assert(pagecount == target_pagecount);
embed_full(pdf);
}
#pdfinfo("./pdf_embedding_01.pdf", 1)
#pdfinfo("./pdf_embedding_02.pdf", 2)
#pdfinfo("./pdf_embedding_03.pdf", 1)

BIN
tests/pdf_embedding_01.pdf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
tests/pdf_embedding_02.pdf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
tests/pdf_embedding_03.pdf (Stored with Git LFS) Normal file

Binary file not shown.

37
theses/assignment.typ Normal file
View File

@@ -0,0 +1,37 @@
#let color = red
#set text(font: "Inter")
#set page(foreground: rect(
width: 90%,
height: 90%,
stroke: (paint: color, thickness: .03em, dash: (.5em, .5em))
))
#set text(lang: "cs")
#align(center + horizon, text([
*Nahraďte soubor "`assignment.pdf`"* souborem se zadáním.
], color, 2em))
#text([
To můžete v online Typst editoru udělat takto:
+ Soubor se zadáním stáhněte ze systému. Pokud vaše fakulta nemá žádný systém, požádejte svého vedoucího o PDF soubor se zadáním.
+ Přejmenujte ho na "`assignment.pdf`".
+ Otevřete v online Typst editoru prohlížeč souborů.
+ Přetáhněte svůj přejmenovaný soubor do prohlížeče souborů.
+ Pokud jste vše udělali správně, vyskočí vám okno, které se vás ptá, jestli chcete soubor přepsat -- klikněte na přepsat (v angličtině overwrite).
], black, 11pt)
#pagebreak()
#set text(lang: "en")
#align(center + horizon, text([
*Replace file "`assignment.pdf`"* with your assignment document.
], color, 2em))
#text([
In the online Typst editor you can do it as follows:
+ Download the assignment file from the system. If your faculty doesn't have a system, ask your supervisor for a PDF file with the assignment.
+ Rename it to "`assignment.pdf`".
+ Open the file browser in the online Typst editor.
+ Drag and drop your renamed file into the file browser.
+ If you did everything correctly, a window will popup, asking you if you want to overwrite the file --- click on overwrite.
], black, 11pt)

View File

@@ -26,8 +26,8 @@
],
),
title: (
cs: [Ukázka dokumentu typu Bakalářská práce pro FM TUL v čtině],
en: [Example document for a Bachelor's thesis for FM TUL in Czech],
cs: [Ukázka dokumentu typu Bakalářská práce pro FM TUL v angličtině],
en: [Example document for a Bachelor's thesis for FM TUL in English],
),
author: [Matěj Žucha],
author_pronouns: "me",

View File

@@ -2,41 +2,81 @@
#show: tultemplate2
= Co najdete v této šabloně
= Úvod do této šablony
Tato šablona sloužit jako ukázka práce typu `{{ta}}` v jazyce *Typst* a šabloně
*tultemplate2*. Může posloužit jako jednoduchý základ i pro vaši práci, stačí se naučit používat
pár užitečných funkcí, jako např. vkládání obrázků, tabulek, citací nebo odkazů.
Tato šablona sloužit jako ukázka práce typu `{{ta}}` v nástroji *Typst* a šabloně *tultemplate2*.
Může posloužit jako jednoduchý základ i pro vaši práci, stačí se naučit používat pár užitečných funkcí, jako např. vkládání obrázků, tabulek, citací nebo odkazů.
Na rozdíl od souboru _documentation.typ_, který je dostupný ke stažení na stránkách projektu, obsahuje
tento dokument jenom to nejpotřebnější ze znalostí, co postačí k úspěšnému napsání práce. Pokud vám budou nějaké funkce chybět, můžete se podívat do zmíněného souboru, anebo kontaktovat některého z autorů, kteří se vám pokusí pomoct. Jen pro úplnost je zde ve zkratce něco málo o jazyce typst a motivaci k tvorbě této šablony:
Na rozdíl od souboru _documentation.typ_, který je dostupný ke stažení na stránkách projektu, obsahuje tento dokument jenom to nejpotřebnější ze znalostí, co postačí k úspěšnému napsání práce.
Pokud vám budou nějaké funkce chybět, můžete se podívat do zmíněného souboru, anebo kontaktovat některého z autorů, kteří se vám pokusí pomoct.
Jen pro úplnost je zde ve zkratce něco málo o nástroji Typst a motivaci k tvorbě této šablony:
Typst je profesionální sázecí nástroj podobný markdownu, LaTeXu/TeXu, groffu, atd.
Typst je profesionální sázecí nástroj podobný Markdownu, LaTeXu/TeXu, Groffu, atd.
Typst je moderní obdobou starších nástrojů, které postrádají spoustu důležitých funkcí, bez kterých
se v dnešní době prakticky nedá fungovat. Uživatel často musí importovat nepřeberné množství
balíčků, které poskytují (podle mě) naprosto základní funkcionalitu - jako například správná podpora
UTF-8 znaků, formátování prvků na základě jazykového lokálu, apod.
Typst je moderní obdobou starších nástrojů, které postrádají spoustu důležitých funkcí, bez kterých se v dnešní době prakticky nedá fungovat.
Uživatel často musí importovat nepřeberné množství balíčků, které poskytují (podle mě) naprosto základní funkcionalitu -- jako například správná podpora UTF-8 znaků, formátování prvků na základě jazykového lokálu, apod.
= Začínáme se šablonou
== Začínáme pracovat
Tuto šablonu jste si pravděpodobně stáhli z generátoru na webu www.tulsablona.cz a vložili ji do Typst
online editoru. Tím pádem vidíte kromě zdrojového kódu také výsledný PDF soubor. Jak asi víte, hlavní
rozdíl mezi tradičními textovými procesory jako Microsoft Word nebo LibreOffice Writer a mezi sázecími
programy jako LaTeX nebo Typst je právě způsob, kterým se upravuje vzhled a obsah dokumentu.
Tuto šablonu jste si pravděpodobně stáhli z generátoru na webu https://tulsablona.zumepro.cz a vložili ji do Typst online editoru.
Tím pádem vidíte kromě zdrojového kódu také výsledný PDF soubor.
Jak asi víte, hlavní rozdíl mezi tradičními textovými procesory jako Microsoft Word nebo LibreOffice Writer a mezi sázecími programy jako LaTeX nebo Typst je právě způsob, kterým se upravuje vzhled a obsah dokumentu.
Zatímco ve Wordu jsou uživatelé zvyklí, že pomocí tlačítek a klávesových zkratek mění dokument napřímo,
Typst (a i LaTeX) používají tzv. zdrojový soubor, který není ničím jiným než obyčejným textovým souborem,
a následně na vyžádání umí tento zdrojový soubor zkompilovat tj. proměnit na výsledný dokument, např. ve formátu PDF.
Zatímco ve Wordu jsou uživatelé zvyklí, že pomocí tlačítek a klávesových zkratek mění dokument napřímo, Typst (a i LaTeX) používají tzv. zdrojový soubor, který není ničím jiným než obyčejným textovým souborem, a následně na vyžádání umí tento zdrojový soubor zkompilovat tj. proměnit na výsledný dokument, např. ve formátu PDF.
Proto zde najdete popis všech důležitých funkcí nikoliv jako galerii obrázků toho, na která tlačítka se
klikat, nýbrž jako ukázka a návod všech speciálních sekvencí textu, které Typst podporuje a které šablona vyhodnocuje jinak než obsah zprávy.
Proto v tomto dokumentu najdete popis všech důležitých funkcí nikoliv jako galerii obrázků toho, na která tlačítka se klikat, nýbrž jako ukázka a návod všech speciálních sekvencí textu, které Typst podporuje a které šablona vyhodnocuje jinak než obsah zprávy.
#rect[
*TIP*:
Uložte si tento dokument pro pozdější použití.
budete hledat nějakou specifickou funkci, můžete se k prokliknout přes seznam obsahu nahoře.
]
== Hlavička a obsah
Když se podíváte na zdroj dokumentu (vlevo, pokud jste v online editoru), tak si můžete všimnout, že zdroj se skládá z dvou hlavních části: hlavičku (ta na první pohled může vypadat docela strašidelně) a obsah.
=== Hlavička
Hlavička definuje všechny potřebné informace pro úspěšné vygenerování dokumentu -- například fakultu, název práce, atd.
Údaje v hlavičce buď můžete upravit rovnou ručně, nebo se k obsahu prokliknout a začít psát.
Na to navážeme hned v další kapitole.
=== Obsah
Obsah je z většiny samotný text vaší práce.
Zdroj dokumentu, kromě samotného textu, také obsahuje speciální znaky (odborně tomu říkáme syntaxe), které Typstu vysvětlí jak si dokument přejete naformátovat.
== Klikatelný obsah v hlavičce
Pokud používáte oficiální Typst online editor, můžete jednoduše klepnout na téměř jakýkoliv text na pravé půlce obrazovky (náhledové PDF), a editor podle toho automaticky přesune váš kurzor na správné místo.
Je to sice drobná, ale zato velmi užitečná funkce.
#rect[
*TIP*:
Zkuste například dvakrát poklepat na obsah abstraktu (nebo název práce u projektů a semestrálních prací -- pokud nemáte titulní strany ze STAGu) a začít psát.
]
== Kontrola šablony při kompilaci
Tato šablona je vytvořena tak, že když se ji pokusíte zkompilovat s nesprávnou syntaxí nebo s nějakou chybějící důležitou částí hlavičky, nenechá vás to provést.
Vždy se podívejte na chybové hlášky, které šablona vypisuje, protože vás snadno navedou k opravě všech chyb.
Můžete to vyzkoušet tak, že smažete něco z hlavičky nebo že např. použijete funkci, která není nikde definovaná.
Pokud jste hlavičku vygenerovali z generátoru -- neměli byste s mít žádné problémy.
Generátor je nastaven tak, aby vás nenechal vygenerovat špatnou hlavičku.
= Základní formátování obsahu
Formátování (sázení) textu v Typstu je ve většině případů velice jednoduché.
V této kapitole vám ukážeme nějaké základy, které budete běžně používat.
== Odstavce
Jak jsou někteří z vás možná zvyklí z Markdownu, odstavce, nadpisy a vlastně pro přehlednost všechny
logicky oddělené bloky se oddělují prázným řádkem. Toho jste si jistě mohli při prohlížení tohoto souboru
všimnout. Můžete si vyzkoušet, co se stane, když
Jak jsou někteří z vás možná zvyklí z Markdownu, odstavce, nadpisy a vlastně pro přehlednost všechny logicky oddělené bloky se oddělují prázným řádkem.
Toho jste si jistě mohli při prohlížení tohoto souboru všimnout.
Můžete si vyzkoušet, co se stane, když
použijete jenom ukončení řádku enterem,
nebo když použijete zmíněný prázdný řádek,
@@ -55,29 +95,21 @@ formátování
a sám si obsah dělí na řádky, protože ve výsledném PDF souboru se stejně spojí do jednoho celistvého odstavce.
Musí akorát ručně dbát na to, aby odstavce nebyly příliš krátké, ani příliš dlouhé.
S souvislosti s odstavci bych ještě zmínil, že Typst se za vás stará také o zarovnávání písma a slov do bloků
a dělení slov mezi řádky, když se na něj nevejdou. Chováním odpovídá pravidlům českého pravopisu a typografie, takže se o to nemusíte vůbec starat.
== Klikatelný obsah
Pokud používáte oficiální Typst online editor, můžete jednoduše klepnout na jakýkoliv text v pravé části (náhledové PDF), který se měnit,
a editor podle toho automaticky přesune váš kurzor na správné místo.
Je to sice drobná, ale zato velmi užitečná funkce.
V souvislosti s odstavci bych ještě zmínil, že Typst se za vás stará také o zarovnávání písma a slov do bloků
a dělení slov mezi řádky, když se na něj nevejdou.
== Nadpisy
První důležitá funkce kromě psaní samotného textu, k čemuž není zapotřebí žádná speciální syntax, jsou nadpisy.
Stejně jako v jiných programech, i Typst podporuje nadpisy více úrovní. Pro nadpis první úrovně se používá znaménko
rovná se a mezera na začátku řádku, čili ve zdrojovém souboru Typstu je používán takto:
První důležitá funkce kromě psaní samotného textu, k čemuž není zapotřebí žádná černá magie, jsou nadpisy.
Stejně jako v jiných programech, i Typst podporuje nadpisy více úrovní. Pro nadpis první úrovně se používá znaménko rovná se a mezera na začátku řádku, čili ve zdrojovém souboru Typstu je používán takto:
```typst
= Můj nadpis první úrovně
```
Pro nadpis druhé úrovně pak použijeme dvě rovná se, pro nadpis třetí úrovně tři rovná se.
Šablona *tultemplate2* Vám ovšem bohužel nedovolí nadpis čtvrté a další úrovně, protože by takový
nadpis porušoval směrnice TUL o formátování dokumentů. Ale nemusíte se bát. Pokud takový nadpis
uděláte -- šablona vyhodí chybu, aby vás na to upozornila.
Šablona *tultemplate2* Vám ovšem bohužel nedovolí nadpis čtvrté a další úrovně, protože by takový nadpis porušoval směrnice TUL o formátování dokumentů.
Ale nemusíte se bát. Pokud takový nadpis uděláte -- šablona vyhodí chybu, aby vás na to upozornila.
```typst
= Nadpis
@@ -89,47 +121,112 @@ A pak obsah
== Číslování kapitol
Asi jste si všimli, že každý nadpis začíná číslem dané kapitoly. Toto číslování provádí Typst automaticky, promítne se následně i v sekci Obsah na začátku souboru, nemusíte se tak opět o nic starat.
Asi jste si všimli, že ve výstupu každý nadpis začíná číslem dané kapitoly.
Toto číslování provádí Typst automaticky, promítne se následně i v sekci *Obsah* na začátku souboru, nemusíte se tak opět o nic starat.
= Kontrola šablony při kompilaci
Tato šablona je vytvořena tak, že když se ji pokusíte zkompilovat s nesprávnou syntaxí nebo s nějakou
chybějící důležitou částí hlavičky,
nenechá vás to provést. Vždy se podívejte na chybové hlášky, které šablona vypisuje, protože vás snadno navedou k opravě všech chyb.
Můžete to vyzkoušet tak, že smažete něco z hlavičky nebo že např. použijete funkci, která není nikde definovaná.
= Používání funkcí
Používání většiny funkcionalit Typstu je prováděno pomocí tzv. volání funkce. Je to velmi podobné předchozím ukázkám,
akorát místo toho, aby se text obalil pouze jedním symbolem či podobnou jednoduchou značkou, obalíme text jménem dané funkce. Syntaxe vypadá nějak takto:
```typst
#Název_funkce[samotný text nebo jiné parametry]
```
Pokud v editoru napíšete symbol hashtagu, začne vám automaticky našeptávat všechny možné funkce a jejich popisy. Přejdeme rovnou k dalším praktickým příkladům.
#rect[
*TIP*:
Schválně si zkuste napsat nadpis čtvrté úrovně.
Alespoň se tak jednodušše seznámíte se způsobem, jakým vám tato šablona skrz Typst hlásí chyby.
Pokud se při poklikání na error ocitnete v jiném souboru -- prostě se jednodušše vraťte přes menu souborů.
]
== Zvýrazňování textu
Syntaxe základního zvýraznění je velmi podobná například Markdownu. Stačí použít následující symboly:
Syntaxe základního zvýraznění je velmi podobná například Markdownu.
Stačí použít následující symboly:
```typst
*tučně*
_kurzívou_
#highlight[zvýrazněno]
```
Další stylování lze dělat právě přes funkce, viz třeba:
```typst
#strike[přeškrtnuto]
#highlight[zvýrazněno]
#underline[podtrženo] // podtržení by se NEMĚLO používat
```
Pro úplnost a ukázku je zde přímo v textu *tučný text*, _text kurzívou_, #strike[přeškrtnutý text] a #highlight[text zvýrazněný podle barvy příslušící vaší fakultě], #underline[podtržený text] (ačkoli typografové doporučují podtržení nepoužívat).
Pro úplnost a ukázku je zde přímo v textu *tučný text*, _text kurzívou_, #strike[přeškrtnutý text] a #highlight[text zvýrazněný podle barvy příslušící vaší fakultě].
Lze sázet také #underline[podtržený text] (ačkoli typografové doporučují podtržení nepoužívat).
== Zalamování řádků
Typst vám nějak zalomil řádek a vám se to nelíbí? Pojďme to vyřešit.
=== Nucené zalomení rádku
Pokud chcete vynutit zalomení, stačí na konec řádku ve zdrojovém souboru napsat znak "`\`".
Například:
```typst
*Alice*: Jak napsat skvělou práci? \
*Bob*: Pomocí Typstu!
```
V příkladu výše bude otazník posledním znakem prvního řádku -- Typst nám tady řádky nespojí.
=== Nezalomitelná mezera
Možná jste tento pojem někdy slyšeli.
Pokud chcete například napsat nějaký název a nemá v něm být zalomení řádku, můžete použít znak "`~`".
Ukázka:
```typst
Ano, chodím na Technickou univerzitu v~Liberci.
```
V ukázce výše ve výstupu Typst nikdy neukončí řádek mezi písmenem "v" a slovem "Liberci".
Vlnovka se ve výstupu nezobrazí -- místo bude mezera.
== Jak napsat speciální znak
Znaky jako `_`, `*`, `~`, ... jsou speciální (jak nyní víte).
Ale co když je chcete napsat... jako opravdu napsat (do své práce).
Stačí před jakýkoliv znak napsat zpětné lomítko (AltGr / Pravý Alt + Q na české klávesnici na Windows/Linuxu, Na Macu klávesa vedle levého shiftu) a stane se z něj znak normální.
```typst
Takhle tedy můžete například zapsat znak podtržítka: \_
```
Takhle tedy můžete například zapsat znak podtržítka: \_
Chcete napsat samotné zpětné lomítko?
Uhádnete jak se to dělá? ... Dáte před něj zpětné lomítko.
```typst
Nějak takhle: \\
```
Nějak takhle: \\
== Pomlčky
Možná jste někdy slyšeli, že pokud napíšete na klávesnici pomlčku, tak to není skutečná pomlčka.
Píšete totiž ve skutečnosti spojovník, který se má používat na slovo-spojování.
Jak napsat pomlčku? Stačí napsat víc spojovníků za sebou.
```typst
-- // Krátká pomlčka
--- // Dlouhá pomlčka
```
#highlight[
V češtině se k účelům spojování logických celků používá výhradně krátká pomlčka -- tedy "--".
]
#rect[
*TIP*:
Zkuste si znaky zkopírovat a vložit například do #link("https://apps.timwhitlock.info/unicode/inspect")[Unicode Inspektoru] -- ten vám ukáže podrobnosti o nějakém znaku.
]
== Odkazy<links>
Odkazy je možné dělat na URL/URI zdroje, e-maily, telefony, atd...
Odkázat URL (URI) je možné bez zavolání funkce, odkaz stačí prostě a jednodušše napsat:
Odkazy je možné dělat na URL/URI zdroje, emaily, telefony, atd...
Odkázat na URL (URI) je možné bez zavolání funkce, odkaz stačí prostě a jednodušše napsat:
https://git.zumepro.cz/tul/tultemplate2
```typst
@@ -138,21 +235,196 @@ https://git.zumepro.cz/tul/tultemplate2
Tohle interně volá funkci `link`.
Pokud odkazujeme na méně časté věci (jako e-maily), můžeme použít funkci `link` přímo.
Pokud odkazujeme na méně časté věci (jako emaily), můžeme použít funkci `link` přímo:
```typst
#link("mailto:ondrej@mekina.cz")
#link("mailto:info@tul.cz")[Email TUL informací]
```
Funkci link nejprve v kulatých závorkách dáte cíl odkazu (například URL adresu) a dále v hranatých závorkách obsah, který se zobrazí v dokumentu.
Dalši předpony (URI schémata) můžete najít třeba na Wikipedii
https://en.wikipedia.org/wiki/List_of_URI_schemes.
== Citace
Šablona podporuje správu citací pomocí standardního BibLaTeX @bibtex souboru, stejně jako například LaTeX.
Generování citací v BibLaTeX zápisu umí téměř každá stránka nebo program, které mají pro citace podporu -- doporučujeme použít buď #link("https://www.zotero.org/")[Zotero] nebo #link("https://www.citacepro.com/")[Citace.com].
Kód takovéto citace ve vhodném formátu stačí přidat do souboru _citations.bib_, poté je možné se na odkazovat pomocí `@jmeno_citace`, nebo `#cite(<jmeno_citace>)`.
Můžu se tak třeba odkázat na citaci Typstu #cite(<typst>).
Formát souboru _citations.bib_ je naprosto stejný jako pro LaTeX.
Tyto citace lze přímo vložit třeba z webu https://www.citace.com ve formátu BibLaTeX -- Typst tento formát také umí přečíst.
Můžete se do souboru s příponou .bib podívat, zjistíte, že je to opravdu jen obyčejný textový soubor se specifickou strukturou.
V přiloženém ukázkovém souboru nějaké citace jsou - např. již použitá citace se jménem `typst`.
Soubor, ze kterého se načtou citace lze změnit pomocí argumentu šablony (tj. struktura na začátku souboru):
```typst
#show: tultemplate2.with(
...
citations: "jinysoubor.bib",
...
)
```
== Vnitřní odkazy a kotvy<ukazka_odkazu>
Trochu navážeme na *Odkazy* (@links).
Můžete dělat i vnitřní odkazy třeba na kapitoly, stránky nebo obrázky s popiskem (zabalené ve `figure`).
```typst
= Dobrá kapitola<dobra_kapitola>
Podívejme se na Dobrou kapitolu (@dobra_kapitola).
```
Takhle vypadá kotva:
```typst
<nazev_kotvy>
```
Kotvu dáte na zalistovaný obsah (například za nadpis nebo obrázek) a můžete na odkazovat stejně jako na citace:
```typst
@nazev_kotvy
```
Můžeme se podívat na názornou ukázku odkazu (@ukazka_odkazu).
== Zkratky
LaTeX TUL šablona na začátku dokumentu seznam zkratek -- proto jsme ho přidali i do této šablony.
Seznam zkratek je v této šabloně nastaven tak, aby se zobrazoval pouze pokud je v něm alespoň jedna zkratka (přišlo nám to poměrně logické).
Zkratku #abbr("ABC", "Abeceda") vytvoříte (definujete) v textu například takto:
```typst
Zkratka #abbr("ABC", "Abeceda") je zkratka pro abecedu písmen.
```
Potom zkratku #abbr("ABC") použijete přímo (bez opakované definice):
```typst
První písmeno #abbr("ABC") je písmeno "A".
```
Šablona zajistí následující věci:
- Zkratka se zobrazí v seznamu zkratek
- Při prvním použití zkratky vás šablona donutí zkratku definovat
- Zkratka bude definována pouze jednou (poprvé), jinak na vás šablona začne červeně křičet
Při prvním použití zkratky (při definici) bude zkratka v textu vypadat takto: #abbr("ZK", "Zkratka")
Při dalších použití bude vypadat takto: #abbr("ZK")
#highlight[
Tedy zkratku _nepřidáváte_ přímo do seznamu zkratek, ale elegantně používáte přímo v textu.
]
= Specifická použití
V této kapitole se podíváme na některá specifická použití.
Můžete zde tedy najít věci, které nebudete vůbec potřebovat.
Pokud vás z této kapitoly nic nezajímá, tak ji klidně přeskočte -- zlobit se nebudeme.
== Rovnice, vzorečky a matematika
Pokud vaše práce bude obsahovat matematické značení, pak je tato kapitola pro vás.
V této kapitole vám představíme nějaké základy -- pokud vám tyto základy stačit nebudou, doporučujeme se obrátit na dokumentaci Typstu: https://typst.app/docs/reference/math/
=== Matematický režim
Matematický režim speciální syntaxi pro zápis matematických výrazů.
V matematickém režimu tato šablona použije jiný font -- vhodný pro zápis čísel a speciálních matematických znaků.
Pokud chcete vstoupit do matematického režimu, obklopte výraz znaky dolaru "`$`".
```typst
$1 + 1 = 42$
```
Ukázka: $1 + 1 = 42$
Jak sami vidíte, v matematickém režimu používáte poměrně srozumitelný způsob zápisu.
Dále si ukážeme nějaké specifické zápisy.
=== Sčítání
Součet zapíšete pomocí znaku "`+`".
```typst
$1 + 2 = 3$
```
Ukázka: $1 + 2 = 3$
=== Odčítání
Rozdíl zapíšete pomocí znaku "`-`".
```typst
$3 - 2 = 1$
```
Ukázka: $3 - 2 = 1$
=== Násobení<nasobeni>
Součin zapíšete pomocí příkazu "`dot`". Jedná se o ekvivalent LaTeXového "`cdot`".
#highlight[Narozdíl od LaTeXu před příkazy v matematickém režimu nepřidáváte zpětné lomítko "`\`".]
```typst
$2 dot 3 = 6$
```
Ukázka: $2 dot 3 = 6$
=== Dělení
Podíl zapíšete pomocí znaku "`/`".
```typst
$1 / 2 = 0.5$
```
Ukázka: $1 / 2 = 0.5$
Pokud chcete do zlomku dát výraz, a ne pouhé číslo, zabalte čitatel / jmenovatel do kulatých závorek.
```typst
$(1 + 1) / (4 - 2) = 2 / 2 = 1$
```
Ukázka: $(1 + 1) / (4 - 2) = 2 / 2 = 1$
=== Text
Jak můžeme vidět u Násobení (@nasobeni), pokud napíšeme v matematickém režimu slovo, Typst ho bude interpretovat jako příkaz.
Pokud ale chceme napsat skutečně text, který se vykreslí do dokumentu, obklopíme text uvozovkami.
```typst
$69 "cm"$
```
Ukázka: $69 "cm"$
= Používání funkcí
Používání většiny funkcionalit Typstu je prováděno pomocí tzv. volání funkce. Je to velmi podobné předchozím ukázkám, akorát místo toho, aby se text obalil pouze jedním symbolem či podobnou jednoduchou značkou, obalíme text jménem dané funkce.
Syntaxe vypadá nějak takto:
```typst
#název_funkce[samotný text nebo jiné parametry]
```
Pokud v editoru napíšete symbol hashtagu, začne vám automaticky našeptávat všechny možné funkce a jejich popisy.
Přejdeme rovnou k dalším praktickým příkladům.
== Obrázky
Obrázky je možné vkládat samotné, nebo i s popiskem.
Obrázek se vloží pomocí funkce `image`.
Přidání popisku a zároveň zalistování obrázku v indexu (aby se na ně třeba dalo odkazovat) lze
udělat pomocí funkce `figure`.
Přidání popisku a zároveň zalistování obrázku v indexu (aby se na třeba dalo odkazovat) lze udělat pomocí funkce `figure`.
#block([
```typst
@@ -171,9 +443,13 @@ Tady je praktická ukázka jednoduchého vložení obrázku s popiskem:
Logo *TUL*
])
První parametr funkce je zobrazovaný obsah, v našem případě zmíněný `image`. K němu můžeme psát různé parametry, v příkladu máme třeba nastavení šířky obrázku v procentech. Jako poslední je parametr `caption`, s jehož pomocí můžeme nastavit popisek obrázku/figury.
První parametr funkce je zobrazovaný obsah, v našem případě zmíněný `image`.
K němu můžeme psát různé parametry, v příkladu výše (kde zobrazujeme logomark TUL) máme třeba nastavení šířky obrázku v procentech -- tedy v procentech šířky stránky.
Jako poslední je parametr `caption`, s jehož pomocí můžeme nastavit popisek obrázku/figury.
Obrázky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje). I toto za vás Typst dělá automaticky, vám tak stačí do textu přidávat obrázky, jak se to hodí, a všechny se poté korektně zobrazí v Seznamu obrázků s odkazem i správně uvedenou stránkou, na které se obrázek nachází. Obrázky jsou také automaticky číslovány podle předepsaného způsobu, podobně jako kapitoly.
Obrázky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje).
I toto za vás Typst dělá automaticky, vám tak stačí do textu přidávat obrázky, jak se to hodí, a všechny se poté korektně zobrazí v *Seznamu obrázků* s odkazem i správně uvedenou stránkou, na které se obrázek nachází.
Obrázky jsou také automaticky číslovány podle předepsaného způsobu, podobně jako kapitoly.
== Tabulky
@@ -188,11 +464,11 @@ Tabulky lze vytvářet takto:
), caption: "Moje krásná tabulka")
```
Parametr `columns` udává počet sloupců tabulky. Poté následuje libovolný počet buněk tabulky, pro lepší přehlednost jsou v příkladu jednotlivé řádky oddělené. Nakonec je zde opět parametr `caption` sloužící k zadání popisku tabulky.
Parametr `columns` udává počet sloupců tabulky.
Poté následuje libovolný počet buněk tabulky, pro lepší přehlednost jsou v příkladu jednotlivé řádky oddělené.
Nakonec je zde opět parametr `caption` sloužící k zadání popisku tabulky.
#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).
#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,
@@ -201,95 +477,140 @@ zrakovým postižením).
[*Řá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). Jak jste asi pochopili, i toto provede šablona automaticky.
Tabulky se zobrazí na začátku dokumentu v seznamu (pokud to daný typ dokumentu vyžaduje).
Jak jste asi pochopili, i toto provede šablona automaticky.
== Citace
= Pokročilé formátování obsahu
Šablona podporuje správu citací pomocí standardního BibTeX @bibtex souboru, stejně jako
například LaTeX. Generování citací v BibTeX zápisu umí téměř každá stránka nebo program, které mají pro citace podporu.
Kód takovéto citace ve vhodném formátu stačí přidat do souboru _citations.bib_, poté je možné se
na odkazovat pomocí `@jmeno_citace`, nebo `#cite(<jmeno_citace>)`. Můžu se tak třeba odkázat na
citaci Typstu #cite(<typst>).
Dále si ukážeme neobvyklé (ale stále užitečné) způsoby formátování obsahu.
Formát souboru _citations.bib_ je naprosto stejný jako pro LaTeX. Tyto citace lze přímo vložit
třeba z webu https://www.citace.com ve formátu BibTeX -- Typst tento formát také umí přečíst.
Můžete se do souboru s příponou .bib podívat, zjistíte, že je to opravdu jen obyčejný textový soubor se specifickou strukturou.
V přiloženém ukázkovém souboru nějaké citace jsou - např. již použitá citace se jménem `typst`.
== Speciální znaky v textu
Soubor, ze kterého se načtou citace lze změnit pomocí argumentu šablony (tj. struktura na začátku souboru):
Díky Typstu speciální znaky neusíte kopírovat z internetu.
Typst na speciální znaky funkci "`sym`".
V online editoru stačí napsat "`#sym.`" a editor vám začne našeptávat velkou spoustu znaků.
Například znak #sym.pi (pí) lze zapsat takto:
```typst
#show: tultemplate2.with(
...
citations: "jinysoubor.bib",
...
)
#sym.pi
```
== Vnitřní odkazy a kotvy<ukazka_odkazu>
Další znaky lze najít v dokumentaci Typstu: https://typst.app/docs/reference/symbols/sym/
Trochu navážeme na Odkazy (@links).
== Horní / spodní text
Můžete dělat i vnitřní odkazy třeba na kapitoly, stránky nebo obrázky s popiskem (zabalené ve
`figure`).
Občas můžete chtít napsat text v menší velikosti a zarovnat ho na horní nebo spodní okraj řádku.
=== Horní text
Horní#super[text] lze napsat takto:
```typst
= Dobrá kapitola<dobra_kapitola>
Podívejme se na Dobrou kapitolu (@dobra_kapitola).
Horní#super[text]
```
Takhle vypadá kotva:
=== Spodní text
Spodní#sub[text] lze napsat takto:
```typst
<nazev_kotvy>
Spodní#sub[text]
```
Kotvu dáte někam do souboru a můžete na odkazovat stejně jako na citace:
== Ještě stále nemáte dost?
V tomto dokumentu naleznete vše, co v drtivé většině případů budete potřebovat ke psaní své práce.
Pokud se ale chcete dozvědět _ještě_ víc, pak vám doporučujeme se podívat na dokumentaci formátování obsahu přímo od vývojářů Typstu.
https://typst.app/docs/reference/text/
= Balíčky
Nenašli jste nějakou funkci v tomto dokumentu ani v Typst dokumentaci?
Žádný problém. Je naprosto možné, že na to bude existovat nějaký pěkný balíček.
Stejně jako například LaTeX, Typst na výběr velké množství balíčků, které vám poskytnou dodatečné funkce.
Tyto balíčky stáhnete pomocí velmi jednoduchého příkazu "`import`".
_Po_ příkazu import můžete používat naimportované funkce z balíčku.
== Ukázka balíčku
Pokud bych tak chtěl stáhnout například balíček "`alchemist`" na vykreslování chemických struktur, použiji následující import:
```typst
@nazev_kotvy
#import "@preview/alchemist:0.1.8": skeletize, fragment, branch, double, single
```
Můžeme se podívat na názornou ukázku odkazu (@ukazka_odkazu).
== Zkratky
Textový řetězec (text v uvozovkách) je název balíčku a jeho verze -- název a verzi najdete na seznamu balíčků viz. @seznam_balicku.
LaTeX TUL šablona k začátku dokumentu seznam zkratek. Proto jsme ho přidali i do této šablony.
Seznam zkratek je v této šabloně nastaven tak, aby se zobrazoval pouze pokud je v něm alespoň jedna
zkratka (přišlo nám to poměrně logické).
Zkratku #abbr("ABC", "Abeceda") vytvoříte (definujete) pomocí:
Všechno za dvojtečkou jsou funkce, které chcete importovat (oddělené čárkami).
Pokud budete chtít naimportovat úplně všechny funkce balíčku, pak použijete hvězdičku:
```typst
#abbr("ABC", "Abeceda")
#import "@preview/alchemist:0.1.8": *
```
Potom zkratku #abbr("ABC") můžete použít přímo (bez opakované definice):
Ukázka použití balíčku alchemist (podívejte se do zdroje dokumentu):
```typst
#abbr("ABC")
```
// ___ Ukázka balíčku Alchemist ___
Šablona zajistí následující věci:
- Zkratka se zobrazí v seznamu zkratek
- Při prvním použití zkratky vás šablona donutí zkratku definovat
- Definice zkratky bude použita právě jednou (poprvé)
#import "@preview/alchemist:0.1.8": skeletize, fragment, branch, double, single
Při prvním použití zkratky (při definici) bude zkratka v textu vypadat takto:
#abbr("ZK", "Zkratka").
Při dalších použití bude vypadat takto: #abbr("ZK").
#skeletize({ // příkaz na vykreslení chemické struktury
fragment(name: "S", "S") // síra uprostřed
#highlight[
Tedy zkratku _nepřidáváte_ přímo do seznamu zkratek, ale elegantně používáte přímo v textu.
]
// kyslíky
branch({
double(angle: 3, atom-sep: 1.422) // dvojná vazba
fragment(name: "O1", "O") // kyslík (name musí být unikátní -- proto ta jednička)
})
branch({
double(angle: 1, atom-sep: 1.422)
fragment(name: "O2", "O")
})
branch({
single(angle: -1, atom-sep: 1.574) // jednoduchá vazba
fragment(name: "O3", "O")
branch({
single(angle: 1, atom-sep: .97)
fragment(name: "H1", "H") // vodík
})
})
branch({
single(angle: -3, atom-sep: 1.574)
fragment(name: "O4", "O")
branch({
single(angle: -2, atom-sep: .97)
fragment(name: "H2", "H")
})
})
})
== Přílohy
// __ Konec ukázky ___
Na konec souboru (nebo klidně doprostřed či na začátek, hlavní je, že pouze jednou) je také možné dát strukturu generující přílohy. Momentálně jsou podporované čtyři typy příloh: odkaz, obsah, PDF soubor vložený na konec dokumentu a odkaz na externí soubor (například přiložený do systému s {{tou}}).
== Seznam balíčků<seznam_balicku>
Balíčků je opravdu mnoho a všechny je v tomto dokumentu ukázat nemůžeme.
Vy si ale nějaký můžete vybrat a ten vyzkoušet.
Doporučujeme balíčky hledat pomocí vyhledávání v Typst Universe.
Seznam balíčků v Typst Universe je dostupný na URL: https://typst.app/universe/search/?kind=packages
Když si z tohoto seznamu nějaký balíček rozkliknete a budete ho chtít naimportovat -- stačí si v sekci "How to add" zkopírovat příkaz import pomocí tlačítka a tento příkaz vložit někam do obsahu vašeho dokumentu (například před první použití jeho funkcí).
Balíček stačí naimportovat pouze jednou. Pokud chcete naimportovat další funkce, jednodušše je přidejte oddělené čárkou za příkaz import.
= Přílohy
Na konec souboru je také možné přidat seznam příloh.
Momentálně jsou podporované čtyři typy příloh: odkaz, obsah, PDF soubor vložený na konec dokumentu a odkaz na externí soubor (například přiložený do systému s {{tou}}).
Jako demonstrace by měla postačit praktická ukázka, která ve zdrojovém kódu následuje hned za tímto odstavcem, a která generuje přílohy tohoto dokumentu.
#attachments(
attach_link("Zdrojový kód této šablony", "https://git.zumepro.cz/tul/tultemplate2"),
attach_content("Testovací obsah vygenerovaný Typstem", [Sem lze psát _stylovaný_ obsah.]),
attach_pdf("Vložení PDF přílohy přímo do práce", "template/example_appendix.pdf"),
attach_file_reference("Reference na externí soubor", "example-file-appendix.zip"),
)

View File

@@ -2,46 +2,81 @@
#show: tultemplate2
= A quick few words about this template
= Introduction to this template
This template should serve as an example {{what}} written with the help of the *Typst* programming
language and the *tultemplate2* template. It can be used as a starting point for your own report, you just
have to learn a few of its useful functions, e.g. how to insert images, tables, citacions or links.
This template should serve as an example {{what}} written with the help of the tool *Typst* and the *tultemplate2* template.
It can be used as a starting point for your own report, you just have to learn a few of its useful functions, e.g. how to insert images, tables, citacions or links.
In contrast with the _documentation.typ_ file, which is available for download on the project's page,
this document only contains the most necessary knowledge to complete most reports. If you find this
documentt lacking in features, you can look at the aforementioned docs or contact one of the authors,
who will try to help you. Just for the sake of completeness, here is a few words about the Typst programming
language and about Typst, as well as about the motivation behind the creation of this template:
In contrast with the _documentation.typ_ file, which is available for download on the project's page, this document only contains the most necessary knowledge to complete most reports.
If you find this document lacking in features, you can look at the aforementioned docs or contact one of the authors, who will try to help you.
Just for the sake of completeness, here is a few words about the Typst programming language and about Typst, as well as about the motivation behind the creation of this template:
Typst is a professional typesetting language similar to markdown, LaTeX/TeX, groff, etc.
Typst is a professional typesetting language similar to Markdown, LaTeX/TeX, groff, etc.
Typst is the modern equivalent of older typesetting tools, which often lack a lot of important features,
such that make it next to impossible to work without today. The user must often import an incountable number of packages,
which only provide only the most basic of functionalities --- for example proper UTF-8 character support,
formatting of elements based on the set locale, etc.
Typst is the modern equivalent of older typesetting tools, which often lack a lot of important features, such that make it next to impossible to work without today.
The user must often import an incountable number of packages, which only provide only the most basic of functionalities --- for example proper UTF-8 character support, formatting of elements based on the set locale, etc.
= Getting Started with the Template
== Getting started
You have probably downloaded this template from the generator on the website www.tulsablona.cz and inserted
it into the Typst online editor. Therefore, besides the source code, you can also see the resulting PDF file.
As you probably know, the main difference between traditional word processors like Microsoft Word or LibreOffice
Writer and typesetting programs like LaTeX or Typst is the way in which the appearance and content of the document
are edited.
You have probably downloaded this template from the generator on the website https://tulsablona.zumepro.cz and inserted it into the Typst online editor.
Therefore, besides the source code, you can also see the resulting PDF file.
As you probably know, the main difference between traditional word processors like Microsoft Word or LibreOffice Writer and typesetting programs like LaTeX or Typst is the way in which the appearance and content of the document are edited.
While Word users are used to changing the document directly using buttons and keyboard shortcuts, Typst (and also LaTeX)
use a so-called source file, which is nothing more than an ordinary text file, and can then, on request, compile this
source file -- i.e., turn it into the final document, for example in PDF format.
While Word users are used to changing the document directly using buttons and keyboard shortcuts, Typst (and also LaTeX) use a so-called source file, which is nothing more than an ordinary text file, and can then, on request, compile this source file -- i.e., turn it into the final document, for example in PDF format.
Thats why here you will find a description of all the important functions not as a gallery of images showing which
buttons to click, but rather as an example and guide to all the special text sequences that Typst supports and that
the template interprets differently from the main content of the report.
That's why in this document you'll find a description of all the important functions not as a gallery of images showing which buttons to click, but rather as an example and guide to all the special text sequences that Typst supports and that the template interprets differently from the main content of the report.
#rect[
*TIP*:
Save this document for later use.
When you'll search for a specific function, you can jump right to it through the table of contents above.
]
== The header and the content
If you look at the document's source (on the right side, if you're in the online editor), you can notice that the source is consisting of two main parts: the header (which can look quite scary on the first look) and the content.
=== Header
The header defines some important information for the document to successfully generate --- for example: the faculty, thesis title, etc.
The information in the header can be either changed manually or by clicking on the content and typing.
More on that right in the next chapter.
=== Content
The content is marginally the actual text of your thesis.
The source of the document, besides the text, also contains some special characters (we call it syntax), which instruct Typst on how you wish to format your thesis.
== Clickable content in the header
When using the official Typst online editor, you can simply click on almost any text on the right half of your screen (the preview PDF), and your cursor will jump directly to that text in the source file.
A small but very practical feature.
#rect[
*TIP*:
Try double-tapping the content of the abstract (or the thesis title for projects and term papers --- when you don't have the title pages from STAG) and then start typing.
]
== Template compile-time checks
This template is created in such a way that when you try to compile it with incorrect syntax or an imoportant part of the header missing, it won't let you.
Always see the error messages the template provides, as they will simply guide you to fix your mistakes.
You can try this by deleting something from the header, or by using e.g. a function that ins't defined anywhere.
If you generated the header from the generator -- you should have no problem with it.
The generator is configured to only generate valid headers.
= Basic content formatting
Formatting (typesetting) text in Typst is very easy in the majority of cases.
In this chapter we'll show you some basics that you'll use all the time.
== Paragraphs
Some of you might know this concept from using Markdown, where paragraphs, headings and for the sake of clarity all
logically coherent blocks are separated by an empty line. You might have already spotted this while reading through
this document. You can try for yourself what happens when
Some of you might know this concept from using Markdown, where paragraphs, headings and for the sake of clarity all logically coherent blocks are separated by an empty line.
You might have already spotted this while reading through this document.
You can try for yourself what happens when
you just end the line
or when you properly use an empty line,
@@ -52,42 +87,31 @@ or when you properly use an empty line,
or maybe what happens if you use two or more empty rows. (spoiler: 1 or more empty lines share identical behavior,
while newlining only is interpreted the same as using spaces or tabs)
Therefore, the user has freedom of choosing whether he uses long lines full of text,
Therefore, the user has freedom of choosing whether they use long lines full of text,
or
if
he
prefers
they
prefer
a
cleaner
formatting
and manages the separation of content to lines, because it all gets concatenated into a nice consice paragraph.
and manage the separation of content to lines, because it all gets concatenated into a nice consice paragraph.
The user has to manually watch out for the length of the paragraphs, so that they are neither too short or too long.
In the context of paragraphs, it should be mentioned that Typst also manages the alignment of text and words into blocks
and the division of words between lines when they don't fit.
This behavior complies with the English grammar and typography rules fully, so you don't have to think about that at all.
== Clickable content
When using the official Typst online editor, you can simply click on any text in the right side (the preview PDF),
and your cursor will jump directly to that text in the source file.
A small but very practical feature.
In the context of paragraphs, it should be mentioned that Typst also manages the alignment of text and words into blocks and the division of words between lines when they don't fit.
== Headings
The first important feature, apart from writing the text itself (which requires no special syntax), is the usage of headings.
Just like in other programs, Typst also supports multi-level headings. For a first-level heading, an equals sign followed
by a space is used at the beginning of a line, meaning that in a Typst source file it is written like this:
The first important feature, apart from writing the text itself (which requires no black magic), is the usage of headings.
Just like in other programs, Typst also supports multi-level headings. For a first-level heading, an equals sign followed by a space is used at the beginning of a line, meaning that in a Typst source file it is written like this:
```typst
= My first level heading
```
For a second-level heading, we then use two equals signs; for a third-level heading, three equals signs
There are enough subheading levels that youll probably never run out. However, the TUL guidelines for writing reports
forbid usage of level four heading or larger, so you can (and should) only use headings from level 1 to 3.
If you try to use fourth-level or larger heading, the template will warn you not to do that and will refuse to compile
until you fix this. More on this behavior later.
For a second-level heading, we then use two equals signs; for a third-level heading, three equals signs...
However, the *tultemplate2* template will not allow a heading of fourth or deeper level, because such a heading would violate TUL's guidelines for writing reports.
But don't worry --- if you try to use fourth-level or deeper heading, the template will warn you not to do that and will refuse to compile until you fix this. More on this behavior later.
```typst
= Heading
@@ -99,29 +123,14 @@ And then your content
== Chapter Numbering
Youve probably noticed that each heading begins with the number of its respective chapter. Typst handles this numbering
automatically, and its also reflected in the *Table of Contents* at the start of the document, so you dont have to
worry about it yourself.
You've probably noticed that each heading begins with the number of its respective chapter in the output. Typst handles this numbering automatically, and it's also reflected in the *Contents* section at the start of the document, so you don't have to worry about it yourself.
== Template compile-time checks
This template is created in such a way that when you try to compile it with incorrect syntax or an imoportant
part of the header missing, it won't let you. Always see the error messages the template provides,
as they will simply guide you to fix your mistakes. You can try this by deleting something from the header,
or by using e.g. a function that ins't defined anywhere.
= Using Functions
Most Typst features are used through whats called *function calls*. This is quite similar to the previous examples,
except that instead of wrapping text with a single symbol or a simple marker, we wrap it with the name of the function.
The syntax looks like this:
```typst
#Function_name[text itself or other parameters]
```
When you type the hash symbol in the editor, it will automatically start suggesting all available functions and their descriptions.
Lets move on to some practical examples.
#rect[
*TIP*:
As a test, try to write a heading with level four.
At least you'll familiarize yourself with the way that this template gives you errors through Typst.
If you'll find yourself in a different file after double-tapping the error --- just simply return to this file through the file menu.
]
== Text Highlighting
@@ -130,25 +139,92 @@ The syntax for basic highlighting is very similar to Markdown. You just need to
```typst
*bold*
_italic_
#highlight[highlighted]
```
More styling options can be applied through functions, for example:
```typst
#strike[struck through]
#highlight[highlighted]
#underline[underlined] // underline SHOULD NOT be used
```
For completeness and demonstration, here in the text we have *bold text*, _italic text_, #strike[struck-through text],
and #highlight[text highlighted with your facultys color], as well as #underline[underlined text]
(although typographers generally advise against using underlining).
and #highlight[text highlighted with your faculty's color].
It's also possible to typeset #underline[underlined text] (although typographers generally advise against using underlining).
== Breaking lines
Did Typst break your line and you don't like it? Let's solve it.
=== Forced linebreak
If you want to break a line somewhere precisely, you can just append the character "`\`" at the end of the line.
Like so:
```typst
*Alice*: How to write a good thesis? \
*Bob*: Using Typst!
```
In the example above the question mark will be the last symbol on the first line --- Typst won't merge the lines here.
=== Unbreakable space
You may have heard this term before.
Perhaps you wish to write some name that shouldn't have a linebreak in it, you can use the symbol "`~`".
```typst
Yes, I go to the Technical University of~Liberec.
```
Above, Typst will never break the line between the word "of" and the word "Liberec".
The tilde symbol won't appear in the output file --- there will be a space instead.
== How to write a special character
Some characters like `_`, `*`, `~`, ... are special (as you know by now).
But what if you want to write them... like really write them (in your thesis).
All you need to do is to prepend a backslash before the character and it becomes a normal character.
```typst
You can write underscore like so: \_
```
You can write underscore like so: \_
Do you want to write a backslash itself?
Can you guess how to do it? ... You prepend a backslash before it.
```typst
Like so: \\
```
Like so: \\
== Dashes
You may have heard that if you write a dash on a keyboard --- it's really a hyphen.
How to actually write a dash then?
```typst
-- // En dash
--- // Em dash
```
#highlight[
To join logical groups in English, we strictly use the em dash --- so "---".
]
#rect[
*TIP*:
Try copy-pasting symbols to #link("https://apps.timwhitlock.info/unicode/inspect")[Unicode Inspector] --- it will show you the details of a symbol.
]
== Links<links>
You can create links to URLs/URIs, emails, phone numbers, and more.
A URL (URI) link can be written directly, without calling any function --- just type it in:
https://git.zumepro.cz/tul/tultemplate2
```typst
@@ -158,14 +234,194 @@ https://git.zumepro.cz/tul/tultemplate2
Internally, this automatically calls the `link` function.
If we want to link to less common things (like email addresses), we can call the `link` function explicitly:
```typst
#link("mailto:ondrej@mekina.cz")
#link("mailto:info@tul.cz")[Email of TUL informations]
```
First, you pass the link target (perhaps a URL address) in parentheses to the link function and then you follow up with the content that will be displayed in the document enclosed in brackets.
You can find other prefixes (URI schemes) on Wikipedia:
https://en.wikipedia.org/wiki/List_of_URI_schemes.
== Citations
The template supports citation management using a standard BibLaTeX file @bibtex, just like LaTeX.
Almost every website or program that supports citations can generate BibLaTeX-formatted entries --- we recommend using either #link("https://www.zotero.org/")[Zotero] or #link("https://www.citacepro.com/")[Citace.com].
You simply add the code for such a citation, in the proper format, to the file _citations.bib_.
Once added, you can reference it using `@citation_name` or `#cite(<citation_name>)`.
For example, I can reference the Typst citation as #cite(<typst>).
The format of the _citations.bib_ file is exactly the same as in LaTeX.
You can even copy entries directly from sites like in BibLaTeX format --- Typst understands that format, too.
If you open a `.bib` file, you'll see that it's simply a plain text file with a specific structure.
The provided sample file already contains several citations --- for instance, the one named `typst`, which was already used above.
You can change the file from which citations are loaded using a template argument (i.e., in the structure at the beginning of your Typst document):
```typst
#show: tultemplate2.with(
...
citations: "anotherfile.bib",
...
)
```
== Internal Links and Anchors<example_anchor>
Let's continue from the *Links* section (@links).
You can also create internal links --- for instance, to chapters, pages, or labeled images (those wrapped with the `figure` function).
```typst
= A Good Chapter<good_chapter>
Let's take a look at A Good Chapter (@good_chapter).
```
Here's what an anchor looks like:
```typst
<anchor_name>
```
You place the anchor on a listed item (after a heading or an image for example), and you can reference it the same way you reference citations:
```typst
@anchor_name
```
We can take a look at this illustrative reference (@example_anchor).
== Abbreviations
The LaTeX TUL template includes a list of abbreviations at the beginning of the document --- therefore, we've included one here as well.
This list is configured to appear only if there is *at least one* abbreviation defined --- which seemed quite logical.
You can create (define) the abbreviation #abbr("ABC", "Alphabet") in a text like this:
```typst
The shortcut #abbr("ABC", "Alphabet") is a shortcut for the alphabet of letters.
```
After that, you'll you the abbreviation #abbr("ABC") directly without redefining it:
```typst
The first letter of #abbr("ABC") is the letter "A".
```
The template automatically ensures the following:
- The abbreviation appears in the list of abbreviations
- When you use an abbreviation for the first time, the template requires you to define it
- The abbreviation is only defined once (the first time) or the template will scream in red at you
When used for the first time (definition), the abbreviation will look like this: #abbr("ABR", "Abbreviation")
In subsequent uses, it will appear as: #abbr("ABR")
#highlight[
In other words, you do _not_ add abbreviations directly to the abbreviation list.
You simply use them elegantly within the text itself.
]
= Specific usage
In this chapter you'll find some specific concepts.
You can find things that you might not need at all.
If nothing of this chapter interests you, go right ahead and skip it --- we won't be angry.
== Equations, formulas and maths
If your thesis will contain some mathematical notation, this chapter is for you.
In this chapter we'll cover some basics --- if the basics in this document won't be enough for you, we recommend checking out the Typst documentation: https://typst.app/docs/reference/math/
=== Math mode
The math mode has a special syntax for typesetting mathematics.
In the math mode, the template will use a different font --- a font suitable for typing numbers and special mathematical symbols.
If you want to enter the math mode, surround the content with the dollar sign "`$`".
```typst
$1 + 1 = 42$
```
Shown as: $1 + 1 = 42$
As you can see, in the math mode you use a pretty understandable syntax.
Let's get to some specific expressiosn now.
=== Addition
Addition can be written using the "`+`" sign.
```typst
$1 + 2 = 3$
```
Shown as: $1 + 2 = 3$
=== Subtraction
Subtraction can be written using the "`-`" symbol.
```typst
$3 - 2 = 1$
```
Shown as: $3 - 2 = 1$
=== Multiplication<multiplication>
Multiplication can be written using the command "`dot`". It's an equivalent of the LaTeX command "`cdot`".
#highlight[Contrary to LaTeX, you don't add the backslash "`\`" to call a command in the math mode.]
```typst
$2 dot 3 = 6$
```
Shown as: $2 dot 3 = 6$
=== Division
Division can be written using the "`/`" symbol.
```typst
$1 / 2 = 0.5$
```
Shown as: $1 / 2 = 0.5$
If you want to put an expression in the fraction, and not just a number, wrap the numerator / denominator in parentheses.
```typst
$(1 + 1) / (4 - 2) = 2 / 2 = 1$
```
Shown as: $(1 + 1) / (4 - 2) = 2 / 2 = 1$
=== Text
As you can see in Multiplication (@multiplication), if we write a word in the math mode, Typst will interpret it as a command.
If you want to write real text, shown in the document, instead, we must surround the text with double-quotes.
```typst
$69 "cm"$
```
Shown as: $69 "cm"$
= Using Functions
Most Typst features are used through what's called function calls.
This is quite similar to the previous examples, except that instead of wrapping text with a single symbol or a simple marker, we wrap it with the name of the function.
The syntax looks like this:
```typst
#function_name[text itself or other parameters]
```
When you type the hashtag symbol in the editor, it will automatically start suggesting all available functions and their descriptions.
Let's move on to some practical examples.
== Images
Images can be inserted either by themselves or with a caption.
@@ -185,16 +441,18 @@ To add a caption and also include the image in the index (so you can reference i
```
], breakable: false)
Heres a practical example of inserting an image with a caption:
Here's a practical example of inserting an image with a caption:
#figure(image("../template/assets/tul_logo.svg", width: 25%), caption: [
Logo of *TUL*
])
The first parameter of the function is the displayed content --- in our case, the mentioned `image`. You can then specify various parameters for it; in the example, we define the image width as a percentage.
The last parameter is `caption`, which lets us set the figures (or images) caption text.
The first parameter of the function is the displayed content --- in our case, the mentioned `image`.
You can then specify various parameters for it; in the example above (where we display the TUL logomark), we define the image width as a percentage --- a percentage of the page's width.
The last parameter is `caption`, which lets us set the figure's (or image's) caption text.
If the document type requires it, images will automatically appear in a list at the beginning of the document. Typst handles this automatically for you --- all you need to do is add images wherever appropriate, and theyll show up correctly in the *List of Figures*, complete with references and page numbers.
If the document type requires it, images will automatically appear in a list at the beginning of the document.
Typst handles this automatically for you --- all you need to do is add images wherever appropriate, and they'll show up correctly in the *List of images*, complete with references and page numbers.
Images are also numbered automatically according to the predefined style, similar to chapters.
== Tables
@@ -210,9 +468,11 @@ Tables can be created like this:
), caption: "My beautiful table")
```
The `columns` parameter specifies the number of columns in the table. Then comes any number of table cells --- for clarity, the rows are separated in the example. Finally, theres again a `caption` parameter, used to provide a caption for the table.
The `columns` parameter specifies the number of columns in the table.
Then comes any number of table cells --- for clarity, the rows are separated in the example.
Finally, there's again a `caption` parameter, used to provide a caption for the table.
#highlight[Its a good idea to wrap the table header (the first row) in the `header` function (as shown above)] --- this ensures Typst includes extra metadata in the generated PDF (for example, for people with visual impairments).
#highlight[It's a good idea to wrap the table header (the first row) in the `header` function (as shown above)] --- this ensures Typst includes extra metadata in the generated PDF (for example, for people with visual impairments).
#figure(table(
columns: 3,
@@ -222,93 +482,139 @@ The `columns` parameter specifies the number of columns in the table. Then comes
), caption: "My beautiful table")
Tables also appear at the beginning of the document in a list (if required by the document type).
As youve probably noticed by now, Typsts template takes care of this automatically.
As you've probably noticed by now, this template takes care of this automatically too.
== Citations
= Advanced content formatting
The template supports citation management using a standard BibTeX file @bibtex, just like LaTeX. Almost every website or program that supports citations can generate BibTeX-formatted entries.
You simply add the code for such a citation, in the proper format, to the file _citations.bib_. Once added, you can reference it using `@citation_name` or `#cite(<citation_name>)`.
For example, I can reference the Typst citation as #cite(<typst>).
Now we'll look into some uncommon (but still useful) ways of content formatting.
The format of the _citations.bib_ file is exactly the same as in LaTeX. You can even copy entries directly from sites like [citace.com](https://www.citace.com) in BibTeX format --- Typst understands that format, too.
If you open a `.bib` file, youll see that its simply a plain text file with a specific structure.
The provided sample file already contains several citations --- for instance, the one named `typst`, which was already used above.
== Special symbols in text
You can change the file from which citations are loaded using a template argument (i.e., in the structure at the beginning of your Typst document):
Thanks to Typst, you can quit copy-pasting symbols from the internet.
Typst has a function for special symbols --- function "`sym`".
In the online editor, you can just type "`#sym.`" and the editor will start autocompleting a load of symbols.
The symbol #sym.pi (pi), for example, can be written as so:
```typst
#show: tultemplate2.with(
...
citations: "anotherfile.bib",
...
)
#sym.pi
```
== Internal Links and Anchors<example_anchor>
You can find more symbols in the Typst reference documentation: https://typst.app/docs/reference/symbols/sym/
Lets continue from the *Links* section (@links).
== Superscript / subscript
You can also create internal links --- for instance, to chapters, pages, or labeled images (those wrapped with the `figure` function).
You may wish to write a smaller text aligned to the top of the line or to the bottom of the line.
=== Superscript
Super#super[script] can be written as:
```typst
= A Good Chapter<good_chapter>
Lets take a look at A Good Chapter (@good_chapter).
Super#super[script]
```
Heres what an anchor looks like:
=== Subscript
Sub#sub[script] can be written as:
```typst
<anchor_name>
Sub#sub[script]
```
You place the anchor anywhere in the file, and you can reference it the same way you reference citations:
== You want more?
In this document you'll find all the stuff that you will, in the majority of cases, need to write your thesis.
However, if you want to know _even more_, we recommend checking out the documentation on how to format content from the Typst developers.
https://typst.app/docs/reference/text/
= Packages
You want some function but you couldn't find it in this document nor in the Typst documentation?
No problem. Chances are, there is a package for it.
Similarly to LaTeX, Typst has a broad range of packages with additional functions.
You can download and use those packages with the very simple "`import`" command.
_After_ the import you can directly use the imported functions from the package.
== Package example
If I wish to download the package "`alchemist`" (for drawing chemical structures) for example, I will use the following import:
```typst
@anchor_name
#import "@preview/alchemist:0.1.8": skeletize, fragment, branch, double, single
```
For example, we can take a look at this illustrative reference (@example_anchor).
The text string (text in the double-quotes) is the package name and it's version --- you can find the name and the version in the package list in @package_list.
== Abbreviations
The LaTeX TUL template includes a list of abbreviations at the beginning of the document. Therefore, weve included one here as well.
This list is configured to appear only if there is *at least one* abbreviation defined --- which seemed quite logical.
You can create (define) an abbreviation with #abbr("ABC", "Alphabet") like this:
After the colon are the functions which you wish to import (comma-separated).
If you wish to import everything from the package, use an asterisk:
```typst
#abbr("ABC", "Alphabet")
#import "@preview/alchemist:0.1.8": *
```
After that, you can use the abbreviation #abbr("ABC") directly without redefining it:
Example usage of the alchemist package (look at the document source):
```typst
#abbr("ABC")
```
// ___ Example with the Alchemist package ___
The template automatically ensures the following:
- The abbreviation appears in the list of abbreviations
- When you use an abbreviation for the first time, the template *requires* you to define it
- The definition is used only once (the first time it appears)
#import "@preview/alchemist:0.1.8": skeletize, fragment, branch, double, single
When used for the first time (definition), the abbreviation will look like this:
#abbr("ABR", "Abbreviation").
In subsequent uses, it will appear as: #abbr("ABR").
#skeletize({ // the command to render the chemical structure
fragment(name: "S", "S") // sulfur in the middle
#highlight[
In other words, you do _not_ add abbreviations directly to the abbreviation list.
You simply use them elegantly within the text itself.
]
// oxygens
branch({
double(angle: 3, atom-sep: 1.422) // double bond
fragment(name: "O1", "O") // oxygen (name must be unique --- hence the one)
})
branch({
double(angle: 1, atom-sep: 1.422)
fragment(name: "O2", "O")
})
branch({
single(angle: -1, atom-sep: 1.574) // simple bond
fragment(name: "O3", "O")
branch({
single(angle: 1, atom-sep: .97)
fragment(name: "H1", "H") // hydrogen
})
})
branch({
single(angle: -3, atom-sep: 1.574)
fragment(name: "O4", "O")
branch({
single(angle: -2, atom-sep: .97)
fragment(name: "H2", "H")
})
})
})
== Attachments
// __ Example end ___
At the end of the file (or anywhere else, as long as its included only once), you can add a structure that generates attachments.
Currently, two types of attachments are supported --- links and content.
As a demonstration, heres a practical example (included right after this paragraph in the source code), which generates the attachments for this document:
== Package list<package_list>
There is a load of packages and we can't show all of them in this document.
But you can pick one and go try it.
We recommend searching for packages through the Typst Universe.
The package list in Typst Universe is available at: https://typst.app/universe/search/?kind=packages
If you pick some package from this list, open it in the listing and will wish to import it --- just use the copy button in the section "How to add" and paste the command in your document (before the first usage of it's functions for example).
You need to import the package just once. If you'll want to import more functions, just add them after the import comma-separated.
= Attachments
At the end of the file, you can add the list of attachments.
Currently, we support four types of attachments: links, content, PDF file attached at the end of the document and a reference to an external file (perhaps attached to the system with your {{what}}).
As a demonstration, there's a practical example included right after this paragraph in the source code, which generates the attachments for this document.
#attachments(
attach_link("Source code of this template", "https://git.zumepro.cz/tul/tultemplate2"),
attach_content("Test content generated by Typst", [Here you can write _styled_ content.]),
attach_pdf("Insert a PDF file directly into the thesis", "template/example_appendix.pdf"),
attach_file_reference("Reference to an external file", "example-file-appendix.zip"),
)

View File

@@ -26,8 +26,8 @@
],
),
title: (
cs: [Ukázka dokumentu typu Diplomová práce pro FM TUL v čtině],
en: [Example document for a Diploma thesis for FM TUL in Czech],
cs: [Ukázka dokumentu typu Diplomová práce pro FM TUL v angličtině],
en: [Example document for a Diploma thesis for FM TUL in English],
),
author: [Matěj Žucha],
author_pronouns: "me",

View File

@@ -0,0 +1,18 @@
#let color = red.lighten(50%)
#set align(center + horizon)
#set text(font: "Inter", 2em, color)
#set page(foreground: rect(
width: 90%,
height: 90%,
stroke: (paint: color, thickness: .03em, dash: (.5em, .5em)),
place(center + bottom, context {
text(str(counter(page).get().at(0)) + "/" + str(counter(page).final().at(0)), 15pt)
v(1em)
}),
))
Toto je ukázkový PDF dokument přiložený k práci jako příloha.
#pagebreak()
This is a sample PDF document attached to the thesis as an appendix.

View File

@@ -0,0 +1,49 @@
#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,
wide: false,
first_heading_is_fullpage: true,
),
citations: "citations.bib",
)
= Úvod
== Jak použít prezentaci
- tato šablona slouží jako ukázka použití Typst TUL šablony k tvorbě prezentace
- můžete zde používat všechny funkcionality Typstu, stejně jako u ostatních dokumentů
- slajdy fungují podobně jako v Latexu - každý nadpis 1. úrovně tvoří nový slajd
- v případě použití _first_heading_is_fullpage_ neplatí - viz dále
- možno používat i nadpisy druhé úrovně
= Možnosti šablony
== Argumenty funkce šablony
- _append_thanks_: Jestli na závěr přidat slajd s poděkováním
- _wide_: Použití formátu 16:9 místo 4:3 na všechny slajdy
- _first_heading_is_fullpage_: vloží každý nadpis 1. úrovně na samostatný slajd, takže logicky rozčlení prezentaci
- zároveň tvoří nový slajd pro každý nadpis 2. úrovně
- pokud je vypnuta, nadpisy 2. úrovně *netvoří* nový slajd
== Struktura
- prezentace začíná titulní stranou - nastaveno pomocí generátoru
- na začátku není automaticky generovaný obsah - uživatel ho může snadno vytvořit pomocí odrážek či číslovaného seznamu
- po samotném obsahu přichází slajd s citacemi - automaticky generováno
- volitelně poděkování
== Použití citací
- tady jsou citace: Citace 1 @typst a citace 2 @bibtex

View File

@@ -0,0 +1,49 @@
#import "../template/template.typ": *
#show: tultemplate2.with(
style: "classic",
faculty: "fm",
lang: "en",
document: "presentation",
author: [Ondřej Mekina],
title: (
en: [Example presentation using the tultemplate2 template],
),
presentation: (
append_thanks: true,
wide: false,
first_heading_is_fullpage: true,
),
citations: "citations.bib",
)
= Intro
== How to use this presentation
- this template serves as a demo usage of the Typst TUL template for creating presentations
- you can use all the functionalities of Typst, the same you would in all the other documents
- slides are created in a similiar fashion to LaTeX - each level 1 heading detones a new slide
- this behaves differently when using the _first_heading_is_fullpage_ option - more on that later
- you can also use level 2 headings
= Template options
== Template function arguments
- _append_thanks_: Whether to end the presentation with a Thank you slide
- _wide_: Using the 16:9 aspect ratio for all slides instead of 4:3
- _first_heading_is_fullpage_: creates a standalone page for each level 1 heading, this breaks down the presentation nicely
- also creates a new slide for each level 2 heading
- if the option is not set, level 2 headings *do not* create a new slide
== Structure
- The presentations begins with a title page - configured in the generator
- there is no automatically generated table of contents - the user may create it easily using dashes or an ordered list
- after the content of the presentation, there is a slide with all citation sources - this one is automatically generated
- optionally a Thank you slide
== Usage of citations
- here are two example citations: Citation 1 @typst and citation 2 @bibtex

View File

@@ -26,8 +26,8 @@
],
),
title: (
cs: [Ukázka dokumentu typu Projekt pro FM TUL v čtině],
en: [Example document for a Project report for FM TUL in Czech],
cs: [Ukázka dokumentu typu Projekt pro FM TUL v angličtině],
en: [Example document for a Project report for FM TUL in English],
),
author: [Matěj Žucha],
author_pronouns: "me",

View File

@@ -0,0 +1,40 @@
#import "../template/template.typ": *
#show: tultemplate2.with(
style: "classic",
faculty: "fm",
lang: "cs",
document: "sp",
assignment: (
personal_number: [A00000007],
department: [Ústav šablon],
academical_year: [2025/2026],
content: [
= Zásady pro vypracování:
+ Seznamte se s možnostmi šablon
+ Navrhněte několik možných stylů šablon
+ Seznamte se s nástrojem Typst
+ Implementujte šablonu
+ Zkonzultujte šablonu
+ Opravte spoustu věcí
+ Zkonzultujte šablonu
+ Opravte spoustu věcí
+ Zkonzultujte šablonu
+ Snad nebude nic potřeba opravit
= Seznam odborné literatury:
_Přísně tajné_
],
),
title: (
cs: [Ukázka dokumentu typu Semestrální práce pro FM TUL v češtině],
en: [Example document for a Term paper for FM TUL in Czech],
),
author: [Matěj Žucha],
author_pronouns: "masculine",
programme: (cs: [MI6000000007 Přísně tajné]),
specialization: (cs: [Vytváření šablon]),
citations: "citations.bib",
)
Semestrální práce
vaší semestrální prací

View File

@@ -0,0 +1,39 @@
#import "../template/template.typ": *
#show: tultemplate2.with(
style: "classic",
faculty: "fm",
lang: "en",
document: "sp",
assignment: (
personal_number: [A00000007],
department: [Department of templates],
academical_year: [2025/2026],
content: [
= Principles for drafting:
+ Familiarize yourself with available templates
+ Design several possible template styles
+ Learn to use Typst
+ Implement the template
+ Review the template
+ Fix many issues
+ Review the template
+ Fix many issues
+ Review the template
+ Hopefully nothing more needs fixing
= List of professional literature:
_Top secret_
],
),
title: (
cs: [Ukázka dokumentu typu Semestrální práce pro FM TUL v češtině],
en: [Example document for a Term paper for FM TUL in Czech],
),
author: [Matěj Žucha],
author_pronouns: "me",
programme: (en: [MI6000000007 Top secret]),
specialization: (en: [Creation of templates]),
citations: "citations.bib",
)
Term paper

45
theses/title_pages.typ Normal file
View File

@@ -0,0 +1,45 @@
#let color = red
#set text(font: "Inter")
#set page(foreground: rect(
width: 90%,
height: 90%,
stroke: (paint: color, thickness: .03em, dash: (.5em, .5em))
))
#set text(lang: "cs")
#align(center + horizon, text([
*Nahraďte soubor "`title-pages.pdf`"* souborem se zadáním vygenerovaným *ze~STAGu*.
], color, 2em))
#text([
To můžete v online Typst editoru udělat takto:
+ *Počkejte až budete mít oficiálně schválené zadání práce.*
+ Soubor s titulními stranami se vám pak ukáže ve STAGu -- stáhněte soubor ze STAGu.
+ Přejmenujte ho na "`title-pages.pdf`".
+ Otevřete v online Typst editoru prohlížeč souborů.
+ Přetáhněte svůj přejmenovaný soubor do prohlížeče souborů.
+ Pokud jste vše udělali správně, vyskočí vám okno, které se vás ptá, jestli chcete soubor přepsat -- klikněte na přepsat (v angličtině overwrite).
Oficiálně *není doporučeno soubor vytvářet manuálně*, ale opravdu ho stáhnout ho ze STAGu.
Soubor ze STAGu navíc obsahuje důležitá metadata.
], black, 11pt)
#pagebreak()
#set text(lang: "en")
#align(center + horizon, text([
*Replace file "`title-pages.pdf`"* with the title pages document with assignment genenerated *from~STAG*.
], color, 2em))
#text([
In the online Typst editor you can do it as follows:
+ *Wait until you have your assignment officially approved.*
+ The file with the title pages will then appear in STAG for you --- download the file from STAG.
+ Rename it to "`title-pages.pdf`".
+ Open the file browser in the online Typst editor.
+ Drag and drop your renamed file into the file browser.
+ If you did everything correctly, a window will popup, asking you if you want to overwrite the file --- click on overwrite.
Officially, it is *not recommended to create the file manually*, but, indeed, download it from STAG.
The file from STAG also includes some important metadata.
], black, 11pt)