JelteF/PyLaTeX — pull request #12 by felipeacsi (2014-06-12 16:56:49+00:00)
Title: Added extrapreamble option

Hello,

this is a proposal in order to add extra text to the preamble. In my case, I need to add several instruccions in the preamble. Here is an example how this works:

from pylatex import Document
preamble = r'\setlength\parindent{0pt}'
doc = Document(extrapreamble=preamble)
doc.generate_tex()

Then, the output in `default_filename.tex` is:

\documentclass{article}\usepackage[T1]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage{lmodern}
\setlength\parindent{0pt}
\begin{document}\end{document}

I'm open to suggestions.

Felipe