#let signature(at: none, date: none, ..signatories) = { let answer = [ _Fait à_ ] if at == none { answer += box(width: 30%, stroke: (bottom: (thickness: 0.5pt, dash: "dotted")), none) } else { answer += text(weight: "bold", at) } answer += [, _le_ ] if date == none { answer += box(width: 30%, stroke: (bottom: (thickness: 0.5pt, dash: "dotted")), none) } else { answer += text(weight: "bold", date.display("[day]/[month]/[year]")) } let names-grid-construction(s) = text(weight: "bold", s.at(0)) + "\n" + text(style: "italic", s.at(1)) let sign-grid-construction(s) = if (s.len() >= 3) { align(left, pad(5pt, s.at(2))) } else { [] } let n = signatories.pos().map(names-grid-construction) let s = signatories.pos().map(sign-grid-construction) answer += grid(columns: (50%, 50%), rows: (auto, 70pt), ..n, ..s) block(answer, breakable: false) } #let template(body, title: "Title", subtitle: "Subtitle", logo: none, watermark: "", size: 10pt) = { // Document appearence set document(title: title + " ‑ " + subtitle) set page(columns: 2, margin: 1.5cm, numbering: "1/1") set page(background: rotate(-55deg, text(size: 50pt, rgb(0, 0, 0, 30))[*#watermark*])) set text(font: "New Computer Modern", lang: "fr", size: size) set par(justify: true, first-line-indent: (amount: 1em, all: true)) set list(marker: sym.bar.h) set enum(numbering: "(i)") show link: l => [#text(underline(l), fill: color.blue)] // Style des titres let premier(.., last, format: "I") = numbering(format, last) + if last == 1 { super[er] } set heading(numbering: "I.1.I.", supplement: []) show heading.where(level: 1): it => [ #align(center, block[ #if it.numbering != none [ Titre #context counter(heading).display(premier.with(format: "I")) ] #text(size: 0.9em, it.body) #line(length: 3cm) #v(1em) ]) ] let articlecounter = counter("article") show heading.where(level: 2): it => { articlecounter.step() align(center, block[ Article #context articlecounter.display(premier.with(format: "1")) #sym.bar.h #text(size: 0.9em, style: "italic", it.body) ]) } show heading.where(level: 3): it => [ #context counter(heading).display(premier.with(format: "I")) #sym.bar.h #if it.body != [] { text(size: 0.9em, style: "italic", [#it.body.]) } ] show ref: it => { let el = it.element let article = articlecounter.at(el.location()).at(0, default: none) let par = counter(heading).at(el.location()).at(2, default: none) if el != none and el.func() == heading and article != none { // Override heading references. if (par == none) { link(el.location(), numbering( "1", article + 1, )) } else { link(el.location(), numbering( "1.I", article, par )) } } else { // Other references as usual. it } } // Start of the document place( top + center, scope: "parent", float: true, align(center)[ #if logo != none { if type(logo) == str { image(logo, alt: "Logo", height: 5em) } else if type(logo) == content { logo } else { panic("logo is not of type str or content") } } #text(size: 2.5em, weight: "extrabold")[#title] #text(size: 1.5em)[#subtitle] #v(1cm) ], ) body }