Skip to content

Commit edefc71

Browse files
authored
feat: Remove all 3rd-party dependencies and update Typst to 1.11.0 (#10)
* Remove all 3rd-party dependencies and update Typst to 1.11.0 * Use Softwrap * fix: use filename for pipeline
1 parent 8c7efcf commit edefc71

File tree

6 files changed

+87
-117
lines changed

6 files changed

+87
-117
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77
contents: read
88

99
jobs:
10-
release_pdf:
10+
build_pdf:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout

flake.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
11
{
2-
# A helpful description of your flake
32
description = "Typst Assignment Template";
43

5-
# Flake inputs
64
inputs = {
75
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
86

97
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
108
};
119

12-
# Flake outputs that other flakes can use
1310
outputs = { self, flake-schemas, nixpkgs }:
1411
let
15-
# Helpers for producing system-specific outputs
1612
supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ];
1713
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
1814
pkgs = import nixpkgs { inherit system; };
1915
});
2016
in
2117
{
22-
# Schemas tell Nix about the structure of your flake's outputs
2318
schemas = flake-schemas.schemas;
2419

25-
# Development environments
2620
devShells = forEachSupportedSystem ({ pkgs }: {
2721
default = pkgs.mkShell {
28-
# Pinned packages available in the environment
2922
packages = with pkgs; [
3023
# Nix formatter
31-
alejandra
24+
nixpkgs-fmt
3225
# Typo checker
3326
typos
34-
# Typst LSP and Formatter
27+
# Typst CLI, LSP and Formatter
3528
typst
3629
typst-lsp
3730
typstfmt

main.typ

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#import "template.typ": *
2-
#import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx
3-
#show: uit_template.with(
4-
title: [Assignment template using IEEE-style for Journals and Transactions],
2+
#show: template.with(
3+
title: [Assignment template],
54
abstract: [
65
This document presents a number of guidelines to use when writing a report for assignments at UiT and may serve as a template for how to write it using Typst for typesetting. The template is meant to give some general tips on what you should and should not be writing in your report. You may move or cut sections and/or subsections depending on the given assignment or your needs.
76

@@ -99,13 +98,15 @@ Using figures in technical backgrounds is encouraged, if that makes the concept
9998

10099
The following snippet shows how to import figures.
101100

101+
#v(9pt)
102+
102103
#figure(
103-
image("figures/jetson_nx.png", width: 85%),
104+
image("figures/jetson_nx.png", width: 90%),
104105
caption: [Block diagram of the Jetson Xavier NX],
105106
) <fig:block_diagram>
106107

107108
#figure(
108-
image("figures/NVSD_VDD_IN.svg", width: 82%),
109+
image("figures/NVSD_VDD_IN.svg", width: 90%),
109110
caption: [Total power consumption compared between NAS and SD-Card. / _Note_ the NAS-experiment did not complete in time, and the measurements for the NAS is fit to the SD-card measurements],
110111
) <fig:local_nas_sd_compare>
111112

@@ -171,48 +172,50 @@ You should present the results of your tests here, either using an illustration
171172
#v(12pt)
172173

173174
#figure(
174-
tablex(
175+
table(
175176
columns: 7,
176177
align: center + horizon,
177178
/* --- header --- */
178-
rowspanx(2)[Classifier],
179-
colspanx(6)[Precision],
179+
table.header(
180+
table.cell([*Classifier*], rowspan: 2),
181+
table.cell([*Precision*], colspan: 6),
182+
[1],
183+
[2],
184+
[3],
185+
[1&2],
186+
[1&3],
187+
[All],
188+
),
180189
/* -------------- */
181190
/* --- body --- */
182-
[1],
183-
[2],
184-
[3],
185-
[1&2],
186-
[1&3],
187-
[All],
188191
[Perceptron],
189-
0.78,
190-
0.82,
191-
0.24,
192-
0.81,
193-
0.77,
194-
0.83,
192+
[0.78],
193+
[0.82],
194+
[0.24],
195+
[0.81],
196+
[0.77],
197+
[0.83],
195198
[Decision Tree],
196-
0.65,
197-
0.79,
198-
0.56,
199-
0.75,
200-
0.65,
201-
0.73,
199+
[0.65],
200+
[0.79],
201+
[0.56],
202+
[0.75],
203+
[0.65],
204+
[0.73],
202205
[One-Class SVM],
203-
0.74,
204-
0.72,
205-
0.50,
206-
0.80,
207-
0.73,
208-
0.85,
206+
[0.74],
207+
[0.72],
208+
[0.50],
209+
[0.80],
210+
[0.73],
211+
[0.85],
209212
[Isolation Forest],
210-
0.54,
211-
0.51,
212-
0.52,
213-
0.53,
214-
0.54,
215-
0.53,
213+
[0.54],
214+
[0.51],
215+
[0.52],
216+
[0.53],
217+
[0.54],
218+
[0.53],
216219
/* -------------- */
217220
),
218221
caption: [Precision results of classifiers for different feature sets],

template.typ

Lines changed: 34 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
1-
// This function gets your whole document as its `body` and formats
2-
// it as an article in the style of the IEEE.
3-
#let uit_template(
4-
// The paper's title.
5-
title: [Paper Title],
1+
// This function gets your whole document as its `body`.
2+
#let template(
3+
// The Assignment's title.
4+
title: [Assignment Title],
65
// An array of authors. For each author you can specify a name,
76
// department, organization, location, and email. Everything but
87
// but the name is optional.
98
authors: (),
10-
// The paper's running header
11-
header: [Paper Header],
12-
// The paper's abstract. Can be omitted if you don't have one.
9+
// The assignment's running header
10+
header: [Assignment Header],
11+
// The assignment's abstract. Can be omitted if you don't have one.
1312
abstract: none,
1413
// A list of index terms to display after the abstract.
1514
index-terms: (),
1615
// The article's paper size. Also affects the margins.
17-
paper-size: "us-letter",
16+
paper-size: "a4",
1817
// The path to a bibliography file if you want to cite some external
1918
// works.
2019
bibliography-file: none,
21-
// The paper's content.
20+
// The assignments's content.
2221
body,
2322
) = {
2423
// Set document metadata.
2524
set document(title: title, author: authors.map(author => author.name))
2625

2726
// Set the body font.
28-
// set text(font: "Times New Roman", size: 10pt)
29-
// set text(font: "New Computer Modern", size: 10pt)
3027
set text(font: "STIX Two Text", size: 10pt)
3128

3229
// Configure the page.
@@ -36,30 +33,10 @@
3633
margin: if paper-size == "a4" {
3734
(x: 41.5pt, top: 80.51pt, bottom: 89.51pt)
3835
} else {
39-
(
40-
x: (50pt / 216mm) * 100%,
41-
top: (55pt / 279mm) * 100%,
42-
bottom: (64pt / 279mm) * 100%,
43-
)
36+
(x: (50pt / 216mm) * 100%, top: (55pt / 279mm) * 100%, bottom: (64pt / 279mm) * 100%)
4437
},
4538
header: header,
46-
// Show copyright only ont the first page
47-
footer: locate(loc => {
48-
let page-counter = counter(page)
49-
if page-counter.at(loc).first() == 1 [
50-
#set align(center)
51-
#set text(8pt)
52-
979-8-3503-2934-6/23/\$31.00 ©2023 IEEE
53-
]
54-
else [
55-
#set align(center)
56-
#set text(10pt)
57-
#counter(page).display(
58-
"1/1",
59-
both: true
60-
)
61-
]
62-
}),
39+
numbering: "1/1",
6340
)
6441

6542
// Configure equation numbering and spacing.
@@ -92,19 +69,16 @@
9269
show ref: it => {
9370
if it.element != none and it.element.func() == math.equation {
9471
// Override equation references.
95-
link(it.element.location(), numbering(
96-
it.element.numbering,
97-
..counter(math.equation).at(it.element.location()),
98-
))
72+
link(it.element.location(), numbering(it.element.numbering, ..counter(math.equation).at(it.element.location())))
9973
} else {
10074
// Other references as usual.
10175
it
10276
}
10377
}
10478

10579
// Configure Tables
106-
// set table(stroke: 0.5pt)
107-
// show table: set text(8pt)
80+
set table(stroke: 0.5pt)
81+
show table: set text(8pt)
10882

10983
// Configure lists.
11084
set enum(indent: 10pt, body-indent: 9pt)
@@ -157,7 +131,7 @@
157131
]
158132
})
159133

