0

I have .tex file and i want to add to it code that I generated with PyLaTeX. How can I do it? This is what I have by now.

with open('file1.tex', encoding='utf-8') as file:
    tex = file.read()
doc = Section('a')
doc.append(NoEscape(tex))

#code for generating and adding plots (not important)

doc.generate_tex('file2')

But this way I get

\section{a}%
\label{sec:a}%

at the beginning of my .tex file, and also I have to move \end{document} at the end of my code.

Jan Dzban
  • 1
  • 1
  • 1
    With "pages" you mean pages from the compiled pdf you generated with pylatex? – samcarter_is_at_topanswers.xyz Jul 29 '22 at 09:18
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 30 '22 at 14:39
  • @samcarter_is_at_topanswers.xyz actually no, I meant latex code I have generated with pylatex. I want to write most of my report in latex, and then upload some plots from python to the same file. – Jan Dzban Aug 01 '22 at 06:06

0 Answers0