Initial commit

This commit is contained in:
Lyes Saadi 2026-01-15 17:26:07 +01:00
commit 940f1f64b2
Signed by: lyes
GPG key ID: 55A1D803917CF39A
10 changed files with 406 additions and 0 deletions

80
paper.typ Normal file
View file

@ -0,0 +1,80 @@
#import "palette.typ": *
#import "environment.typ": *
#import "math.typ": math_shorthands
#import "@preview/quick-maths:0.2.1": shorthands
#let header(title, author, scheme, margin) = (
context {
let p = here().page()
// if p >= 1 {
move(dx: - margin - 1pt, block(
width: 100% + 2*margin + 2pt,
height: margin,
stroke: scheme.title.stroke,
fill: scheme.title.bg,
)[
#place(top + left, block(inset: 30% * margin)[#text(title, scheme.title.fg) #text("- " + author, scheme.title.sub)])
#place(top + right, block(inset: 30% * margin, text(scheme.title.fg)[Page #p / #counter(page).final().at(0)]))
])
// }
}
)
#let paper(
body,
title: "Titre",
subtitle: none,
author: "Lyes Saadi",
scheme: light,
margin: 2.5cm,
) = [
#set document(title: title, author: author)
#set page(fill: scheme.bg, footer: header(title, author, scheme, margin), margin: margin)
#set text(fill: scheme.fg, font: "New Computer Modern")
#set table(stroke: scheme.fg)
#set heading(numbering: "I.1 -")
#show heading: it => [
#block[
#place(text("#", size: 0.8em), dx: -0.8em)
#it
]
]
#show heading.where(level: 1): it => [
#move(block(
text(it, scheme.title.fg),
width: 100% + 2*margin,
inset: (left: margin, right: margin, top: 1em, bottom: 1em),
fill: scheme.title.bg,
stroke: (top: scheme.title.stroke, bottom: scheme.title.stroke),
), dx: -margin)
]
#show <nonumber>: set heading(numbering: none)
#show: shorthands.with(..math_shorthands)
#move(block(
[
#if "img" in scheme.title.keys() and scheme.title.img != none {
place(top + right, image(scheme.title.img.path, height: margin), dx: margin, dy: -margin)
}
#align(center, text(size: 3em, title, fill: scheme.title.fg))
#align(center, text(size: 2em, fill: scheme.title.sub, subtitle))
#align(center, text(size: 1.5em, fill: scheme.title.sub, author))
],
fill: scheme.title.bg,
inset: margin,
height: auto,
width: 100% + 2 * margin,
stroke: (bottom: scheme.title.stroke),
), dx: -margin, dy: -margin)
#body
]
#let abstract(body, name: [Abstract.], margin: 2.5cm) = {
align(center, move(dy: -margin/2, block(width: 75%, par(justify: true)[#text(name, weight: "bold") #text(style: "italic", body)])))
}