Inspect locally
Do not run the notebook before reviewing it. Verify the archive, then use KaimonSlate's inactive view, which does not start a worker or evaluate cells.
using DocumenterSlate
verify_slate_bundle("custom_controls.tar.gz")
using KaimonSlate
KaimonSlate.serve_notebook("custom_controls.jl"; inactive = true)
This notebook is arbitrary code. Instantiating its environment may run package build scripts, and live opening may execute cells.
Download source · Checksums · Provenance · Local instructions
Verify after downloading the directory: sha256sum -c SHA256SUMS.
Inspect without starting a worker or executing cells:
using KaimonSlate
KaimonSlate.serve_notebook("custom_controls.jl"; inactive = true)| Artifact | SHA-256 |
|---|---|
Dockerfile | d8a01104d6bb3c487b542fc6e00d94c1ba8ccd0eddce53b19383c89ef8768a13 |
Manifest.toml | f2810a9c1f516c881f51e12fab61cc4585349cfe850622943394aa8a08efc065 |
PROVENANCE.toml | d2a19cd6474994732130ff47264ccf3f1d371749a3fa149d6ca4d1b04425f73b |
Project.toml | 47810962ec0e39b7dd20de00dcef692ba653519f69bb872450bf0eaa67688d07 |
README.md | 38001bf5d549633b958bb41bc53ffbdaa05933574f71deebbff347740a117351 |
custom_controls.jl | 402f8276b9fa2fee6e29f937c757a39d0c16679efd06e3c6e3c7637c4d6ead61 |
custom_controls.tar.gz | 06b4ddcf6ab79d190facfc7d6fc98ccdff120c39a4ecdb005af0dd1639dba870 |
devcontainer.json | 8ce45784a0d2bfa78d7078ae35df6c0431a4e369259eb77939bbfcce1a1cbcf2 |
Custom Controls Playground
Experimenting with Slate widget plugins + the math keyboard
A scratchpad for the slateRegisterWidget extension point: the MathLive math field, and whether GIAC commands can run inside it.
using Giac
using Giac.Commands: expand, factor, simplify, diff, integrate, limit, solve, partfrac
using GiacSlate
using Markdown
@giac_var x
@giac_var y
@giac_var s
@giac_var a
"ready — Giac, GiacSlate, commands loaded; variables x, y, s, a"ready — Giac, GiacSlate, commands loaded; variables x, y, s, aGiac math variables inside markdown
A math variable defined in a code cell can be dropped into prose and typeset — gmath(x) renders it inline, gdisplay(x) as a display block. Put the call inside Slate's double-curly-brace interpolation; it runs through the giac→LaTeX conversion and re-renders when the variable changes. The sentence below is a live example.
Hs = giac"1/(s^2 + 2*s + 5)" # a transfer function
yt = giac"((-(((1)/(10)*sin((2*t))*(exp(1))^((-(t))))))+(-(((1)/(5)*cos((2*t))*(exp(1))^((-(t))))))+(1)/(5))" # its step response
(string(Hs), string(yt))("1/(s^2+2*s+5)", "-1/10*sin(2*t)*exp(-t)-1/5*cos(2*t)*exp(-t)+1/5")The system has transfer function {{ gmath(Hs) }}, a second-order response. Its unit-step response, computed by Giac's inverse Laplace transform, is
{{ gdisplay(yt) }}
which settles to {{ gmath(giac"limit(1/(s^2+2s+5)5, s, 0)/5") }} as $t \to \infty$.
🎯 The real thing — giac"…" live in a code cell
No sandbox. The boot cell below registers an editor extension (via the new slateRegisterEditorExtension hook) + two giac↔LaTeX bridge handlers. After a reload, any giac"…" literal in a real code cell renders as a live math field — and the cell still runs natively (@giac_str). Ctrl/Cmd-M inserts one.
@bind num Slider(1:5)Giac.det(giac"matrix([[x,y,4],[5,6,x],[4,6,1]])")Giac.GiacExpr(Ptr{Nothing}(0x000000000000076d))# After reload, the giac"…" below renders as a live math field — and this cell runs.
H = giac"(x+19)"
ex = expand(1 / H^num)
ex2 = expand((x+num)^3)
ex3=giac"(5+111)" + factor(giac"((x)^(4)+-1)") - Giac.det(giac"matrix([[x,y,4],[5,6,1],[4,6,1]])")
expand(giac"((x+6))^(5)")
@show ex3ex3 = 116+(x-1)*(x+1)*(x^2+1)+y-24
Giac.GiacExpr(Ptr{Nothing}(0x000000000000077f))Here is some inline math ${{ ex }}$ and some display math ${{ ex }}$
and ex2:
{{ex2}}
ex3:
- Bullet
- Math ${{ ex3 }}$