diff --git a/doc/style.typ b/doc/style.typ index 21de664..ff37880 100644 --- a/doc/style.typ +++ b/doc/style.typ @@ -1,14 +1,14 @@ #import "/src/lib.typ" #import "@preview/tidy:0.4.3" -#import "@preview/t4t:0.3.2": is +#import "@preview/t4t:0.3.2": is as is_ #let show-function(fn, style-args) = { [ #heading(fn.name, level: style-args.first-heading-level + 1) #label(style-args.label-prefix + fn.name + "()") ] - let description = if is.sequence(fn.description) { + let description = if is_.sequence(fn.description) { fn.description.children } else { (fn.description,) diff --git a/gallery/normal-dist.png b/gallery/normal-dist.png new file mode 100644 index 0000000..87b2406 Binary files /dev/null and b/gallery/normal-dist.png differ diff --git a/gallery/normal-dist.typ b/gallery/normal-dist.typ new file mode 100644 index 0000000..14c2a40 --- /dev/null +++ b/gallery/normal-dist.typ @@ -0,0 +1,58 @@ +#import "@preview/cetz:0.5.2": canvas, draw +#import "@preview/cetz-plot:0.1.4": plot + +#set page(width: auto, height: auto, margin: .5cm) + +#let style = (stroke: black, fill: rgb(0, 0, 200, 75)) + +#let f(x, rho: .4, sigma: 0) = 1 / calc.sqrt(2 * calc.pi * rho * rho) * calc.exp(-calc.pow(x - sigma, 2)/(2 * rho * rho)) + +#set text(size: 10pt, fill: white) + +#canvas(background: gray.darken(80%), { + import draw: * + + set-style( + axes: ( + stroke: 1pt + white, + tick: (stroke: 1pt + white), + fill: gray.darken(60%), + minor-tick: (stroke: white), + grid: (stroke: (thickness: .5pt, paint: white, dash: "dotted")), + ), + legend: ( + fill: black.transparentize(60%), + stroke: none, + padding: .3cm, + offset: (-.1, -.1) + ) + ) + + let x-format = x => { + if x > 0 { $mu + #{x}sigma$ } + else if x < 0 { $mu - #{calc.abs(x)}sigma$ } + else { $mu$ } + } + + plot.plot(size: (12, 8), + x-tick-step: 1, + y-tick-step: 1, + x-format: x-format, + y-max: 1.1, + y-min: -.1, + x-grid: true, + y-grid: true, + x-label: none, + y-label: none, + legend: "inner-north-east", + { + plot.add(f, domain: (-3, +3), + style: (stroke: green), + label: $y = 1/sqrt(2 pi sigma^2) exp(-(x - mu)^2/(2 sigma^2)) $, + samples: 200, + ) + }) + + // Add some padding + rect((-1, -1), (13, 9)) +}) diff --git a/manual.pdf b/manual.pdf index bfdba96..08cf6d6 100644 Binary files a/manual.pdf and b/manual.pdf differ