From 5326ead19d847f47fefe272497a04e4c97064051 Mon Sep 17 00:00:00 2001 From: BestUsernameEver Date: Sat, 13 Jan 2024 23:00:03 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Implemented=20border=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/linear/linear.typ | 71 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/themes/linear/linear.typ b/themes/linear/linear.typ index 6aa366a..a2d76ba 100644 --- a/themes/linear/linear.typ +++ b/themes/linear/linear.typ @@ -9,6 +9,46 @@ *Linear Cover* ] +#let border(x, y) = { + set line(stroke: 1.5pt) + let borderTL = 0% + 30% + let borderTR = 100% - 30% + place( + // Left border line + line(start: (0% + x, 5%), end: (0% + x, 90%)) + ) + place( + // Right border line + line(start: (100% - x, 5%), end: (100% - x, 90%)) + ) + place( + // Bottom border line + line(start: (0% + x, 100% - y), end: (100% - x, 100% - y)) + ) + place( + // Top left border line -> —— + line(start: (0% + x, 5%), end: (borderTL + x, 5%)) + ) + place( + // Top right border line -> —— + line(start: (100% - x, 5%), end: (borderTR - x, 5%)) + ) + place( + // Top left border line -> ︱ + line(start: (borderTL + x, 4%), end: (borderTL + x, 6%)) + ) + place( + // Top left border line -> ︱ + line(start: (borderTR - x, 4%), end: (borderTR - x, 6%)) + ) +} + +#let heading(context: (:)) = { + box(inset: 0.5em, fill: red)[context] + h(5pt) + box(baseline: -10pt, width: 1fr, line(length: 100%)) +} + #let toc() = { utils.print_toc(context => [ #context.title @@ -24,23 +64,40 @@ } #let frontmatter_entry(context: (:), body) = { - show: page.with(header: [ = Frontmatter header ], footer: [Frontmatter footer]) - + show: page.with( + header: [ + #set align(center) + = Frontmatter header + ], + footer: [ Frontmatter footer ], + background: border(5%, 10%) + ) body } #let body_entry(context: (:), body) = { - show: page.with(header: [ = Body header ], footer: [Body footer]) - + show: page.with( + header: [ + #set align(center) + = Body header + ], + footer: [ Body footer ], + background: border(5%, 10%) + ) body } #let appendix_entry(context: (:), body) = { - show: page.with(header: [ = Appendix header ], footer: [Appendix footer]) - + show: page.with(header: [ + #set align(center) + = Appendix header + ], + footer: [ Appendix footer ], + background: border(5%, 10%) + ) body } -#let default_theme = ( +#let linear_theme = ( // Global show rules rules: rules, cover: cover, // Entry pages