160-
// Display the paper's title.
134+
// Display the assignments's title.
161135
v(3pt, weak: true)
162136
align(center, text(22pt, title))
163137
v(8.35mm, weak: true)
@@ -167,28 +141,24 @@
167141
let end = calc.min((i + 1) * 4, authors.len())
168142
let is-last = authors.len() == end
169143
let slice = authors.slice(i * 4, end)
170-
grid(
171-
columns: slice.len() * (1fr,),
172-
gutter: 12pt,
173-
..slice.map(author => align(center, {
174-
text(12pt, author.name)
175-
if "department" in author [
176-
\ #emph(author.department)
177-
]
178-
if "organization" in author [
179-
\ #emph(author.organization)
180-
]
181-
if "location" in author [
182-
\ #author.location
183-
]
184-
if "email" in author [
185-
\ #link("mailto:" + author.email)
186-
]
187-
if "git" in author [
188-
\ #author.git
189-
]
190-
})),
191-
)
144+
grid(columns: slice.len() * (1fr,), gutter: 12pt, ..slice.map(author => align(center, {
145+
text(12pt, author.name)
146+
if "department" in author [
147+
\ #emph(author.department)
148+
]
149+
if "organization" in author [
150+
\ #emph(author.organization)
151+
]
152+
if "location" in author [
153+
\ #author.location
154+
]
155+
if "email" in author [
156+
\ #link("mailto:" + author.email)
157+
]
158+
if "git" in author [
159+
\ #author.git
160+
]
161+
})))
192162

193163
if not is-last {
194164
v(16pt, weak: true)
@@ -215,7 +185,7 @@
215185
#v(2pt)
216186
]
217187

218-
// Display the paper's contents.
188+
// Display the assignments's contents.
219189
body
220190

221191
// Display bibliography.

typstfmt.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
indent_space = 2
2+
max_line_length = 120
3+
experimental_args_breaking_consecutive = false
4+
line_wrap = true

0 commit comments

Comments
 (0)