Skip to main content

Calculating formulas and displaying them in LaTeX

Project description

calc2tex

Computing values of formulas and displaying them in LaTeX.

Quickstart

For a complete documentation see the docs.

Requirements

  • Python: 3.6+
  • LaTeX-packages: siunitx, booktabs, amsmath

Install

pip install calc2tex

Example

Create a input.txt-file containing:

x; x_i; 12; m
y; y_{res};; x**2*3; m**2

Create a start.tex-file which includes:

in = Calc2tex("input.txt", "EN")
in.table()
Some text.
$$in.comp("y")$$

After running following python-script:

import calc2tex
calc2tex.process_tex("start.tex", "output.tex")

a new file output.tex is created which contains:

\begin{table}[htbp]
    \centering
    \caption{input values}
    \label{tab:input_val}
    \begin{tabular}{lcc}
        \toprule
        variable & value & unit\\
        \midrule
        $x_i$ & 12.0 & $\si{\meter}$\\ 
        \bottomrule
    \end{tabular}
\end{table}
Some text.
$$y_{res} =& x_i^{2}\cdot 3 = \SI{12.0}{\meter}^{2}\cdot 3 = \SI{432.0}{\meter\tothe{2}}$$

Issues

  • calc2tex is currently in development, so changes will happen in the future.
  • a/b/c will not be evaluated correctly, use: a/(b*c)

License

calc2tex is released under the MIT license.

Project details


Download files

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

Source Distribution

calc2tex-0.0.2.tar.gz (11.6 kB view hashes)

Uploaded Source

Built Distribution

calc2tex-0.0.2-py3-none-any.whl (13.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page