Skip to main content

Calculating formulas and displaying them in LaTeX

Project description

calc2tex

Compute results of formulas and display 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.long("y")$$

After running the 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 & $\si{\meter}$\\
        \bottomrule
    \end{tabular}
\end{table}
Some text.
$$y_{res} = x_i^{2}\cdot 3 = \left(\SI{12}{\meter}\right)^{2}\cdot 3 = \SI{432}{\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.4.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

calc2tex-0.0.4-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file calc2tex-0.0.4.tar.gz.

File metadata

  • Download URL: calc2tex-0.0.4.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/59.3.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for calc2tex-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6148e8f5ab53312dca4006621a88d294fd75fe1aea54189e021a44a4ed2d11dc
MD5 43351ab8185fed9400001060b1e7c63c
BLAKE2b-256 29605fcb7555884889a1f5570b85deadfa6aeb57f778246d57b1fa2f498f7776

See more details on using hashes here.

File details

Details for the file calc2tex-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: calc2tex-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/59.3.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for calc2tex-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e42f8363e38093ec0ca626aca548a1f9de2ed0d2805bf530806dfc4d9e0ad543
MD5 241c7c1d91994e9c22a89fbe049cba1e
BLAKE2b-256 1faad4b284ad4aa5a050eefacc89f50982181adf27027d408fec354a24f75d51

See more details on using hashes here.

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