bundle.latex

Submodules

Classes

Document

Build a complete LaTeX document and compile to PDF.

Figure

Render a LaTeX figure with includegraphics.

Section

Render a LaTeX section with optional content blocks.

Table

Build a LaTeX longtable from column definitions and row data.

Functions

escape(→ str)

Escape special LaTeX characters in a string.

Package Contents

class bundle.latex.Document(title: str, author: str = 'TheBundle', landscape: bool = True, theme: Theme | None = None, margin: str = '0.75in')

Build a complete LaTeX document and compile to PDF.

PACKAGES = ['graphicx', ('xcolor', 'table'), 'geometry', 'booktabs', 'longtable', 'hyperref', ('inputenc',...
title
author = 'TheBundle'
landscape = True
theme
margin = '0.75in'
add_preamble(latex_str: str)
add_section(section: bundle.latex.elements.Section)
render() str
build_pdf() bytes

Compile the document to PDF bytes.

save_pdf(output_path: pathlib.Path)

Compile and save the document to a PDF file.

class bundle.latex.Figure(image_path: pathlib.Path | str, width: str = '0.85\\linewidth', caption: str | None = None)

Render a LaTeX figure with includegraphics.

image_path
width = '0.85\\linewidth'
caption = None
render() str
class bundle.latex.Section(title: str, level: int = 1)

Render a LaTeX section with optional content blocks.

title
level = 1
add_text(text: str)
add_figure(figure: Figure)
add_table(table: Table)
add_raw(latex_str: str)
render() str
class bundle.latex.Table(columns: list[Column], row_color_alt: str | None = None)

Build a LaTeX longtable from column definitions and row data.

columns
row_color_alt = None
add_row(values: list[str])
render() str
bundle.latex.escape(text: str) str

Escape special LaTeX characters in a string.