-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.typ
89 lines (77 loc) · 2.4 KB
/
template.typ
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
#let properties_schema = (
title: "Document Title",
author: "Author Name",
course: "Course Name",
course_id: "COURSE_ID",
date: datetime.today().display("[day]/[month]/[year]"),
landscape: false,
margin_x: 2cm,
margin_y: 2cm,
paper: "a5",
)
// completes the user-provided properties with default values for missing fields
#let complete_properties(user_properties) = {
let completed_properties = (:)
for (key, value) in properties_schema {
completed_properties.insert(key, user_properties.at(key, default: value))
}
completed_properties
}
#let generate_header(properties) = {
align(center, [
#text(size: 1.8em, font: "Baskerville", properties.title) \
#text(size: 1.0em, font: "LT Remark", pad(properties.course))
#text(size: 1.0em, font: "Alegreya", properties.author) \
#text(size: 0.6em, font: "Wittgenstein", properties.date)
#v(30pt)
])
}
#let img(path, caption) = {
pad(y: 2em, [
#figure(
image(path, width: 100%),
caption: caption
)
])
}
#let footer_lead(properties) = [Trabalho realizado para a disciplina de #properties.course (#properties.course_id) do curso de _Análise e Desenvolvimento de Sistemas_ do Instituto Federal de São Paulo, campus Jacareí.]
#let pager(properties, loc) = {
let page = counter(page).at(loc)
if page.at(0) == 1 {
[
#line(length: 20%, stroke: 0.2pt)
#text(font: "Baskerville", size: 7pt, footer_lead(properties))
]
} else {
align(center, [#page.at(0)])
}
}
#let generate_document(body, properties: {}) = {
properties = complete_properties(properties)
set document(
title: properties.title,
author: properties.author,
date: auto,
keywords: (properties.course, properties.course_id, "IFSP", "IFSP-JCR"),
)
set text(font: "Baskerville", size: 10pt, lang: "pt")
set heading(numbering: "1.")
set enum(numbering: "1.1.", full: true)
set par(justify: true, leading: 0.7em,)
set quote(block: true, quotes: true)
set footnote.entry(gap: 1em, clearance: 1em)
show quote: set text(style: "italic")
show figure: set figure(gap: 2em)
show ref: set text(rgb("#308280"))
show link: underline
set page(
paper: properties.paper,
flipped: properties.landscape,
margin: (x: properties.margin_x, y: properties.margin_y),
numbering: "1",
footer: locate(loc => pager(properties, loc)),
footer-descent: 20%
)
generate_header(properties)
body
}