Import custom latex script into pylatex document

Viewed 3262

I'm trying to generate a .pdf file using PyLaTeX. I see PyLaTeX has a predefined syntax to generate LaTeX documents and then export them, but I want to simply load a LaTeX file I have already built and not recreate it through the PyLaTeX syntax.

The code I am trying to use now is the following, and even if everything works, I get the "raw" code for the document:

from pylatex import Document, Section, Subsection, Command
from pylatex.utils import italic, NoEscape

latex_document = 'path'
with open(latex_document) as file:
    tex= file.read()

doc = Document('basic')
doc.append(tex)
doc.generate_pdf(clean_tex=False)
1 Answers
Related