-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Moritz Jörg
committed
Feb 4, 2024
1 parent
f21167f
commit 0b2bf67
Showing
12 changed files
with
15,651 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build and release pdf | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release_pdf: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: Create initial tag | ||
run: | | ||
if [ -z "$(git tag -l 'v*')" ]; then | ||
git tag v0.0.0 | ||
fi | ||
- name: Bump version and push tag | ||
id: bump | ||
uses: anothrNick/github-tag-action@1.67.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: 'patch' | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ steps.bump.outputs.new_tag }} | ||
name: Version ${{ steps.bump.outputs.new_tag }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Compile Typst | ||
uses: lvignoli/typst-action@main | ||
with: | ||
source_file: | | ||
main.typ | ||
- name: Upload Release Asset - Assignment | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./main.pdf | ||
asset_name: main.pdf | ||
asset_content_type: application/pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Nix | ||
.direnv | ||
result | ||
|
||
# Output | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,67 @@ | ||
# assignment-template-typst | ||
UiT assignment typst template | ||
|
||
This repository provides a simple Typst template for writing your Assignments at UiT (The Arctic University of Tromsø). The template is _supercharged_ with the [typst](https://typst.app/home) language, which is a simple and powerful language for writing scientific documents. | ||
|
||
> [!NOTE] | ||
> This is only a template. You have to adapt the template to your current assignment! | ||
## Installation | ||
|
||
To use this template, you need to have the `typst` language installed on your computer. There are several ways to install `typst`: | ||
|
||
- Use your OS package manager like `apt` or `brew` to install Typst. Take note that these could be several versions behind the latest release. | ||
|
||
- You can also download the latest release from the [GitHub releases page](https://github.com/typst/typst/releases), which provides precompiled binaries for Windows, Linux, and macOS. | ||
|
||
- Nix users can use the provided flake, which contains the `typst`, `typstfmt` and `typst-lsp` packages. It can be activated using `direnv allow` or simply `nix flake build`. | ||
|
||
For more information on how to install `typst`, please refer to the [official documentation](https://github.com/typst/typst?tab=readme-ov-file#installation). | ||
|
||
## Usage | ||
|
||
### Set up the assignments metadata | ||
|
||
Fill in your assignment details in the `uit_template` function, it should contain the following: | ||
|
||
- Your name, Email (abc@uit.no) and GitHub user | ||
- Assignment title | ||
- Your Index Terms | ||
- An Abstract | ||
|
||
### Build PDFs locally | ||
|
||
Once you have installed Typst, you can use it like this: | ||
|
||
```console | ||
# Creates `main.pdf` in working directory. | ||
typst compile main.typ | ||
|
||
# Creates PDF file at the desired path. | ||
typst compile main.typ path/to/output.pdf | ||
``` | ||
|
||
You can also watch source files and automatically recompile on changes. This is | ||
faster than compiling from scratch each time because Typst has incremental compilation. | ||
|
||
```console | ||
# Watches source files and recompiles on changes. | ||
typst watch main.typ | ||
``` | ||
|
||
### Working in the Typst Web Editort | ||
|
||
If you prefer an Overleaf-like experience with autocompletion, preview and (soon)spellchecking, then the Typst web editor is for you. It allows you to import files directly into a new or existing document. Here's a step-by-step guide: | ||
|
||
1. Navigate to the [Typst Web Editor](https://typst.app/). | ||
|
||
2. Create or Sign in to your Account. | ||
|
||
2. Create a new blank document. | ||
|
||
3. Click on "File" on the top left menu, then "Upload File". | ||
|
||
4. Select all `.typ` and `.bib` files along with the figures (svg and png) provided in this template repository. | ||
|
||
> [!NOTE] | ||
> You can select multiple files to import at the same time. The editor will import and arrange all the files accordingly. Watch out if your figures are in a directory, the may end up in root. | ||
Oops, something went wrong.