Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions report/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Define variables at the top of the template :
#let date-start = datetime(year: 2024, month: 06, day: 05)
#let date-end = datetime(year: 2024, month: 09, day: 05)
#let despair-mode = false
#let first-line-indent-all = auto

#set text(lang: "fr")
```
Expand Down
Binary file modified report/guide.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion report/guide.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "@preview/typographix-polytechnique-reports:0.2.0" as template
#import "@preview/typographix-polytechnique-reports:0.2.1" as template

#show: template.apply

Expand Down
76 changes: 36 additions & 40 deletions report/main.typ
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
)

// Applying margins and other page-related setup
#let apply-page(doc, despair-mode: false) = {
#let apply-page(doc, despair-mode: false, first-line-indent-all: auto) = context {
set page(paper: "a4", margin: if (despair-mode) { margin-despair-mode } else { margin-default })
set par(justify: true, first-line-indent: (amount: 20pt, all: true))

let first-line-indent-all = if first-line-indent-all == auto {
if text.lang == "fr" { true } else { false }
} else { first-line-indent-all }
set par(justify: true, first-line-indent: (amount: 20pt, all: first-line-indent-all))

doc
}
Expand Down Expand Up @@ -177,12 +181,15 @@

#let apply-heading(doc) = {
// Numbering parameters
set heading(numbering: "1.1 - ")
set heading(numbering: "1.1 ")

// For some reason, `below: auto` need to be reinserted explicitely for blocks for H1, H2, H3
// otherwise spacing below is not inserted although `below: auto` is supposedly the default already

// H1 styling
show heading.where(level: 1): he => {
set align(center)
box(width: 85%)[#{
block(width: 85%, below: auto, {
set par(justify: false)
set text(
size: 20pt,
Expand All @@ -195,55 +202,44 @@
counter(heading).display(he.numbering.slice(0, -3))
linebreak()
} else if he.numbering != none {
upper((he.numbering)(he.level).slice(0, -2))
upper((he.numbering)(he.level).slice(0, -1))
linebreak()
}
upper(he.body)
image("assets/filet-long.svg", width: 30%)
v(0.5em)
}]
})
}

// H2 styling
show heading.where(level: 2): he => {
box()[#{
set text(
size: 20pt,
weight: "medium",
fill: rgb("00677F"),
)
smallcaps(he)
v(-0.5em)
image("assets/filet-court.svg")
}]
block(below: auto, text(
size: 20pt,
weight: "medium",
fill: rgb("00677F"),
{
smallcaps(he)
v(-0.5em)
image("assets/filet-court.svg")
},
))
}

// H3 styling
show heading.where(level: 3): he => {
set text(
block(below: auto, text(
size: 16pt,
weight: "regular",
fill: rgb("01426A"),
)
if type(he.numbering) == str {
counter(heading).display(he.numbering.slice(0, -3))
[ • ]
}

smallcaps(he.body)
}

// H4 styling
show heading.where(level: 4): he => {
counter(heading).display(he.numbering)
he.body
}

// Quick fix for paragraph indentation...
// Any superior entity who might be reading, please forgive me
show heading: he => {
set par(first-line-indent: 0pt)
he
{
if he.numbering != none {
counter(heading).display(he.numbering).slice(0, -1)
[ • ]
}

smallcaps(he.body)
},
))
}

// Don't forget to return doc cause
Expand All @@ -261,7 +257,7 @@
if vals.len() == 1 {
s += title + " "
}
s += numbering("A.1 -", ..vals)
s += numbering("A.1 ", ..vals)
s
},
)
Expand Down Expand Up @@ -293,8 +289,8 @@
/* MAIN */
/********/

#let apply(doc, despair-mode: false) = {
show: apply-page.with(despair-mode: despair-mode)
#let apply(doc, despair-mode: false, first-line-indent-all: auto) = {
show: apply-page.with(despair-mode: despair-mode, first-line-indent-all: first-line-indent-all)
show: apply-heading
show: apply-outline
doc
Expand Down
5 changes: 3 additions & 2 deletions report/template/report.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "@preview/typographix-polytechnique-reports:0.2.0" as template
#import "@preview/typographix-polytechnique-reports:0.2.1" as template

// Defining variables for the cover page and PDF metadata
// Main title on cover page
Expand All @@ -16,12 +16,13 @@
#let date-end = datetime(year: 2024, month: 09, day: 05)
// Set to true for bigger margins and so on (good luck with your report)
#let despair-mode = false
#let first-line-indent-all = auto

#set text(lang: "fr")

// Set document metadata
#set document(title: title, author: author, date: datetime.today())
#show: template.apply.with(despair-mode: despair-mode)
#show: template.apply.with(despair-mode: despair-mode, first-line-indent-all: first-line-indent-all)

// Cover page
#template.cover(
Expand Down
2 changes: 1 addition & 1 deletion report/typst.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "typographix-polytechnique-reports"
version = "0.2.0"
version = "0.2.1"
entrypoint = "main.typ"
authors = ["Rémi Germe <@remigerme>"]
license = "MIT"
Expand Down
Loading