-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypst_examples.typ
More file actions
122 lines (91 loc) · 4.4 KB
/
typst_examples.typ
File metadata and controls
122 lines (91 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
= Text
== External links
'Ilm adds a small maroon circle to external (outgoing) links #link("https://github.com/talal/ilm")[like so].
This acts as a hint for the reader so that they know that a specific text is a hyperlink. This is far better than #underline[underlining a hyperlink] or making it a #text(fill: blue)[different color]. Don't you agree?
If you want to disable this behavior then you can do so by setting the concerning option to `false`:
```typst
#show: ilm.with(
external-link-circle: false
)
```
== Blockquotes
'Ilm also exports a `blockquote` function which can be used to create blockquotes. The function has one argument: `body` of the type content and can be used like so:
```typst
#blockquote[
A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to.
]
```
The above code will render the following:
#blockquote[A wizard is never late, Frodo Baggins. Nor is he early. He arrives precisely when he means to. -- Gandalf]
== Small- and all caps
'Ilm also exports functions for styling text in small caps and uppercase, namely: `smallcaps` and `upper` respectively.
These functions will overwrite the standard #link("https://typst.app/docs/reference/text/smallcaps/")[`smallcaps`] and #link("https://typst.app/docs/reference/text/upper/")[`upper`] functions that Typst itself provides. This behavior is intentional as the functions that 'Ilm exports fit in better with the rest of the template's styling.
Here is how Typst's own #std-smallcaps[smallcaps] and #std-upper[upper] look compared to the 'Ilm's variants:\
#hide[Here is how Typst's own ] #smallcaps[smallcaps] and #upper[upper]
They both look similar, the only difference being that 'Ilm uses more spacing between individual characters.
If you prefer Typst's default spacing then you can still use it by prefixing `std-` to the functions: ```typst #std-smallcaps()``` and ```typst #std-upper()```.
== Footer
If a page does not begin with a chapter then we display the chapter's name, to which the current section belongs, in the footer. #link(<demo>)[Click here] to go to @demo down below and see the footer in action.
= Figures
The template also displays an index of figures (images), tables, and listings (code blocks) at the end of the document, if you set the respective options to `true`:
```typst
#show: ilm.with(
figure-index: (enabled: true),
table-index: (enabled: true),
listing-index: (enabled: true)
)
```
== Tables
In order to increase the focus on table content, we minimize the table's borders by using thin gray lines instead of thick black ones. Additionally, we use small caps for the header row. Take a look at the table below:
#let unit(u) = math.display(math.upright(u))
#let si-table = table(
columns: 3,
table.header[Quantity][Symbol][Unit],
[length], [$l$], [#unit("m")],
[mass], [$m$], [#unit("kg")],
[time], [$t$], [#unit("s")],
[electric current], [$I$], [#unit("A")],
[temperature], [$T$], [#unit("K")],
[amount of substance], [$n$], [#unit("mol")],
[luminous intensity], [$I_v$], [#unit("cd")],
)
#figure(caption: ['Ilm's styling], si-table)
For comparison, this is how the same table would look with Typst's default styling:
#[
#set table(inset: 5pt, stroke: 1pt + black)
#show table.cell.where(y: 0): it => {
v(0.5em)
h(0.5em) + it.body.text + h(0.5em)
v(0.5em)
}
#figure(caption: [Typst's default styling], si-table)
]
= Code
== Custom font
'Ilm uses the _Iosevka_@wikipedia_iosevka font for raw text instead of the default _Fira Mono_. If Iosevka is not installed then the template will fall back to Fira Mono.
#let snip(cap) = figure(caption: cap)[
```rust
fn main() {
let user = ("Adrian", 38);
println!("User {} is {} years old", user.0, user.1);
// tuples within tuples
let employee = (("Adrian", 38), "die Mobiliar");
println!("User {} is {} years old and works for {}", employee.0.1, employee.0.1, employee.1);
}
```
]
#show raw: set text(font: "Fira Mono")
For comparison, here is what `code` in Fira Mono looks like:
#snip("Code snippet typeset in Fira Mono font")
#show raw: set text(font: ("Iosevka", "Fira Mono"))
and here is how the same `code` looks in Iosevka:
#snip("Code snippet typeset in Iosevka font")
In the case that both code snippets look the same then it means that Iosevka is not installed on your computer.
= Footer Demo
== Subheading
#lorem(120)
#lorem(55)
#lorem(120)
#pagebreak()
== Subheading Two <demo>
#lorem(55)