// template_serie_math.typ // Modèle officiel pour les séries de mathématiques — P.P.É.C.E. Heykel ZAYANI // Support dynamique des thèmes graphiques (classique, sobre, etc.) #let lim = math.limits(math.lim) #let serie_document( titre: "LIMITES ET CONTINUITÉ", sous_titre: "Continuité • TVI • Fonctions par morceaux", discipline: "Mathématiques", classe: "4ème Mathématiques & Sciences", enseignant: "Heykel ZAYANI", annee: "2026 / 2027", lycee: "Lycée Pilote", titre_enseignant: "P.P.É.C.E.", type_doc: "SÉRIE D'EXERCICES", color_primary: rgb("#0f2c59"), color_secondary: rgb("#1e40af"), color_accent: rgb("#93c5fd"), color_bg_subtle: rgb("#f8fafc"), color_border: rgb("#cbd5e1"), font_main: "New Computer Modern", body, ) = { set document(title: type_doc + " : " + titre + " - " + enseignant, author: enseignant) set page( paper: "a4", margin: (top: 1.2cm, bottom: 1.2cm, left: 1.3cm, right: 1.3cm), header: context { let p = counter(page).get().first() if p > 1 { grid( columns: (1.65fr, 1fr), align: (left, right), text(size: 8pt, fill: rgb("#475569"))[ #strong[#discipline] — #type_doc : #titre ], text(size: 8pt, fill: rgb("#475569"))[ #titre_enseignant #strong[#enseignant] | #annee ] ) v(-4pt) line(length: 100%, stroke: 0.4pt + color_border) } }, footer: context { line(length: 100%, stroke: 0.4pt + color_border) v(1pt) let p = counter(page).get().first() let total = counter(page).final().first() grid( columns: (1fr, auto, 1fr), align: (left, center, right), text(size: 7.5pt, fill: rgb("#64748b"))[ #text(fill: color_secondary, weight: "bold")[#lycee] — #classe ], text(size: 7.5pt, fill: rgb("#64748b"))[ Année Scolaire : #annee ], text(size: 8pt, fill: color_secondary, weight: "bold")[ Page #p sur #total ] ) } ) set text( font: font_main, size: 9.8pt, fill: rgb("#0f172a"), lang: "fr" ) set par(justify: true, leading: 0.62em) // Cartouche d'en-tête officiel block( width: 100%, stroke: (bottom: 1.5pt + color_primary), inset: (bottom: 5pt), [ #grid( columns: (1.3fr, 2fr, 1.3fr), align: (left + horizon, center + horizon, right + horizon), [ #text(size: 8.5pt, weight: "bold", fill: color_primary)[RÉPUBLIQUE TUNISIENNE]\ #text(size: 7.5pt, fill: rgb("#475569"))[MINISTÈRE DE L'ÉDUCATION]\ #v(1pt) #text(size: 8.5pt, weight: "bold", fill: color_secondary)[#classe]\ #text(size: 7.5pt, fill: rgb("#64748b"))[Discipline : #discipline] ], [ #rect( fill: color_bg_subtle, stroke: 1pt + color_primary, radius: 6pt, inset: (x: 10pt, y: 4.5pt), [ #text(size: 11pt, weight: "bold", fill: color_primary)[ #type_doc ]\ #v(1pt) #text(size: 13pt, weight: "bold", fill: color_secondary)[ #titre ]\ #if sous_titre != "" [ #v(1pt) #text(size: 7.5pt, style: "italic", fill: rgb("#475569"))[ #sous_titre ] ] ] ) ], [ #align(right)[ #text(size: 8pt, fill: rgb("#64748b"))[Année Scolaire : ] #text(size: 8.5pt, weight: "bold", fill: color_primary)[#annee]\ #v(2pt) #text(size: 8pt, fill: rgb("#64748b"))[#titre_enseignant : ]\ #text(size: 9.5pt, weight: "bold", fill: color_secondary)[#enseignant] ] ] ) ] ) body } // Fonction pour générer une boîte d'exercice #let exercice( numero, titre: none, points: none, breakable_box: false, color_primary: rgb("#0f2c59"), color_secondary: rgb("#1e40af"), color_accent: rgb("#93c5fd"), color_border: rgb("#cbd5e1"), theme_name: "classique", body ) = { v(6pt) if theme_name == "encre" [ #rect(width: 100%, height: 7pt, fill: rgb("#1f2937"), radius: (top: 3pt, bottom: 0pt)) #v(-7pt) ] block( width: 100%, stroke: 0.8pt + color_border, radius: 5pt, clip: true, fill: rgb("#ffffff"), breakable: breakable_box, [ #if theme_name == "sobre" [ #block( fill: rgb("#f8fafc"), stroke: (bottom: 1pt + color_border), width: 100%, inset: (x: 10pt, y: 5.5pt), grid( columns: (1fr, auto), align: (left + horizon, right + horizon), [ #text(fill: color_primary, weight: "bold", size: 10.5pt)[ EXERCICE #numero ] #if titre != none [ #h(6pt) #text(fill: color_secondary, size: 8.8pt, style: "italic")[ — #titre ] ] ], [ #if points != none [ #rect( fill: color_secondary, radius: 3pt, inset: (x: 5pt, y: 2pt), text(fill: white, weight: "bold", size: 8pt)[#points] ) ] ] ) ) ] else if theme_name == "encre" [ #block( fill: rgb("#f3f4f6"), stroke: (bottom: 1.5pt + rgb("#1f2937")), width: 100%, inset: (x: 10pt, y: 5.5pt), grid( columns: (1fr, auto), align: (left + horizon, right + horizon), [ #text(fill: rgb("#111827"), weight: "bold", size: 10.5pt)[ EXERCICE #numero ] #if titre != none [ #h(6pt) #text(fill: rgb("#374151"), size: 8.8pt, style: "italic")[ — #titre ] ] ], [ #if points != none [ #rect( fill: rgb("#374151"), radius: 3pt, inset: (x: 5pt, y: 2pt), text(fill: white, weight: "bold", size: 8pt)[#points] ) ] ] ) ) ] else [ #block( fill: color_primary, width: 100%, inset: (x: 10pt, y: 5.5pt), grid( columns: (1fr, auto), align: (left + horizon, right + horizon), [ #text(fill: white, weight: "bold", size: 10.5pt)[ EXERCICE #numero ] #if titre != none [ #h(6pt) #text(fill: color_accent, size: 8.8pt, style: "italic")[ — #titre ] ] ], [ #if points != none [ #rect( fill: color_secondary, radius: 3pt, inset: (x: 5pt, y: 2pt), text(fill: white, weight: "bold", size: 8pt)[#points] ) ] ] ) ) ] #block( width: 100%, inset: (x: 12pt, top: 7pt, bottom: 8pt), body ) ] ) }