| typstFunctions | R Documentation |
A named list of Typst utility function definitions, stored as R character strings, for use by 'typst.*' print/render methods in place of requiring users to install a local Typst package (such as 'htypstmisc'). Each element is emitted once per document via 'typstAsis(typstFunctions$name)' before any calls to that function are emitted, the same way ‘htypstmisc'’s 'spikehist()' was compile-tested.
typstFunctions
A named list of character strings, each a complete Typst '#let' function definition.
Usage from a 'typst.*' method: “' typstAsis(typstFunctions$spikehist) # define, once per document typstAsis(paste0("#spikehist((", paste(heights, collapse=", "), "))")) “'
Current elements:
Spike histogram, the Typst analog of the LaTeX 'picture' environment used by 'latex.describe.single'. Takes 'heights', an array of non-negative numbers (one per bin; zero height is legal and draws nothing, since 'describe()' output routinely has sparse bins at the tails of a distribution), plus 'width', 'height', and 'stroke-width' controlling the bounding box and spike thickness. 'baseline-shift' defaults to 'auto', resolved inside the function body to '-height' – confirmed by compile error that Typst does not allow a parameter default to reference a sibling parameter directly, hence the 'auto'-sentinel-plus-body- resolution pattern rather than 'baseline-shift: -height' written directly into the parameter list. This seats the spikes on the baseline of the current text line when placed inline next to running text, confirmed by compile-testing, and is the intended use in 'typst.describe.single'.
Places 'body' at position '(x, y)' with left/center/right justification via ‘justify', using Typst’s 'measure()' to size the placement before positioning it.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.