texify_matrix
- typhon.latex.texify_matrix(a, fmt='%f', filename=None, caption=None, heading=None, label='tab:matrix', align='r', delimiter=True)[source]
Convert a np.ndarray into a LaTeX table.
Note
the function only works with 2-dimensional arrays. If you want to process 1-dimensional arrays you still have to pass them in a 2D-represenation to clearly determine if it is a row or column vector ([1, N] or [N, 1]).
- Parameters:
a (np.ndarray) – array to convert to LaTeX table.
fmt (str) – format string to specify the number format.
filename (str) – path to outputfile. if no file is given, the output is send so stdout.
caption (str) – table caption, if no caption is passed it is left empty.
label (str) – Label to reference the table.
align (str) – specify the alignment of numbers inside the cells.
delimiter (bool) – toggle the separation of cells through lines.
- Returns:
LaTeX source code either to a specified file or stdout.
Examples
>>> import numpy >>> texify_matrix(numpy.random.randn(5, 4), ... fmt="%.3f", ... filename="matrix.tex", ... caption="This is a test caption.", ... heading=['H1', 'H2', 'H3', 'H4'], ... align='c', ... delimiter=False ... )