#!/usr/bin/python import numpy as np from pylatex import Document, Section, Subsection, Table, Math, TikZ, Axis, \ Plot from pylatex.numpy import Matrix from pylatex.utils import italic doc = Document(filename='example_add') section = doc.add(Section('Yaay the first section, it can even be ' + italic('italic'))) section.append('Some regular text') section.add(Subsection('Math that is incorrect', data=[Math(data=['2*3', '=', 9])])) table = Table('rc|cl') table.add_hline() table.add_row((1, 2, 3, 4)) table.add_hline(1, 2) table.add_empty_row() table.add_row((4, 5, 6, 7)) section.add(Subsection('Table of something', data=[table])) a = np.array([[100, 10, 20]]).T M = np.matrix([[2, 3, 4], [0, 0, 1], [0, 0, 2]]) math = Math(data=[Matrix(M), Matrix(a), '=', Matrix(M*a)]) section.add(Subsection('Matrix equation', data=[math]))