Skip to main content

A Scientific Document Calculation Assistant

Project description


doCal is a scientific report document calculation back-end that aims to reduce the routine code used inside Python chunks in Pweave and/or PythonTEX documents. While embeding python code inside a document is a big advantage, it should not be the end. It is still required to format Python calculations output and equations to LaTeX form. Thus the user still has to write significantly more code to make the results flow with the surrounding document.

This library aims to use the above tools as infrustructure and make it easy to write reports, by doing the heavy lifting for the user and letting the user focus on the content (a LaTeX advantage).


  • Automatic calculation and unit conversion and handling (idea from Mathcad, using Sympy units)
  • Automatic formatting of equations, calculations and results into LaTeX form (using Sympy)
  • LaTeX (.tex) file output that can be converted to other formats via pandoc (including MS Word .docx)
  • Clear LaTeX formatted calculation procedure output

An Example:

Inside a Pweave source document the user (having imported necessary modules and defined variables) writes

The area moment of inertia is:

<%aserar('I_R = (b*(h**3))/12 - ((b-2*t)*(h-2*t)**3)/12')%>

The center of gravity is

Now when the file is weaved into a .tex file, the above is converted into:

The area moment of inertia is:

I_{R}	&= \frac{b}{12} \cdot h^{3} - \frac{1}{12} \cdot \left(b - 2 \cdot t\right) \cdot \left(h - 2 \cdot t\right)^{3}\\
		&= \frac{5\,\mathrm{cm}}{12} \times \left(11\,\mathrm{cm}\right)^{3} - \frac{1}{12} \times \left(5\,\mathrm{cm} - 2 \times 1\,\mathrm{mm}\right) \times \left(11\,\mathrm{cm} - 2 \times 1\,\mathrm{mm}\right)^{3}\\
		&= 5.07(10^{-07})\,\mathrm{m^{4}}\\

The center of gravity is

which, when compiled to pdf will look like PDF preview


The project is currently under development and since I am not experienced, any suggestion or contribution is very welcome.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for docal, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size doCal-0.0.1-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size doCal-0.0.1.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page