From 1fe345a29fb5f448ee7c57e4d4e8351bd7cd6333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20J=C3=B6rg?= <14005567+mrtz-j@users.noreply.github.com> Date: Sun, 8 Sep 2024 21:29:28 +0200 Subject: [PATCH] Add codeblock and footnotes (#4) * Add codeblock and footnotes * temp solution for fsharp highlighting --- README.md | 6 +++--- lib.typ | 3 ++- template/chapters/global.typ | 1 + template/chapters/glossary.typ | 13 +++++++++---- template/chapters/introduction.typ | 15 +++++++++++++++ template/thesis.typ | 12 ++++++++++++ 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 03a4821..d85f959 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ - [ ] Headings (chapter on odd, subsection on even) - [ ] Font features - [ ] Figures (captions etc) - - [ ] Code blocks (syntax highlights) + - [x] Code blocks (syntax highlights) - [ ] Tables - - [ ] Footnotes (?) + - [x] Footnotes (?) - [ ] Good examples - [ ] Use of figures, tables, code blocks - [ ] Side by side @@ -24,5 +24,5 @@ - [x] CI/CD - [x] Formatting - [x] Build and Release pdf - - [/] Release as lib + - [ ] Release as lib (TODO: Add to local index) - [ ] License diff --git a/lib.typ b/lib.typ index f53c349..3355a25 100644 --- a/lib.typ +++ b/lib.typ @@ -1,5 +1,6 @@ #import "@preview/subpar:0.1.1" #import "@preview/physica:0.9.3": * +#import "@preview/codly:1.0.0": * #import "modules/frontpage.typ": frontpage #import "modules/backpage.typ": backpage @@ -247,7 +248,7 @@ set par(leading: 0.7em, justify: true, linebreaks: "optimized") // Default spacing is 1.2em. - show par: set block(spacing: 0.55em) + show par: set block(spacing: 1.35em) show heading: it => { v(2.5em, weak: true) diff --git a/template/chapters/global.typ b/template/chapters/global.typ index 0ee4e5f..d62aad3 100644 --- a/template/chapters/global.typ +++ b/template/chapters/global.typ @@ -28,3 +28,4 @@ // See https://github.com/typst/packages/tree/main/packages/preview/glossarium #import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl +#import "@preview/codly:1.0.0": * diff --git a/template/chapters/glossary.typ b/template/chapters/glossary.typ index 8ed8bd3..8cfa246 100644 --- a/template/chapters/glossary.typ +++ b/template/chapters/glossary.typ @@ -2,9 +2,14 @@ // Not listed in table of contents (the outline) // Not numbered -// #heading(outlined: false, numbering: none)[ -// Glossary -// ] +// #heading(numbering: none, outlined: false)[List of Abbreviations] +// #set page(numbering: "i") +// #counter(page).update(1) +// #set heading(numbering: none) +// #show heading.where(level: 1): it => { +// it +// v(6%, weak: true) +// } // Add list of terms // Usage within text will then be #gls() or plurals #glspl() @@ -22,4 +27,4 @@ ), // show all term even if they are not referenced, default to true show-all: true, -) \ No newline at end of file +) diff --git a/template/chapters/introduction.typ b/template/chapters/introduction.typ index 21ba789..68ff5be 100644 --- a/template/chapters/introduction.typ +++ b/template/chapters/introduction.typ @@ -1,6 +1,21 @@ #import "global.typ": * #show: make-glossary +#show: codly-init This is a test for bibilography @QayyumY-sac2022. The introduction should be more in-depth than the abstract. The first time it's the long one @uit, but the second time it's the short one @uit. +```rust +pub fn main() { + println!("Hello, world!"); +} +``` + +```fsi +let x = 10 +let y = 20 +let z = x + y +``` + +For more information take a look at the repo #footnote[see #link("https://github.com/mrtz-j/typst-thesis-template")] + #lorem(100) diff --git a/template/thesis.typ b/template/thesis.typ index 8f23104..50469d7 100644 --- a/template/thesis.typ +++ b/template/thesis.typ @@ -34,6 +34,18 @@ bibliography: bibliography("refs.bib", title: "Bibliography", style: "ieee"), ) +// Code blocks +#codly(languages: ( + rust: ( + name: "Rust", + color: rgb("#CE412B"), + ), + fs: ( + name: "F#", + color: rgb("#6a0dad"), + ), +)) + #include "./chapters/glossary.typ" #pagebreak()