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

Precision of one variable

use scientific or engineering notation

Scientific notation, engineering notation

hide floating-point noise like 5.55e-17

Snap noise to zero

drop trailing zeros, add thousands separators

Trailing zeros, separators

Showing and hiding

show only the result of a line

Results only

show only formulas, or only results

Formulas or results for a section

hide a line, or the imports

Hide a line, hide imports

break a long equation

Long equations

render one line of a notebook cell

%render

lay out inputs in a grid

Inputs in a grid

Checks

mark a check with ✓ or ✗

Pass/fail marks

state pass or fail in words

Verdict in a comment

show only the governing case

Governing branch

check several load cases

Several cases at once

Notation

write Npl,Rd, ΔH, γM0

Subscripts, Greek letters

give a variable any symbol

Any symbol for any name

stop psi becoming ψ, or turn off subscripts

Keep a name as text, no subscripts

use Σ, ×, ∛, n! or my own function names

Functions, operators, cube roots and factorials

Units

calculate with forallpeople or pint

Units

show a result in particular units

Specific units

Reports

make a PDF, Word or HTML document

Write to a file, Word

number equations, add a title block

Equation numbers, title block

start a new page

Page breaks

change colors or alignment

Colors, alignment

Apps

render from a script, or a function

Scripts, functions

run one calculation for many designs

Many designs

show calculations in a web or desktop app

Web apps, desktop apps

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.