Add %%render to a Jupyter notebook cell to automatically display engineering calculations as formatted step-by-step equations without writing LaTeX by hand.
Apply the @handcalc() decorator to a Python function to show readable calculation output inside a Streamlit web app.
Export a completed calculation notebook as a PDF for engineering documentation or client sign-off.
Use %%tex to convert a Python math expression to raw LaTeX and paste it directly into a technical report.
PDF export requires a LaTeX environment such as TeX Live or MiKTeX installed on the system.
Handcalcs is a Python library that takes mathematical calculations written in Jupyter notebooks and displays them the way a person would write them by hand: first the symbolic formula, then the numbers substituted in, then the final result. If you write something like c = 2*a + b/3 in a notebook cell and use handcalcs, it renders as a formatted equation showing the formula with letters, then with the actual numbers plugged in, then the answer. This makes it much easier for a reviewer to check the work step by step without guessing where the numbers came from. The library is aimed at engineers and technical professionals who document calculations in Jupyter notebooks and want clean, readable output without writing LaTeX by hand. Because handcalcs shows the numeric substitution explicitly, calculations become significantly easier to audit. There are two main ways to use it. The first is as a Jupyter cell magic: adding %%render at the top of a cell causes handcalcs to automatically render all the calculations in that cell as LaTeX. The second is as a Python decorator, @handcalc(), which you apply to a function definition. The decorator approach also works outside Jupyter, for example inside a Streamlit web application. A %%tex command lets you convert a Python expression directly into raw LaTeX text if you want to copy the output into another document or system. Several configuration options can be set globally, including the number of decimal places shown, the decimal separator character, whether to display scientific notation, and how many columns to use when showing parameters. Custom symbol mappings are also supported. Completed notebooks can be exported as PDFs if a LaTeX environment is installed on the system. The project wiki documents compatibility with other calculation-related libraries. Handcalcs is available on PyPI and can be installed with pip.
← connorferster on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.