Skip to content

Commit

Permalink
Merge pull request #15 from krestenlaust/make-demo-template
Browse files Browse the repository at this point in the history
Make demo template
  • Loading branch information
krestenlaust authored Jan 23, 2024
2 parents 4582423 + a1b5403 commit cb1e855
Show file tree
Hide file tree
Showing 20 changed files with 1,730 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Typst
- name: Compile singlefile-template
uses: lvignoli/typst-action@main
with:
source_file: main.typ
source_file: singlefile-template/main.typ

#- name: Compile report-template
# uses: lvignoli/typst-action@main
# with:
# source_file: report-template/main.typ

- name: Upload PDF file
uses: actions/upload-artifact@v3
with:
name: PDF
path: main.pdf
path: |
singlefile-template/main.pdf
#report-template/main.pdf
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# AAU Typst Template
The widely used AAU LaTeX report template, rewritten in Typst

## Project Structure
This is an overview of the folders/files in the root of this repository:

Each template contains the following:

- `AAUgraphics`
Contains the graphics used in the template.

- `main.typ`
This is the main source, it includes any other files, and this file is the sole target for the compiler, if you want to compile locally, run `typst compile main.typ`.

- `template.typ`
The main template file. This file is located in `report-template` (and a copy is stored in `singlefile-template`).
This file uses the graphics located in `AAUgraphics`.


## Inspiration
Typst looks pretty cool: [https://typst.app/home](https://typst.app/home)

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
73 changes: 73 additions & 0 deletions report-template/chapters/introduction.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
= Introduction
Getting started with Typst shouldn't be that difficult. The language is pretty similar to JavaScript #footnote([A programming language which is known for its incredible type system!]).

- This is a list item
- This is also a list item

+ This is an enumerated list item
+ This is another one

== Basic Math
Math in Typst, is pretty similar to the way it's done in LaTeX. Here are some basic equations.

The sum of the numbers from
$1$ to $n$ is:

$ sum_(k=1)^n k = (n(n+1))/2 $

This math isn't centered:

// No spaces around the $-signs
$x=123+123$

This is:

#figure(
rect[$ delta "if" x <= 5 $],
caption: [This is an equation as a figure *with* a border]
) <math:borderedEquation>

#figure(
[$ f(x) = (x + 1) / x $],
caption: [This is an equation as a figure *without* a border]
) <math:simpleEquation>

The math in @math:simpleEquation is referenced right here.

=== Matrices

This is an example of a matrix:
$ mat(
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10;
) $


== Sources & bibliography
To add a source, you just have to reference your `.bib` file like the following anywhere in a document:
```typst
#bibliography("sources/sample.bib")
```

In this project it's located in `main.typ`. Now it can be referred the same way a figure is referred: `@einstein` @einstein. A reference only shows up in the bibliography section if it has at least one mention.


== Getting Started
How do I start?

=== Write Typst Collaboratively
You can use #link("https://typst.app/")[Typst.app] to write collaboratively. Just download #link("https://github.com/krestenlaust/AAU-Typst-Template/")[this project] as zip, and upload the following to an empty typst project:

- main.typ
- template.typ
- (folder) AAUgraphics
- (folder) Chapters

== Other Functions
This is the lorem ipsum function:
#lorem(20)

=== Contributions
#lorem(40)
37 changes: 37 additions & 0 deletions report-template/chapters/technical_elements.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
= Using Various Technical Elements
This section covers the following topics:
- Code formatting
- Some graphs

== Representing Code
The easiest way to represent code in a document is using the native Typst functionality. It uses the exact same syntax as regular extended markdown.

This is an example of Scala.
```scala
@main def hello() =
println("Hello world")
```

Below is an example of how to make it a figure.

#figure(
rect( // The rectangle is optional.
```scala
@main def hello() =
println("Hello world")
```),
caption: [The same snippet of Scala code, now as a figure#footnote([You will notice that Typst has automatically detected it as a Listing and is numbering it accordingly])]
) <code:scala-snippet>


@code:scala-snippet shows how to put a piece of code into a figure, and this text shows how to reference it.

=== Line numbers
So you want line numbers as well? This isn't natively supported#footnote([This is most likely because of the KISS-principle.]), but the community has developed a couple packages to solves this.

// TODO: Write section about using line numbers.

== Use of Packages
This section refers to the packages located here: https://typst.app/docs/packages/.

// TODO: Write short section about packages.
20 changes: 20 additions & 0 deletions report-template/chapters/understanding_typst.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
= Command- and Markup-Mode
Typst has two modes of text. This text right here is written directly in markup mode. The default mode of a document is always markup mode. To enter command mode for a single command, the \# is used.

rect()
#rect()

To enter markup mode in a command context/mode, use [], previously shown, this can be thought of as similar to a string in a general-purpose programming language#footnote("Typst also has a concept of strings (using double quotes \"), used primarily in functions, like this one right here.")#footnote([This could've also been written using this mode. This way its easier to markup *things* than in a string.]).

These two operators combined can be used for the following:
#[This is exactly the same as] writing the text like this.


To enter command-mode for multiple commands, use {}#footnote([This is generally only used in the template file, it's pretty rare to need to use multiple commands in a row, in documents like this one.])

== Further reading & Assistance
The Typst documentation has, for the most part, matured enough to answer any question. The documentation is located at https://typst.app/docs. Furthermore, the documentation site often appears in Google search results.

Typst has a very welcoming community, the easiest and fastest place to get help with an issue is their Discord server at https://typst.app/docs/community/.

If you are a fellow student on AAU (Or any other university/high-school for that sake), and are experiencing issues with this Template (Or Typst in general) feel free to reach out at `kscker23[at]student.aau.dk`, and I'll do my best.
38 changes: 38 additions & 0 deletions report-template/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#import "template.typ": *

// Take a look at the file `template.typ` in the file panel
// to customize this template and discover how it works.
#show: project.with(
meta: (
title: "A demonstration of the features of Typst",
theme: "Marvelous Theme",
project_period: "Fall Semester 2023",
project_group: "group 1",
participants: (
(name: "Kresten", email: "kresten@gmail.com"),
(name: "Laust", email: "laust@gmail.com"),
),
supervisor: (
(name: "Anders And", email: "abc@abc.com"),
),
date: "21. December 2023",
),
// Insert your abstract after the colon, wrapped in brackets.
// Example: `abstract: [This is my abstract...]`
abstract: lorem(59),
department: "Computer Science",
)

// This is the primary file in the project.
// Commonly referred to as 'master' in LaTeX, and wokenly called 'main' in Typst.

#include "Chapters/introduction.typ"
#pagebreak(weak: true)

#include "Chapters/technical_elements.typ"
#pagebreak(weak: true)

#include "Chapters/understanding_typst.typ"
#pagebreak(weak: true)

#bibliography("sources/sample.bib")
11 changes: 11 additions & 0 deletions report-template/sources/sample.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@article{einstein,
author = {Einstein, Albert},
title = {On the Electrodynamics of Moving Bodies},
journal = {Annalen der Physik},
volume = {322},
number = {10},
pages = {891--921},
year = {1905},
publisher = {Wiley-VCH},
doi = {10.1002/andp.19053221004}
}
File renamed without changes.
Loading

0 comments on commit cb1e855

Please sign in to comment.