Cookbook#
Complete recipes for things people ask handcalcs to do. Each one is a short, working example; most show the rendered output, produced when these docs were built. The GitHub issue that asked for it is linked where there is one.
Find a recipe#
I want to… |
Recipe |
|---|---|
Numbers |
|
set the precision of one variable |
|
use scientific or engineering notation |
|
hide floating-point noise like |
|
drop trailing zeros, add thousands separators |
|
Showing and hiding |
|
show only the result of a line |
|
show only formulas, or only results |
|
hide a line, or the imports |
|
break a long equation |
|
render one line of a notebook cell |
|
lay out inputs in a grid |
|
Checks |
|
mark a check with ✓ or ✗ |
|
state pass or fail in words |
|
show only the governing case |
|
check several load cases |
|
Notation |
|
write Npl,Rd, ΔH, γM0 |
|
give a variable any symbol |
|
stop |
|
use Σ, ×, ∛, n! or my own function names |
|
Units |
|
calculate with forallpeople or pint |
|
show a result in particular units |
|
Reports |
|
make a PDF, Word or HTML document |
|
number equations, add a title block |
|
start a new page |
|
change colors or alignment |
|
Apps |
|
render from a script, or a function |
|
run one calculation for many designs |
|
show calculations in a web or desktop app |
How the recipes work#
Most recipes need nothing but a comment command
or a setting. The rest subclass a built-in
renderer and change a class attribute or register a rule, the three levers described in
Customizing a renderer. A recipe written for the Markdown
renderer works on the LaTeX renderer too: register the same function on a
LatexRenderer subclass.
To use a recipe’s renderer in Jupyter, import the module that defines it and select it by
name, for example %hc_default_renderer eng_markdown.