Skip to content

Commit 4b73387

Browse files
authored
arkheion:0.1.1 (typst#3121)
1 parent 0ba7b2c commit 4b73387

File tree

8 files changed

+406
-0
lines changed

8 files changed

+406
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# arkheion
2+
3+
A Typst template based on popular LateX template used in arXiv and bio-arXiv. Inspired by [arxiv-style](https://github.com/kourgeorge/arxiv-style)
4+
5+
## Usage
6+
7+
**Import**
8+
9+
```
10+
#import "@preview/arkheion:0.1.1": arkheion, arkheion-appendices
11+
```
12+
13+
**Main body**
14+
15+
```
16+
#show: arkheion.with(
17+
title: "ArXiv Typst Template",
18+
authors: (
19+
(name: "Author 1", email: "user@domain.com", affiliation: "Company", orcid: "0000-0000-0000-0000"),
20+
(name: "Author 2", email: "user@domain.com", affiliation: "Company"),
21+
),
22+
// Insert your abstract after the colon, wrapped in brackets.
23+
// Example: `abstract: [This is my abstract...]`
24+
abstract: lorem(55),
25+
keywords: ("First keyword", "Second keyword", "etc."),
26+
date: "May 16, 2023",
27+
)
28+
```
29+
30+
**Appendix**
31+
32+
```
33+
#show: arkheion-appendices
34+
=
35+
36+
== Appendix section
37+
38+
#lorem(100)
39+
40+
```
41+
42+
## API
43+
44+
### `arkheion.with`
45+
46+
- `title: String` - Title of the document.
47+
- `authors: List<Author>` - List of authors.
48+
```
49+
Author: {
50+
name: String,
51+
email: String,
52+
affiliation: String,
53+
orcid: String
54+
}
55+
```
56+
- `custom-authors: Content` - Custom authors content that overrides the default authors content.
57+
Note: The `authors` is still required to be passed in order to generate the metadata, however, only the `name` field is required.
58+
- `abstract: Content` - Abstract of the document.
59+
- `keywords: List<String>` - List of keywords.
60+
- `date: String` - Date of the document.
61+
62+
## License
63+
The MIT License (MIT)
64+
65+
Copyright (c) 2023 Manuel Goulão
66+
67+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
68+
69+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
70+
71+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
222 KB
Loading
Lines changed: 21 additions & 0 deletions
Loading
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#let arkheion(
2+
title: "",
3+
abstract: none,
4+
keywords: (),
5+
authors: (),
6+
custom-authors: none,
7+
date: none,
8+
body,
9+
) = {
10+
// Set the document's basic properties.
11+
set document(author: authors.map(a => a.name), title: title)
12+
set page(
13+
margin: (left: 25mm, right: 25mm, top: 25mm, bottom: 30mm),
14+
numbering: "1",
15+
number-align: center,
16+
)
17+
set text(font: "New Computer Modern", lang: "en")
18+
show math.equation: set text(weight: 400)
19+
show math.equation: set block(spacing: 0.65em)
20+
set math.equation(numbering: "(1)")
21+
set heading(numbering: "1.1")
22+
23+
// Set run-in subheadings, starting at level 4.
24+
show heading: it => {
25+
// H1 and H2
26+
if it.level == 1 {
27+
pad(
28+
bottom: 10pt,
29+
it
30+
)
31+
}
32+
else if it.level == 2 {
33+
pad(
34+
bottom: 8pt,
35+
it
36+
)
37+
}
38+
else if it.level > 3 {
39+
text(11pt, weight: "bold", it.body + " ")
40+
} else {
41+
it
42+
}
43+
}
44+
45+
line(length: 100%, stroke: 2pt)
46+
// Title row.
47+
pad(
48+
bottom: 4pt,
49+
top: 4pt,
50+
align(center)[
51+
#block(text(weight: 500, 1.75em, title))
52+
#v(1em, weak: true)
53+
]
54+
)
55+
line(length: 100%, stroke: 2pt)
56+
57+
// Author information.
58+
if custom-authors != none {
59+
custom-authors
60+
} else {
61+
pad(
62+
top: 0.5em,
63+
x: 2em,
64+
grid(
65+
columns: (1fr,) * calc.min(3, authors.len()),
66+
gutter: 1em,
67+
..authors.map(author => align(center)[
68+
#if author.keys().contains("orcid") {
69+
link("http://orcid.org/" + author.orcid)[
70+
#pad(bottom: -8pt,
71+
grid(
72+
columns: (8pt, auto, 8pt),
73+
rows: 10pt,
74+
[],
75+
[*#author.name*],
76+
[
77+
#pad(left: 4pt, top: -4pt, image("orcid.svg", width: 8pt))
78+
]
79+
)
80+
)
81+
]
82+
} else {
83+
grid(
84+
columns: (auto),
85+
rows: 2pt,
86+
[*#author.name*],
87+
)
88+
}
89+
#author.email \
90+
#author.affiliation
91+
]),
92+
),
93+
)
94+
}
95+
96+
align(center)[#date]
97+
98+
// Abstract.
99+
if abstract != none {
100+
pad(
101+
x: 3em,
102+
top: 1em,
103+
bottom: 0.4em,
104+
align(center)[
105+
#heading(
106+
outlined: false,
107+
numbering: none,
108+
text(0.85em, smallcaps[Abstract]),
109+
)
110+
#set par(justify: true)
111+
#set text(hyphenate: false)
112+
113+
#abstract
114+
],
115+
)
116+
}
117+
118+
// Keywords
119+
if keywords.len() > 0 {
120+
[*_Keywords_* #h(0.3cm)] + keywords.map(str).join(" · ")
121+
}
122+
// Main body.
123+
set par(justify: true)
124+
set text(hyphenate: false)
125+
126+
body
127+
}
128+
129+
#let arkheion-appendices(body) = {
130+
counter(heading).update(0)
131+
counter("appendices").update(1)
132+
133+
set heading(
134+
numbering: (..nums) => {
135+
let vals = nums.pos()
136+
let value = "ABCDEFGHIJ".at(vals.at(0) - 1)
137+
if vals.len() == 1 {
138+
return "APPENDIX " + value
139+
}
140+
else {
141+
return value + "." + nums.pos().slice(1).map(str).join(".")
142+
}
143+
}
144+
);
145+
[#pagebreak() #body]
146+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@article{hinton2015distilling,
2+
title = {Distilling the Knowledge in a Neural Network},
3+
author = {Geoffrey E. Hinton and Oriol Vinyals and Jeffrey Dean},
4+
journal = {ArXiv},
5+
year = {2015},
6+
volume = {abs/1503.02531}
7+
}
8+
9+
@inproceedings{Vaswani2017AttentionIA,
10+
title = {Attention is All you Need},
11+
author = {Ashish Vaswani and Noam M. Shazeer and Niki Parmar and Jakob Uszkoreit and Llion Jones and Aidan N. Gomez and Lukasz Kaiser and Illia Polosukhin},
12+
booktitle = {NIPS},
13+
year = {2017}
14+
}
305 Bytes
Loading
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#import "@preview/arkheion:0.1.1": arkheion, arkheion-appendices
2+
3+
#show: arkheion.with(
4+
title: "Typst Template for arXiv",
5+
authors: (
6+
(name: "Author 1", email: "user@domain.com", affiliation: "Company", orcid: "0000-0000-0000-0000"),
7+
(name: "Author 2", email: "user@domain.com", affiliation: "Company"),
8+
),
9+
// Insert your abstract after the colon, wrapped in brackets.
10+
// Example: `abstract: [This is my abstract...]`
11+
abstract: lorem(55),
12+
keywords: ("First keyword", "Second keyword", "etc."),
13+
date: "May 16, 2023",
14+
)
15+
#set cite(style: "chicago-author-date")
16+
#show link: underline
17+
18+
= Introduction
19+
#lorem(60)
20+
21+
= Heading: first level
22+
#lorem(20)
23+
24+
== Heading: second level
25+
#lorem(20)
26+
27+
=== Heading: third level
28+
29+
==== Paragraph
30+
#lorem(20)
31+
32+
#lorem(20)
33+
34+
= Math
35+
36+
*Inline:* Let $a$, $b$, and $c$ be the side
37+
lengths of right-angled triangle. Then, we know that: $a^2 + b^2 = c^2$
38+
39+
*Block without numbering:*
40+
41+
#math.equation(block: true, numbering: none, [
42+
$
43+
sum_(k=1)^n k = (n(n+1)) / 2
44+
$
45+
]
46+
)
47+
48+
*Block with numbering:*
49+
50+
As shown in @equation.
51+
52+
$
53+
sum_(k=1)^n k = (n(n+1)) / 2
54+
$ <equation>
55+
56+
*More information:*
57+
- #link("https://typst.app/docs/reference/math/equation/")
58+
59+
60+
= Citation
61+
62+
You can use citations by using the `#cite` function with the key for the reference and adding a bibliography. Typst supports BibLateX and Hayagriva.
63+
64+
```typst
65+
#bibliography("bibliography.bib")
66+
```
67+
68+
Single citation @Vaswani2017AttentionIA. Multiple citations @Vaswani2017AttentionIA @hinton2015distilling. In text #cite(<Vaswani2017AttentionIA>, form: "prose")
69+
70+
*More information:*
71+
- #link("https://typst.app/docs/reference/meta/bibliography/")
72+
- #link("https://typst.app/docs/reference/meta/cite/")
73+
74+
= Figures and Tables
75+
76+
77+
#figure(
78+
table(
79+
align: center,
80+
columns: (auto, auto),
81+
row-gutter: (2pt, auto),
82+
stroke: 0.5pt,
83+
inset: 5pt,
84+
[header 1], [header 2],
85+
[cell 1], [cell 2],
86+
[cell 3], [cell 4],
87+
),
88+
caption: [#lorem(5)]
89+
) <table>
90+
91+
#figure(
92+
image("image.png", width: 30%),
93+
caption: [#lorem(7)]
94+
) <figure>
95+
96+
*More information*
97+
98+
- #link("https://typst.app/docs/reference/meta/figure/")
99+
- #link("https://typst.app/docs/reference/layout/table/")
100+
101+
= Referencing
102+
103+
@figure #lorem(10), @table.
104+
105+
*More information:*
106+
107+
- #link("https://typst.app/docs/reference/meta/ref/")
108+
109+
= Lists
110+
111+
*Unordered list*
112+
113+
- #lorem(10)
114+
- #lorem(8)
115+
116+
*Numbered list*
117+
118+
+ #lorem(10)
119+
+ #lorem(8)
120+
+ #lorem(12)
121+
122+
*More information:*
123+
- #link("https://typst.app/docs/reference/layout/enum/")
124+
- #link("https://typst.app/docs/reference/meta/cite/")
125+
126+
127+
// Add bibliography and create Bibiliography section
128+
#bibliography("bibliography.bib")
129+
130+
// Create appendix section
131+
#show: arkheion-appendices
132+
=
133+
134+
== Appendix section
135+
136+
#lorem(100)
137+

0 commit comments

Comments
 (0)