Created
March 30, 2021 07:23
-
-
Save graphomania/8665fc2b3a6c4c7eef19e8ffd1bf5929 to your computer and use it in GitHub Desktop.
Python Matrix to Tex String
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matrix_to_tex(matrix) -> str: | |
tex_str = '\\begin{matrix}\n' | |
lines_strs = list() | |
for line in matrix: | |
lines_strs.append(' & '.join([str(el) for el in line])) | |
tex_str += '\\\\\n'.join(lines_strs) + '\n\\end{matrix}' | |
return tex_str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment