Small enchancement to generate_pdf, now invalid latex compilation
results in raised exception, which simplifies launching pylatex in
batch mode.