pyexlatex package

Create LaTeX documents using only Python. Rather than building a direct Python API to LaTeX, this package has its own, simpler API to creating documents. It is focused on creating professional-looking documents with little styling effort. It currently supports documents, presentations, graphics, letters, and resumes.

Subpackages

Submodules

pyexlatex.df module

pyexlatex.df.df_to_pdf_and_move(dflist, outfolder, outname='table', tabular_string='', string_format='', above_text='', below_text='', font_size=12, caption='', missing_rep=' - ', landscape=False, panel_names=None, colname_flags=None, as_document=True, outmethod='pandas')[source]

Takes a dataframe or list of dataframes as input and outputs to a LaTeX formatted table with multiple panels, creates a PDF, and moves the LaTeX file and PDF to a dated folder.

Required options:

dflist: Dataframe or list of dataframes. outfolder: Output folder for LaTeX file and PDF. Inside of this folder, a folder called Tables will be created,

inside of which the two files will be put inside another folder with the date.

Optional options:

outname: Name of output table, default is table tabular_string: Can take any string that would normally used in tabular (i.e. rrr for three columns right aligned

as well as L{<width>), C{<width>}, and R{<width>} (i.e. L{3cm}) for left, center, and right aligned fixed width. Additionally . aligns on the decimal. Default is first column left aligned, rest center aligned.

string_format: String or list of format of numbers in the table. Please see Python number formats. Pass a blank

string to leave formatting untouched (the default).

above_text: String of text to display above table below_text: String of text to display below table font_size: Font size, default 12 caption: Title of table missing_rep: Representation for missing numbers, default ” - ” landscape: Boolean. True to switch table to landscape output instead of portrait. panel_names: Python list of names of each panel, to go below column names, e.g. [‘Table’,’Other Table’] colname_flags: Python list of yes or no flags for whether to display column names for each panel. Default is to

display column names only for the first panel, as usually the panels have the same columns. The default input for a three panel table would be [‘y’,’n’,’n’]

as_document: Boolean. True to output latex wrappers for table to be a standalone document. False to write

only table wrappers so that table can be included in another document

outmethod: String, ‘pandas’ or ‘csv’. If ‘pandas’, uses pandas’ built in df.to_latex() to build latex. If

‘csv’, uses df.to_csv() and then pyexlatex.df.raw_csv_to_latex(). The latter case is useful when the table itself contains latex expressions.

pyexlatex.equations module

pyexlatex.equations.latex_equations_to_pdf(latex_list, directory, name='Equations', below_text=None, math_size=18, text_size=14, title=None, para_space='1em', inline=False, as_document=True)[source]

pyexlatex.exc module

exception pyexlatex.exc.NoPackageWithNameException[source]

Bases: Exception

pyexlatex.typing module