diff --git a/lib.typ b/lib.typ deleted file mode 100644 index a479d4d..0000000 --- a/lib.typ +++ /dev/null @@ -1,95 +0,0 @@ -// Royal Holloway, University of London Report template -// Created by Otto Helen-Goldring in 2024 under the MIT License. -// Modified from light-report-uia (https://typst.app/universe/package/light-report-uia/) - -#let report( - title: none, - author: none, - group_name: none, - course_name: none, - unit_type: none, - report_type: none, - supervisor: none, - date: none, - location: "Egham", - references: "references.yml", - body -) = { - set document(title: [#title - #group_name], author: author) - set text(font: ("Fira Sans", "Helvetica", "Arial", "Roboto", "SF Pro Display", "Segoe UI")) - set par(justify: true) - show link: underline - - show heading: set block(above: 30pt, below: 30pt) - - show heading.where(level: 1): set text(size: 20pt) - - show heading.where(level: 1): set heading(supplement: [Chapter]) - show heading.where(level: 1): it => block({ - let prefix = if it.numbering != none { - it.supplement + [ ] + counter(heading).display(it.numbering) + [: ] - } - text(weight: "regular",prefix) + it.body - }) - - show heading.where(level: 2): set text(size: 16pt) - - set page(header: context {if counter(page).get().first() > 1 [#report_type #h(1fr) #author]}) - - - // FRONT PAGE - set align(center) - - text(10pt, author + ", " + date) - v(5mm) - - text(22pt, "Final Year Project Report") - v(1mm) - text(14pt, unit_type + " - " + report_type, weight: "bold") - v(3mm) - line(length: 30%) - text(25pt, weight: "bold", title) - v(3mm) - - text(18pt, group_name) - text(18pt, author) - v(3mm) - line(length: 30%) - - text(14pt, report_type + " submitted in part fulfilment of the degree of ") - v(3mm) - text(16pt, weight: "bold")[ #course_name ] - v(3mm) - text(18pt, "Supervisor: ", weight: "bold") - text(18pt, supervisor) - - v(1fr) // to bottom - block(height: 25%, image("media/rhul.jpg", height: 75%)) - text(14pt)[Department of Computer Science#linebreak()Royal Holloway, University of London] - v(20mm) - - text(12pt)[#location, #date] - - pagebreak() - - // contents page - set align(left) - set heading(numbering: "1.1") - - - outline(indent:2em, title: "Contents") - - pagebreak() - - // after the front page and content things - - set page(numbering: "1", number-align: center) - counter(page).update(1) - - // main.typ - body - - pagebreak() - - bibliography("template/" + references, title: "Bibliography") -} diff --git a/main.pdf b/main.pdf new file mode 100644 index 0000000..dcb2f7e Binary files /dev/null and b/main.pdf differ diff --git a/main.typ b/main.typ new file mode 100644 index 0000000..e7c5fe5 --- /dev/null +++ b/main.typ @@ -0,0 +1,168 @@ +// Royal Holloway, University of London Report template +// Created by Otto Helen-Goldring in 2024 under the MIT License. +// Modified from light-report-uia (https://typst.app/universe/package/light-report-uia/) + +// The main report template function. +// It sets up the document's structure, styling, and front matter. +#let report( + title: none, + author: none, + group_name: none, + course_name: none, + unit_type: none, + report_type: none, + supervisor: none, + date: none, + location: "Egham", + references: "references.yml", // Note: This file needs to exist. + body +) = { + // === DOCUMENT SETUP === + set document(title: [#title - #group_name], author: author) + // set text(font: ("Fira Sans", "Helvetica", "Arial", "Roboto") // Custom font can be set here + set par(justify: true) + show link: underline + + // === HEADING STYLES === + show heading: set block(above: 30pt, below: 30pt) + + // Chapter-level headings + show heading.where(level: 1): set text(size: 20pt) + show heading.where(level: 1): set heading(supplement: [Chapter]) + show heading.where(level: 1): it => block({ + let prefix = if it.numbering != none { + it.supplement + [ ] + counter(heading).display(it.numbering) + [: ] + } + text(weight: "regular", prefix) + it.body + }) + + // Section-level headings + show heading.where(level: 2): set text(size: 16pt) + + // === PAGE SETUP === + // Add a header to all pages except the first one. + set page(header: context {if counter(page).get().first() > 1 [#report_type #h(1fr) #author]}) + + + // === FRONT PAGE === + set align(center) + + text(10pt, author + ", " + date) + v(5mm) + + text(22pt, "Final Year Project Report") + v(1mm) + text(14pt, unit_type + " - " + report_type, weight: "bold") + v(3mm) + line(length: 30%) + text(25pt, weight: "bold", title) + v(3mm) + + text(18pt, group_name) + text(18pt, author) + v(3mm) + line(length: 30%) + + text(14pt, report_type + " submitted in part fulfilment of the degree of ") + v(3mm) + text(16pt, weight: "bold")[#course_name] + v(3mm) + text(18pt, "Supervisor: ", weight: "bold") + text(18pt, supervisor) + + v(1fr) // Pushes the following content to the bottom of the page. + + block(height: 25%, image("media/rhul.jpg", height: 75%)) + + text(14pt)[Department of Computer Science#linebreak()Royal Holloway, University of London] + v(20mm) + + text(12pt)[#location, #date] + + pagebreak() + + // === TABLE OF CONTENTS === + set align(left) + set heading(numbering: "1.1") + + outline(indent: 2em, title: "Contents") + + pagebreak() + + // === MAIN BODY === + // Reset page numbering for the main content. + set page(numbering: "1", number-align: center) + counter(page).update(1) + + // The main content of the document is passed in here. + body + + // === BIBLIOGRAPHY === + // The bibliography has been commented out to prevent rendering errors. + // To use it, create a "references.yml" file and uncomment the line below. + // bibliography(references, title: "Bibliography") +} + +// === DOCUMENT CONFIGURATION === +// Apply the 'report' template to the entire document with the specified parameters. +#show: report.with( + title: "Algorithms for Lightsaber Dueling", + author: "Anakin Skywalker", + group_name: "Jedi Order Research Group", // Added for completeness + unit_type: "Full Unit", + report_type: "Final Report", + course_name: "BSc (Hons) in Computer Science", + supervisor: "Obi-Wan Kenobi", + date: "October 2024", + references: "references.yml" // Specify your bibliography file here +) + + + +// === MAIN CONTENT STARTS HERE === + += Examples + +#lorem(20) + +== Citation +This is something stated from a source. +// The citation @example-source was removed because the bibliography is currently disabled. +// You will need to add an entry for "example-source" in your "references.yml" file. + + +== Tables +Here's a table: +#figure( + caption: [Table of numbers], + table( + columns: (auto, auto), + inset: 8pt, + align: horizon, + table.header( + [*Letters*], [*Number*], + ), + [Five], [5], + [Eight], [8], + ) +) + +== Code blocks +Here's a code block in Golang: + +```go +package main +import "fmt" +func main() { + fmt.Println("Hello, world!") +} +``` + +== Math +Let $a$, $b$, and $c$ be the side +lengths of right-angled triangle. +Then, we know that: +$ a^2 + b^2 = c^2 $ + +Prove by induction: +$ sum_(k=1)^n k = (n(n+1)) / 2 $ \ No newline at end of file diff --git a/template/references.yml b/references.yml similarity index 100% rename from template/references.yml rename to references.yml diff --git a/template/main.pdf b/template/main.pdf deleted file mode 100644 index 224a019..0000000 Binary files a/template/main.pdf and /dev/null differ diff --git a/template/main.typ b/template/main.typ deleted file mode 100644 index e15aec0..0000000 --- a/template/main.typ +++ /dev/null @@ -1,60 +0,0 @@ -#import "../lib.typ": * - -#show: report.with( - title: "Algorithms for Lightsaber dueling", // Change accordingly - author: "Anakin Skywalker", // Add your name here - unit_type: "Full Unit", // Full Unit or Half Unit - report_type: "Final Report", // Project Plan, Interim Report, Final Report - course_name: "BSc (Hons) in Computer Science", // Change accordingly - supervisor: "Obi-Wan Kenobi", // Add your supervisor's name here - date: "October 2024", // Change accordingly -) - -#import "@preview/codly:1.0.0": * -#show: codly-init.with() -#codly(zebra-fill: color.hsl(200deg, 80%, 95%, 98%)) -#codly(display-name: false) - -= Examples - -#lorem(20) - -== Citation -This is something stated from a source @example-source. - -== Tables -Here's a table: -#figure( - caption: [Table of numbers], - table( - columns: (auto, auto), - inset: 8pt, - align: horizon, - table.header( - [*Letters*], [*Number*], - ), - [Five], [5], - [Eight], [8], - ) -) - -== Code blocks -Here's a code block in Golang: - -```go -package main -import "fmt" -func main() { - fmt.Println("Hello, world!") -} -``` - - -== Math -Let $a$, $b$, and $c$ be the side -lengths of right-angled triangle. -Then, we know that: -$ a^2 + b^2 = c^2 $ - -Prove by induction: -$ sum_(k=1)^n k = (n(n+1)) / 2 $ \ No newline at end of file