I tried to run latexTop() first then latexMiddle() but it does not seem to work however it does not show error message it just does not append latexmiddle into latextop ,I also tried open('name.tex','r') as myfile: text = myfile.read()
def latexTop():
doc = Document('name')
doc.append(Command('title', 'title'))
doc.append(Command('date', NoEscape(r'\today')))
doc.append(NoEscape(r'\maketitle'))
doc.generate_tex()
#doc.generate_pdf('name',clean_tex=False,compiler='pdflatex')
def latexMiddle(doc):
doc = Document('name')
section = Section('Matrix tests')
subsection = Subsection('Array')
vec = Matrix(a)
vec_name = VectorName('a')
math = Math(data=[vec_name, '=', vec])
subsection.append(math)
section.append(subsection)
subsection = Subsection('Matrix')
vec = Matrix(a, mtype='b')
vec_name = VectorName('a')
math = Math(data=[vec_name, '=', vec])
subsection.append(math)
section.append(subsection)
I can't test it but I think there are big mistakes in code.
you have to run
latexMiddle()insidelatextTop()latexMiddlegetsdocbut later it creates totally newdocbut finally it make nothing withdoc- it doesn't appendsection- so all code is useless.Eventually you should first create
docand later send it to both functions, and finally generate file.