From f871c5f7afd8f3bfccc65decc3ba5aabd4bb17ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Mekina?= Date: Sat, 22 Nov 2025 20:23:05 +0100 Subject: [PATCH] add more formatting examples to theses examples --- theses/content_cs.typ | 73 +++++++++++++++++++++++++++++++++++++++++-- theses/content_en.typ | 72 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 139 insertions(+), 6 deletions(-) diff --git a/theses/content_cs.typ b/theses/content_cs.typ index 6cb4675..26f2ed6 100644 --- a/theses/content_cs.typ +++ b/theses/content_cs.typ @@ -32,14 +32,30 @@ Proto v tomto dokumentu najdete popis všech důležitých funkcí nikoliv jako Až budete hledat nějakou specifickou funkci, můžete se k ní prokliknout přes seznam obsahu nahoře. ] -== Klikatelný obsah +== Hlavička a 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 dá měnit, a editor podle toho automaticky přesune váš kurzor na správné místo. +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 už 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í) a začít psát. + 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 @@ -135,6 +151,57 @@ Další stylování lze dělat právě přes funkce, viz třeba: 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á už 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 ní bude mezera. + +== Jak napsat speciální znak + +Znaky jako `_`, `*`, `~`, ... jsou speciální (jak už 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) 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: \\ + == Odkazy Odkazy je možné dělat na URL/URI zdroje, emaily, telefony, atd... diff --git a/theses/content_en.typ b/theses/content_en.typ index 9c4b1fc..7f9f566 100644 --- a/theses/content_en.typ +++ b/theses/content_en.typ @@ -32,14 +32,30 @@ That's why in this document you'll find a description of all the important funct When you'll search for a specific function, you can jump right to it through the table of contents above. ] -== Clickable content +== The header and the 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. +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) and then start typing. + 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 @@ -136,6 +152,56 @@ For completeness and demonstration, here in the text we have *bold text*, _itali 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: \\ + == Links You can create links to URLs/URIs, emails, phone numbers, and more.