diff --git a/packages/preview/sgh-thesis/0.1.2/LICENSE b/packages/preview/sgh-thesis/0.1.2/LICENSE new file mode 100644 index 0000000000..d01ff80e12 --- /dev/null +++ b/packages/preview/sgh-thesis/0.1.2/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Piotr Kuszewski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/preview/sgh-thesis/0.1.2/README.md b/packages/preview/sgh-thesis/0.1.2/README.md new file mode 100644 index 0000000000..e4886ba518 --- /dev/null +++ b/packages/preview/sgh-thesis/0.1.2/README.md @@ -0,0 +1,92 @@ +# sgh-thesis + +A diploma thesis template (bachelor's and master's) compliant with the editorial +requirements of the SGH Warsaw School of Economics (Szkoła Główna Handlowa +w Warszawie). The template is bilingual — it supports Polish and English. + +The default font used for typesetting theses is New Computer Modern, which ships +with every Typst installation, so no additional configuration is required to use +the template. + +The full manual, a complete example thesis, and the matching SGH presentation +template are available in the project repository: +. + +![Title page of the example thesis produced with the template](thumbnail.png) + +## Usage + +```typst +#import "@preview/sgh-thesis:0.1.2": * + +#show: sgh.with( + author: "Ijon Tichy", + student_id: "112358", + title: "Taksonomia i morfologia bytów nieistniejących zamieszkujących mgławice ciemne", + advisor: "prof. Astrala Sternu Tarantogi", // inflected for the phrase "pod kierunkiem naukowym..." + advisor_department: "Katedra Astrognozji i Porównawczego Badania Nicości", + year: "2025", + studies: "mgr", // "mgr" (master's) or "lic" (bachelor's) + program: "Kosmologia Paradoksalna", + language: "pl", // "pl" or "en" +) + +#sgh-summary[ + Abstract text. +] + +#table-of-contents() + += Introduction + +Body of the thesis... + +#list-of-sources(read("sources.bib", encoding: none)) +#list-of-figures() +#list-of-tables() +``` + +## Generating the bibliography + +There are two ways to produce the bibliography: + +1. **`list-of-sources`** (template procedure — adds a page break and the Harvard + style by default). Because the call to `bibliography` lives *inside* the package, + a plain path string would be resolved relative to the package, not your document. + Read the file with `read(..., encoding: none)` in your own document and pass the + resulting bytes: + + ```typst + #list-of-sources(read("sources.bib", encoding: none)) + // optionally choose a style: + #list-of-sources(read("sources.bib", encoding: none), styl: "ieee") + ``` + +2. **Built-in `bibliography`** — called directly in your document, so a path string + works as usual and you get full control over title and style: + + ```typst + #pagebreak() + #bibliography("sources.bib", title: [Bibliografia], style: "harvard-cite-them-right") + ``` + +## Available procedures + +- `sgh(...)` — the main template procedure; generates the title page and configures + document formatting (used with `#show: sgh.with(...)`). +- `sgh-summary[...]` — the thesis abstract. +- `table-of-contents()` — table of contents. +- `list-of-figures()` — list of figures. +- `list-of-tables()` — list of tables. +- `list-of-sources(plik, styl: "harvard-cite-them-right")` — bibliography; `plik` + must be the file contents read with `read(..., encoding: none)` (bytes), not a path. +- `sgh-figure(caption:, source:, placement:, body)` — a figure with a caption and + source; included in the list of figures. +- `sgh-table(caption:, source:, placement:, body)` — a table with a caption and + source; included in the list of tables. +- `sgh-stripped-tables` — formats tables with alternating shaded rows + (used with `#show: sgh-stripped-tables`). + +## License + +MIT — see the [LICENSE](LICENSE) file. diff --git a/packages/preview/sgh-thesis/0.1.2/sgh-thesis.typ b/packages/preview/sgh-thesis/0.1.2/sgh-thesis.typ new file mode 100644 index 0000000000..31de074883 --- /dev/null +++ b/packages/preview/sgh-thesis/0.1.2/sgh-thesis.typ @@ -0,0 +1,628 @@ + +#let sgh-godlo = ```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +```.text + + +#let loc-pl-en(pl, en) = context { + if text.lang == "en" { en } else { pl } +} + +/// Główna procedura szablonu. Generuje stronę tytułową i konfiguruje wszystkie parametry tekstu. `sgh()` wymaga użycia komendy `#show` na początku pliku. Przykładowe wywołanie procedury `sgh()`: +/// ```typst +/// #show: sgh.with( +/// author: "Ijon Tichy", +/// student-id: "112358", +/// title: "Taksonomia i morfologia bytów nieistniejących zamieszkujących mgławice ciemne", +/// advisor: "Prof. Astrala Sternu Tarantogi", // Odmiana!! +/// advisor-department: "Katedra Astrognozji i Porównawczego Badania Nicości", +/// year: "2025", +/// studies: "mgr", +/// program: "Kosmologia Paradoksalna", +/// ) +/// ``` +/// -> none +#let sgh( + /// Tytuł pracy. -> content + title: [Tytuł pracy], + /// Imię i nazwisko autora pracy. -> str + author: "", + /// Nr albumu autora pracy -> str + student-id: "", + /// Tytuł i stopień naukowy oraz imię i nazwisko promotora w odmianie dopasowanej do frazy "pod kierunkiem naukowym...". Należy pamiętać, że w przypadku skrótów kropki nie dodajemy tylko w przypadku gdy skót kończy się na tą samą literę co skracany wyraz. To znaczy, że w przypadku "pod kierunkiem naukowym dr. Jana Kowalskiego" kropka w stosowanym skrócie jest wymagana. -> str + advisor: "", + /// Jednostka (Instytut, Katedra, ...) w której pracuje promotor pracy. -> str + advisor-department: "", + /// Studium w ramach którego została przygotowana praca. -> "lic" | "mgr" + studies: "mgr", + /// Kierunek studiów. -> str + program: "", + /// Specjalność. Jeśli nie zostanie wskazana w parametrach, to nie pojawi się na stronie tytułowej. -> str + specialisation: "", + /// Rok przygotowania pracy. -> str + year: "2026", + /// Język, w jakim jest pisana praca. W tym momencie obsługiwane są wyłącznie języki polski i angielski. Domyślnym językiem jest polski, ale ustawienie jakiegokolwiek innego języka przestawia szablon na język angielski. -> "pl" | "en" + language: "pl", + body +) = { + set document(title: title, author: author) + set text(lang: language) + set page( + paper: "a4", + margin: (top: 25mm, bottom: 25mm, left: 25mm, right: 25mm), + ) + show figure: set place(clearance: 1em) + show figure: set block(below: 0.75em) + + set par(first-line-indent: 0pt) + set text( + font: "New Computer Modern", + size: 12pt + ) + show math.equation: set text(font: "New Computer Modern Math") + + align(center)[ + #image(bytes(sgh-godlo), format: "svg", width: 35%) + #v(0.5cm) + + #if studies == "mgr" [ + #text(loc-pl-en("Studium magisterskie","Master's study")) + ] else if studies == "lic" [ + #text(loc-pl-en("Studium licencjackie","Bacherlor's study")) + ] else [ + #text(loc-pl-en("Niewłaściwa nazwa studium!","Wrong studies name!"), fill: red) + ] + ] + + v(1cm) + + if program != "" [ + #text(loc-pl-en([Kierunek #program \ ],[Field of study: #program \ ])) + ] else [ + #text(loc-pl-en("Brak kierunku!","Program name missing!"), fill: red) + ] + + if specialisation != "" [ + #text(loc-pl-en([Specjalność #specialisation \ ],[Specialisation: #specialisation \ ])) + ] + + v(1cm) + + block(inset: (left: 9cm))[ + #if author != "" [ + #text([#author \ ]) + ] else [ + #text(loc-pl-en("Brak autora!","Author name missing!"), fill: red) + ] + #loc-pl-en("Nr albumu ","Student register No. ") + #if student-id != "" [ + #text([#student-id \ ]) + ] else [ + #text(loc-pl-en([Brak numeru albumu!\ ],[Student register No. missing!\ ]), fill: red) + ] + ] + v(1cm) + + align(center)[#text([#title\ ], size: 22pt, weight: "bold")] + + v(0.5cm) + + block(inset: (left: 9cm))[ + #if studies == "mgr" [ + #text(loc-pl-en([Praca magisterska\ ],[Master's thesis\ ])) + ] else if studies == "lic" [ + #text(loc-pl-en([Praca licencjacka\ ],[Bacherlor's thesis\ ])) + ] else [ + #text(loc-pl-en("Niewłaściwa nazwa studium!","Wrong name!"), fill: red) + ] + #loc-pl-en([pod kierunkiem naukowym\ ],[under the scientific supervision of\ ]) + #if advisor != "" [ + #text([#advisor\ ]) + ] else [ + #text(loc-pl-en([Wskaż promotora!\ ],[Name of advisor missing!\ ]), fill: red) + ] + #if advisor-department != "" [ + #text([#advisor-department\ ]) + ] else [ + #text(loc-pl-en([Wskaż jednostkę naukową promotora!\ ],[Advisor's departement name missing!\ ]), fill: red) + ] + ] + v(1fr) + + align(center)[Warszawa #year] + + pagebreak() + + set page(numbering: "1") + set heading(numbering: "1.1") + set math.equation(numbering: "(1)") + set figure(numbering: "1") + + set par(first-line-indent: 0pt, justify: true) + + show heading.where(level: 1): it => { + if it.outlined and it.numbering != none { + pagebreak() + set text(size: 22pt, weight: "bold") + loc-pl-en("Rozdział ","Chapter ") + counter(heading).display() + align(left)[ + #set par(justify: false) + #text(hyphenate: false)[#it.body] + ] + } else { + set text(size: 22pt, weight: "bold") + it.body + v(0.5cm) + } + } + + show heading.where(level: 2): set text(size: 16pt, weight: "bold") + show heading.where(level: 3): set text(size: 14pt, weight: "bold") + show heading.where(level: 4): set text(size: 12pt, weight: "bold") + + show figure: set figure.caption(position: top) + + show figure.caption: it => [ + #align(left)[ + #text([ + #it.supplement + #context it.counter.display(it.numbering):], weight: "bold") + #it.body + ] + ] + + // Konfiguracja przecinków w formułach matematycznych + show math.equation: it => { + // Wszsytkie przecinki są typu "normal" (bez cienkiej spacji) + show ",": math.class("normal", ",") + // ", " (przecinek + spacja) → wstawia przecinek jako klasę "punctuation" i usuwa spację + // (klasa "punctuation" wstawia cienką spację domyślnie) + show regex(",\\s"): math.class("punctuation", ",") + it + } + + set ref(supplement: none) + show ref: it => { + let el = it.element + if el != none and el.func() == math.equation { + [(#it)] + } else { + it + } +} + + body +} + +/// Procedura generująca spis treści. -> none +#let table-of-contents() = { + outline() + pagebreak() +} + +/// Procedura generująca spis rysunków, tj. obiektów wstawionych za pomocą procedury `#sgh-figure()` z tego szablonu. -> none +#let list-of-figures() = { + pagebreak() + heading(loc-pl-en("Spis rysunków","List of figures"), depth: 1, numbering: none) + outline( + target: figure.where(kind: "rysunek"), + title: none + ) +} + +/// Procedura generująca spis tabel, tj. obiektów wstawionych za pomocą procedury `#sgh-table()` z tego szablonu. -> none +#let list-of-tables() = { + pagebreak() + heading(loc-pl-en("Spis tabel","List of tables"), depth: 1, numbering: none) + outline( + target: figure.where(kind: "tabela"), + title: none + ) + } + +/// Procedura generująca bibliografię. -> none +#let list-of-sources( + /// Plik zawierający dane bibliograficzne pozycji cytowanych w tekście. Wykorzystywany jest wewnętrzny mechanizm przygotowania bibliografii dostarczany z Typst. Plik z danymi bibliograficznymi powinien być w formacie BibLaTeX lub Hayagriva. -> str + plik, + /// Styl przygotowania bibliografii. Powinien być wybrany z listy domyślnych stylów. Domyślna wartość tego parametru przygotowuje bibliografię w stylu harwardzkim i w formacie (Autor, Data). -> str + styl: "harvard-cite-them-right" + ) = { + pagebreak() + bibliography( + plik, + style: styl + ) +} + +/// Procedura dodająca rysunek. Tak wstawiony rysunek pojawi się w spisie rysunków. Utworzenie numerowanego rysunku ze wskazanym źródłem z pliku `rys1.pdf` zawierającego rysunek, który będzie automatycznie umieszczany na dole lub na górze strony wymaga polecenia: +/// ```typst +/// #sgh-figure( +/// caption: [Diagram.], +/// source: [Opracowanie własne.], +/// placement: auto, +/// image("rys1.pdf") +/// ) +/// ``` +#let sgh-figure( + /// Tytuł rysunku. Tytuł umieszczany jest nad rysunkiem. Nie jest to zgodne z polskimi zwyczajami, ale poprawia czytelność dokumentu. -> str + caption: "", + /// Źródło rysunku. Umieszczanie mniejszym fontem poniżej rysunku. -> str + source: "", + /// Położenie rysunku. Przyjmuje takie same wartości jak parametr `placement` w funkcji `figure`, tj. `none`, `auto`, `top` lub `bottom`. -> none | auto | top | bottom + placement: none, + /// Zawartość, która zostanie podpisana jako rysunek. Może to być rysunek włączony za pomocą funkcji `#image` jak również diagram CeTZ lub inny programowo generowany rysunek. -> content + body +) = { + figure( + caption: caption, + supplement: loc-pl-en("Rysunek","Figure"), + kind: "rysunek", + placement: placement, + [ + #body + #align(left)[ + #text([#loc-pl-en("Źródło:", "Source:") #source], size: 10pt) + ] + #v(0.5em) + ], + ) +} + +/// Procedura dodająca tabelę. Tak wstawiona tabela pojawi się w spisie tabel. Utworzenie numerowanej tabeli ze wskazanym źródłem, która będzie umieszczan dokładnie tam gdzie jest w kodzie: +/// ```typst +/// #sgh-table( +/// caption: [Diagram.], +/// source: [Opracowanie własne.], +/// table( +/// ... +/// ) +/// ) +/// ``` +#let sgh-table( + /// Tytuł tabeli. Tytuł umieszczany jest nad tabelą, a źródło poniżej tabeli. -> str + caption: "", + /// Źródło tabeli. Umieszczanie mniejszym fontem poniżej tabeli. -> str + source: "", + /// Położenie tabeli. Przyjmuje takie same wartości jak parametr `placement` w funkcji `figure`, tj. `none`, `auto`, `top` lub `bottom`. -> none | auto | top | bottom + placement: none, + /// Zawartość, która zostanie podpisana jako tabela. Może to być tabela sformatowana komendą `#table`, ale również rysunek włączony za pomocą funkcji `#image` jak również diagram CeTZ lub inny programowo generowany rysunek. -> content + body +) = { + figure( + caption: caption, + supplement: loc-pl-en("Tabela","Table"), + kind: "tabela", + placement: placement, + [ + #body + #align(left)[ + #text([#loc-pl-en("Źródło:", "Source:") #source], size: 10pt) + ] + #v(0.5em) + ] + ) +} + +/// Generuje tytuł streszczenia. Streszczenie nie jest częścią spisu treści. Użycie: +/// ```typst +/// #sgh-summary[ +/// Treść streszczenia +/// ] +/// ``` +#let sgh-summary( + body +) = { + pagebreak() + align(center)[#text([#loc-pl-en("Streszczenie","Summary")], weight: "bold")] + v(0.5cm) + body +} + +/// Włącza formatowanie tabel w naprzemiennie wyszarzone poziome pasy z wierszem nagłówka sformatowanym pogrubiony fontem. Użycie: +/// ```typst +/// #show: sgh-stripped-tables +/// ``` +#let sgh-stripped-tables(body) = { + show table.cell.where(y: 0): set text(weight: "bold") + let frame(stroke) = (x, y) => ( + left: 0pt, + right: 0pt, + top: if y == 0 { stroke + 1pt} else if y == 1 { stroke + 0.5pt} else { 0pt }, + bottom: stroke + 1.5pt, + ) + set table( + fill: (_, y) => if calc.odd(y) { gray.lighten(90%) }, + stroke: frame(black), + ) + body +} diff --git a/packages/preview/sgh-thesis/0.1.2/thumbnail.png b/packages/preview/sgh-thesis/0.1.2/thumbnail.png new file mode 100644 index 0000000000..dedb6196eb Binary files /dev/null and b/packages/preview/sgh-thesis/0.1.2/thumbnail.png differ diff --git a/packages/preview/sgh-thesis/0.1.2/typst.toml b/packages/preview/sgh-thesis/0.1.2/typst.toml new file mode 100644 index 0000000000..34198e0b03 --- /dev/null +++ b/packages/preview/sgh-thesis/0.1.2/typst.toml @@ -0,0 +1,13 @@ +[package] +name = "sgh-thesis" +version = "0.1.2" +entrypoint = "sgh-thesis.typ" +authors = ["Piotr Kuszewski "] +license = "MIT" +description = "A bilingual (Polish and English) diploma thesis template (bachelor's and master's) compliant with the editorial requirements of the SGH Warsaw School of Economics." +repository = "https://github.com/piotr-m-kuszewski/Szablony_Typst_SGH" +keywords = ["thesis", "SGH", "Warsaw School of Economics", "dyplom", "praca dyplomowa"] +categories = ["thesis"] +disciplines = ["economics"] +compiler = "0.12.0" +exclude = ["thumbnail.png"]