Convert a numpy.NDArray
to various LaTeX forms.
>>> import numpy as np
>>> import arraytex as atx
>>> A = np.array([[1, 2, 3], [4, 5, 6]])
>>> print(atx.to_matrix(A))
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
\end{bmatrix}
>>> print(atx.to_tabular(A))
\begin{tabular}{c c c}
\toprule
Col 1 & Col 2 & Col 3 \\
\midrule
1 & 2 & 3 \\
4 & 5 & 6 \\
\bottomrule
\end{tabular}
Inspired by @josephcslater's array_to_latex.
- Support for matrix environments with different delimiters (
bmatrix
,pmatrix
, etc.). - Support for tabular environments.
- Support for builtin number formats (
:.2f
,:.3e
, etc.). - Fully tested and typed.
python >= 3.8
You can install ArrayTeX via pip from PyPI:
$ pip install arraytex
Please see the docs for more information.
Contributions are very welcome. To learn more, see the Contributor Guide.
Distributed under the terms of the MIT license, ArrayTeX is free and open source software.
If you encounter any problems, please file an issue along with a detailed description.
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.