Handwritten notebook style template for Polylux

Add post-it feature and randomize framed blocks

+118 -26
+1 -1
jotter.typ
··· 1 - #import "lib.typ": setup, title-slide, fancy-block 1 + #import "lib.typ": setup, title-slide, framed-block, post-it
+75 -7
lib.typ
··· 1 1 #import "@preview/polylux:0.4.0": * 2 + #import "@preview/suiji:0.4.0" 3 + #import "@preview/umbra:0.1.1" 2 4 3 5 #let highlight-color-state = state("jotter-highlight-color", red) 4 6 ··· 118 120 let hc = highlight-color-state.get() 119 121 place(center, c(hc.transparentize(20%))) 120 122 place(center, dx: .1em, dy: .1em, c(hc.transparentize(50%))) 121 - v(1.5em) 122 123 } 123 124 } 125 + par(hide[42]) 124 126 125 127 extra 126 128 }) 127 129 128 - #let fancy-block(body, sloppiness: .05, ..kwargs) = layout(sz => { 129 - let blocked-body = block(..kwargs, stroke: none, body) 130 + #let len2int(l) = int.from-bytes(l.pt().to-bytes()) 131 + #let hasher(acc, val) = acc.bit-xor(val) 132 + 133 + #let framed-block( 134 + body, 135 + sloppiness: .05, 136 + inset: .5em, 137 + width: auto, 138 + height: auto, 139 + ) = layout(sz => { 140 + let blocked-body = block( 141 + inset: inset, 142 + width: width, 143 + height: height, 144 + fill: none, 145 + stroke: none, 146 + body, 147 + ) 130 148 let (width: w, height: h) = measure(..sz, blocked-body) 131 149 let deflect = sloppiness * (w + h) / 2 150 + 151 + let pos = here().position() 152 + let hash-components = ( 153 + pos.page, 154 + len2int(pos.x), 155 + len2int(pos.y), 156 + len2int(w), 157 + len2int(h), 158 + ) 159 + let hash = hash-components.reduce(hasher) 160 + let rng = suiji.gen-rng-f(hash) 161 + let (rng, c1) = suiji.random-f(rng) 162 + let (rng, c2) = suiji.random-f(rng) 163 + let (rng, c3) = suiji.random-f(rng) 164 + let (rng, c4) = suiji.random-f(rng) 165 + let (rng, s1) = suiji.choice-f(rng, (-1, 1)) 166 + let (rng, s2) = suiji.choice-f(rng, (-1, 1)) 167 + let (rng, s3) = suiji.choice-f(rng, (-1, 1)) 168 + let (rng, s4) = suiji.choice-f(rng, (-1, 1)) 169 + 132 170 let c(p) = curve( 133 171 stroke: stroke(thickness: .1em, cap: "round", paint: p), 134 172 curve.move((0pt, 0pt)), 135 - curve.quad((.8 * w, deflect), (w + deflect / 3, 0pt)), 173 + curve.quad((c1 * w, s1 * deflect), (w + deflect / 3, 0pt)), 136 174 curve.move((w - deflect / 3, -deflect / 3)), 137 - curve.quad((w - deflect, .5 * h), (w - deflect / 3, h + deflect / 3)), 175 + curve.quad((w + s2 * deflect, c2 * h), (w - deflect / 3, h + deflect / 3)), 138 176 curve.move((w + deflect / 3, h - deflect / 3)), 139 - curve.quad((.3 * w, h + deflect), (0pt, h)), 140 - curve.quad((deflect, .4 * h), (0pt, 0pt)), 177 + curve.quad((c3 * w, h + s3 * deflect), (0pt, h)), 178 + curve.quad((s4 * deflect, c4 * h), (0pt, 0pt)), 141 179 ) 142 180 place(dx: .2em, dy: .15em, c(text.fill.transparentize(50%))) 143 181 place(c(text.fill.transparentize(20%))) 144 182 blocked-body 145 183 }) 184 + 185 + #let post-it(body, fill: rgb("#FDE85F"), angle: -10deg) = rotate( 186 + angle, 187 + reflow: true, 188 + { 189 + place( 190 + dx: .0em, 191 + dy: .0em, 192 + umbra.shadow-path( 193 + (1cm, 1cm), 194 + (1cm, 5cm), 195 + (5cm, 5cm), 196 + (5cm, 4.9cm), 197 + (4cm, 1cm), 198 + correction: 10deg, 199 + closed: false, 200 + ), 201 + ) 202 + place( 203 + curve( 204 + fill: fill, 205 + curve.line((5cm, 0cm)), 206 + curve.quad((5cm, 2.5cm), (5.2cm, 5cm)), 207 + curve.quad((2.5cm, 5.2cm), (.1cm, 5cm)), 208 + curve.quad((0cm, 2.5cm), (0cm, 0cm)), 209 + ), 210 + ) 211 + box(inset: .5em, width: 5cm, height: 5cm, clip: true, body) 212 + }, 213 + )
+42 -18
template/slides.typ
··· 1 1 #import "@preview/polylux:0.4.0": * 2 - #import "@preview/jotter-polylux:0.1.0": setup, title-slide, fancy-block 2 + #import "@preview/jotter-polylux:0.1.0": ( 3 + setup, 4 + title-slide, 5 + framed-block, 6 + post-it, 7 + ) 3 8 4 9 #set text( 5 10 size: 25pt, ··· 19 24 The speaker 20 25 21 26 Date, Place 27 + 28 + #place( 29 + horizon + right, 30 + post-it[ 31 + #set align(horizon + left) 32 + #set text(size: .6em) 33 + Don't miss this talk! 34 + ], 35 + ) 22 36 ] 23 37 24 38 #slide[ 25 - = Title of this slide 39 + = Typography 26 40 27 - The content of this slide. 41 + #toolbox.side-by-side[ 42 + Style your content beautifully! 28 43 29 - Some text is *bold*, some text is _emphasized_. 44 + Some text is *bold*, some text is _emphasized_. 45 + ][ 46 + - a bullet point 47 + - another bullet point 30 48 31 - #fancy-block(inset: 1em, sloppiness: .05)[ 32 - A very important formula: 33 - 34 - $ 35 - hat(mu) = 1 / n sum_(i = 1)^n x_i 36 - $ 49 + + first point 50 + + second point 37 51 ] 38 52 ] 39 53 40 54 #slide[ 41 - = Another slide 55 + = Maths and Code 42 56 43 57 #toolbox.side-by-side[ 44 58 Maxwell says: ··· 46 60 integral.surf_(partial Omega) bold(B) dot dif bold(S) = 0 47 61 $ 48 62 ][ 49 - 50 - - a bullet point 51 - - another bullet point 52 - 53 - + first point 54 - + second point 55 - 56 63 Compute the answer: 57 64 ```rust 58 65 pub fn main() { ··· 62 69 ] 63 70 ] 64 71 72 + #slide[ 73 + = Highlighting content 74 + 75 + #toolbox.side-by-side[ 76 + #grid( 77 + columns: 2, 78 + gutter: 1em, 79 + framed-block[a], framed-block[couple], 80 + framed-block[of], framed-block[randomized], 81 + framed-block[framed], framed-block[boxes], 82 + ) 83 + ][ 84 + #box(post-it[a post-it]) 85 + #box(post-it[another post-it]) 86 + ] 87 + ] 88 +
thumbnail.png

This is a binary file and will not be displayed.