Document \(\LaTeX\) Compiler

This module provides functionality for compiling LaTeX documents into PDF files.

Classes:

BatchCompiler: A class to compile LaTeX documents into PDF files using various compilers.

Example:

from pylatex import Document
from your_module_name import BatchCompiler

doc = Document()
# Add content to your document here...
# ...
compiler = BatchCompiler(doc)
compiler.generate_pdf(filepath="output", clean=True, compiler="pdflatex")
class reemission.document_compiler.BatchCompiler(document: Document)[source]

A class to compile LaTeX documents into PDF files using various compilers.

document

An instance of pylatex.Document representing the LaTeX document to be compiled.

Type:

Document

generate_pdf(filepath=None, *, clean=True, clean_tex=True, compiler=None, compiler_args=None, silent=True, compilations: int = 2) None[source]

Generates a PDF file from the LaTeX document.

Parameters:
  • filepath (str, optional) – The name of the file (without .pdf). If None, the default_filepath attribute will be used.

  • clean (bool, optional) – Whether to remove non-PDF files created during compilation. Defaults to True.

  • clean_tex (bool, optional) – Whether to remove the generated .tex file. Defaults to True.

  • compiler (str or None, optional) – The name of the LaTeX compiler to use. If None, PyLaTeX will choose a suitable one. Defaults to None.

  • compiler_args (list or None, optional) – Extra arguments to pass to the LaTeX compiler. Defaults to an empty list if None.

  • silent (bool, optional) – Whether to hide compiler output. Defaults to True.

  • compilations (int, optional) – The number of times to run the compiler. Defaults to 2.

Raises:

CompilerError – If no LaTeX compiler is found or an error occurs during compilation.