#import "@preview/acrostiche:0.2.0": * #let appendixes = state("appendixes", ()) #let section = state("section", none) #let glossary-terms = state("glossary", ( : )) #let rapport( title: "", author: "Julien Ivars", color: red, company: (), degree: "", promotion: (), glossary: ( : ), hayagriva-bibliography: none, thanks: lorem(150), introduction: lorem(350), conclusion: lorem(350), abstract: lorem(100), keywords: ("Min 7", "Max 15"), body, ) = { // Global settings. set document(author: author, title: title) set page( background: [ #place(top, rect(fill: color, width: 100%, height: 5mm)) #place(bottom, rect(fill: color, width: 100%, height: 10mm)) ] ) set text(hyphenate: false, lang: "fr", weight: "regular") set heading(outlined: false) show heading: h => { set text(color, font: "Open Sans", weight: "medium", style: "italic") set text(21pt) if h.level == 1 set text(17pt) if (h.level == 2) set pad(left: 1cm) if h.level > 1 set pad(bottom: 5mm) set pad(bottom: 3mm) if h.level == 3 pad(h) } // Title page. { set page(margin: (left: 15mm, right: 15mm, top: 15mm, bottom: 25mm)) set text(15pt, font: "Open Sans") block( height: 75pt, grid( columns: 3, column-gutter: 45pt, rows: auto, align(horizon, image("./assets/images/logo-uha.png")), align(horizon, image("./assets/images/logo-uha40.png")), align(horizon, image("./assets/images/logo-serfa.jpg")) ) ) v(3fr) [ #text(30pt, color)[Mémoire de fin d'études] \ #text(40pt, weight: "bold", smallcaps(title)) ] v(3fr) [ #text(18pt, weight: "bold", author) \ \ #degree \ #promotion.title - Promotion #promotion.year / #(promotion.year + 1) \ \ #text(black)[Alternance réalisée chez] #upper[*#company.name*] ] v(2fr) let stageActor(designation: "", tutor) = block[ #text(rgb(111, 111, 111), designation) \ #tutor ] grid( columns: 2, [ #stageActor(designation: "Tuteur professionnel", company.tutor) #stageActor(designation: "Tuteur pédagogique")[M. Mounir ELBAZ] ], align(horizon + right, image(company.logo, width: 65%)) ) } pagebreak() // Used to get custom page header. let pageheader(content: "") = { set text(10pt) grid( columns: 2, gutter: 1fr, title, content ) v(3mm) place(bottom, rect(fill: color, width: 100%, height: 0.05mm)) } // Document-body settings. show par: set block(spacing: 1.45em) set page( header: pageheader(), footer: author, margin: (left: 30mm, right: 30mm, top: 30mm, bottom: 30mm) ) set text(font: "Times New Roman", size: 12pt) set par(justify: true, leading: 0.8em) counter(page).update(1) // Defining, how marked glossary entries in the document appear show figure.where(kind: "jkrb_glossary"): it => [#link()[#it.body]] // Thanks page. [ = Remerciements #thanks ] pagebreak() // Summary. outline(title: "Sommaire", depth: 2, indent: auto) pagebreak() { set heading(outlined: true) set page(footer: grid( columns: 2, gutter: 1fr, author, counter(page).display() ) ) // Introduction page. [ = Introduction #introduction ] pagebreak() // Content. { set heading(numbering: "1.1.") set page(header: locate(loc => { let sectiontitle = section.at(loc) if (sectiontitle == none) { sectiontitle = query( heading.where(level: 1, outlined: true).after(loc), loc ).first().body } pageheader(content: sectiontitle) })) show pagebreak: pb => { section.update(none) pb } show heading.where(level: 1): h => { h section.update(h.body) } body } pagebreak() // Conclusion. [ = Conclusion #conclusion ] pagebreak() // Glossary. [ #set page(header: pageheader(content: "Glossaire")) = Glossaire #for term in glossary.keys().sorted() { locate(loc => glossary-terms.update(it => { it.insert(term, loc) return it })) [ - *#term* : #glossary.at(term) \ ] } ] pagebreak() // Bibliography. bibliography(hayagriva-bibliography, title: "Bibliographie et webographie", style: "chicago-notes") pagebreak() // Table of contents. outline(indent: auto) pagebreak() // Appendixes page. [ #set page(header: pageheader(content: "Annexes")) = Annexes #counter(heading).update(0) #set heading(numbering: "I.", outlined: false, supplement: "Annexe") #locate(loc => { for body in appendixes.final(loc) { body } }) ] } // Last page. [ = Résumé #abstract = Mots-clés #for word in keywords.sorted() [ - #word ] ] } #let appendix(body) = appendixes.update(it => it + (body,)) #let ref-glossary(term: "", body) = locate(loc => link(glossary-terms.final(loc).at(term), body))