hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/templates/paper.typ
blob: c7658ecc1afc74093cfe66bda07e487c7df616b6 (plain)
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
#let paper-title(title, date) = [
  #place(top + center, float: true)[
    #block(width: 100%)[
      #align(center)[
        #text(size: 18pt)[#smallcaps[#title]] \
        #v(0em)
        #text(size: 12pt)[--- #smallcaps(date) ---]
      ]
    ]
  ]
]

#let author-block(authors) = [
  #align(center)[
    #for author in authors [
      #author.name \
      #text(style: "italic")[#author.location]
    ]
  ]
  #v(1.2em)
]

#let abstract-block(body) = [
  #block(width: 100%)[
    #text(weight: "bold")[Abstract---]
    #body
  ]
  #v(0.8em)
]

#let paper(
  title: none,
  date: none,
  authors: (),
  abstract: none,
  font: "EB Garamond",
  size: 10pt,
  doc,
) = {
  set document(title: title, author: authors.map(author => author.name))

  set page(
    paper: "a4",
    margin: (top: 19mm, bottom: 25mm, left: 16mm, right: 16mm),
    columns: 2,
    numbering: "- 1/1 -",
  )

  set par(justify: true, leading: 0.55em)
  set text(font: font, size: size)
  set figure(gap: 0.65em)

  show heading.where(level: 1): it => [
    #v(0.8em)
    #text(size: 12pt, weight: "medium")[#align(center)[#smallcaps[#it.body]]]
    #v(0.35em)
  ]

  show heading.where(level: 2): it => [
    #v(0.6em)
    #align(right)[#text(size: 10pt, style: "italic")[#it.body]]
    #v(0.25em)
  ]

  show heading.where(level: 3): it => [
    #v(0.5em)
    #text(size: 10pt, weight: "bold", style: "italic")[#it.body]
    #v(0.15em)
  ]

  show figure.where(kind: table): set text(size: 8.5pt)
  show bibliography: set text(size: 8.5pt)

  paper-title(title, date)
  author-block(authors)

  if abstract != none {
    abstract-block(abstract)
  }

  doc
}