#import "@preview/fontawesome:0.5.0": * // ---- Variables ---- // // Identificateurs #let identificateur-titre = [x309QfWkIO] #let identificateur-annexe = [U2pWAy70cU] #let identificateur-sous-titre-annexe = [4rS78a14Pv] // Couleurs #let couleur-rouge = color.red #let couleur-vert = color.rgb(0, 169, 51) #let couleur-bleu = color.rgb(52, 101, 164) #let couleur-bleu-legende = color.rgb(0,69,134) #let couleur-pourpre = color.rgb(166,77,121) // Polices #let fs-base = 12pt #let fs-header = fs-base - 1.5pt #let fs-footer = fs-base - 2pt #let fs-title = fs-base + 6pt #let fs-subtitle = fs-base + 2pt #let fs-title1 = fs-base + 2pt #let fs-title2 = fs-base + 1pt #let fs-title3 = fs-base #let fs-legend = fs-base - 2pt // Longueurs #let tabulation = 0.76cm #let titre-tabulation = 0.50cm #let titre-demi-tabulation = titre-tabulation / 2 #let titre-tabulation-annexe = 0.33cm #let tab-numerotation = 0.2cm #let tab-sommaire = 0.4cm #let espace-vert-titres = 0.15cm #show link: this => { underline(text(this, fill: blue.darken(50%))) } #state("in-comment").update(false) #let setup_comments(body, visible: false) = { if visible { state("in-comment").update(true) set heading( outlined: false, numbering: none ) block(fill: rgb("#ffe39c"), inset: 8pt, radius: 4pt, width:100%, body) state("in-comment").update(false) } } #let citef(key) = { footnote[#cite(key, form: "full")] } #let citen(key) = { cite(key, form: "normal") footnote[#cite(key, form: "full")] } #let citeb(key) = [ #set par(hanging-indent: 1.5em, leading: 0.75em) #cite(key, form: "full") \ ] #let tplib-clement( title: none, // `content?` authors: none, // `array | content?` left_footer: none, // `content?` date: none, // `datetime | content?` font: "New Computer Modern", // `str` show_toc: true, // `bool` break_toc: false, // `bool` break_h1: true, // `bool` tight_h1: false, // `bool` show_comments: true, lang: "fr", doc // content ) = { set text( lang: lang, font: (font,) ) set par( justify: true ) set heading(numbering: (..nums) => { let nums = nums.pos(); let count = nums.len(); for (i, num) in nums.enumerate() { if i == 0{ " " * (count - 1); numbering("I.", num) }else if i == 1{ numbering("1.", num) }else if i == 2{ numbering("a.", num) }else if i == 3{ numbering("a)", num) } } }) state("in-outline").update(false) show outline: it => { state("in-outline").update(true) it if not break_h1 and break_toc { pagebreak() } state("in-outline").update(false) } show heading.where(depth: 1): it => { if it.outlined and not state("in-outline", false).get() { if break_h1 and not state("in-comment", true).get() { pagebreak(weak: true) }else if not tight_h1 { linebreak() } it }else { it } } show link: this => { underline(text(this, fill: blue.darken(50%))) } show footnote.entry: set text(size: fs-footer) show figure.caption: it => { text( fs-legend, [ #let sup = if (it.supplement == [Fig.]) [Figure] else {it.supplement} #context [ #smallcaps(sup) #it.counter.display(). #it.body ] ] ) } show ref: it => { let element = it.element if (element == none or element.func() != figure or element.caption.supplement != [Fig.]){ it return } let number = numbering( element.numbering, ..counter(figure).at(element.location()) ) [#smallcaps[Figure] #number] } set page( paper: "a4", margin: ( left: 2cm, right: 2cm, top: 3cm, bottom: 2.5cm, ), header: [ #set text(size: fs-header) #grid( columns: (auto, 1fr, auto, 1fr, auto), rows: (auto, 5pt), stroke: (x, y) => if y == 1 { (bottom: ( paint: luma(50%), thickness: 1pt )) }, [ #set image(height: 0.8cm) #align(left + horizon)[ #image("res/logo-insa-lyon.png") ] ], [], align(center + horizon)[ #title ], [], // Authors if authors != none { let row_count = calc.min(authors.len(), 3) let column_count = calc.ceil(authors.len() / row_count) authors = authors.sorted(key: it => it.at(1)) align(right + horizon)[ #grid( columns: (auto,) * column_count, rows: (auto,) * row_count, column-gutter: 3pt, row-gutter: 3pt, ..authors.enumerate() .map(data => { let i = data.at(0); let author = data.at(1); let last_i = i == authors.len() - 1; grid.cell( colspan: if last_i {column_count * row_count - authors.len() + 1} else {1}, { if authors.len() > 3 { [#smallcaps(author.at(1)) ] }else{ [#author.at(0) #smallcaps(author.at(1)) ] } } ) } ) ) ] } ) ], // Header footer: [ #set text(size: fs-footer) #grid( columns: (1fr, 1fr, 1fr), align(left)[#left_footer], align(center)[ #context [ #counter(page).display( "– 1/1 –", both: true, ) ] ], align(right)[#date], ) ], // Footer ) // Page // Heading set text(size: fs-title) align(center)[#title] set text(size: fs-subtitle) let column_count = calc.min(authors.len(), 3) let row_count = calc.ceil(authors.len() / column_count) authors = authors.sorted(key: it => it.at(1)) grid( columns: (1fr,) * column_count, rows: (auto,) * row_count, row-gutter: 12pt, ..authors.enumerate().map(data => { let i = data.at(0); let author = data.at(1); let last_i = i == authors.len() - 1; grid.cell( colspan: if last_i {column_count * row_count - authors.len() + 1} else {1}, align(center)[#author.at(0) #smallcaps(author.at(1))] ) } ) ) align(center)[ #date #if left_footer != none { [ \-- #left_footer] } ] set text(size: fs-base) if show_toc { outline() } /*show: codly-init.with() let code-icon(fa-name) = { box( inset: (right: 3pt), height: 0.8em, baseline: 0.05em, fa-icon(fa-name) ) h(0.1em) } codly( number-align: top + right, zebra-fill: luma(250), fill: luma(250), languages: ( rust: (name: "Rust", icon: code-icon("rust"), color: rgb("#CE412B")), sql: (name: "SQL", icon: code-icon("database"), color: luma(180)), ) )*/ state("in-comment").update(false) doc }