Skip to main content

A tool that exports a Jupyter Notebook to LaTeX format using nbconvert’s LatexExporter, enabling further conversion to PDF.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexportlatex


Swarmauri Tool Jupyter Export LaTeX

Converts a Jupyter NotebookNode into LaTeX using nbconvert; optionally generates a PDF.

Features

  • Uses nbconvert’s LatexExporter with optional custom template support.
  • Returns the LaTeX string and (optionally) the path to a generated PDF.
  • Accepts inline CSS/JS injection via nbconvert hooks.

Prerequisites

  • Python 3.10 or newer.
  • nbconvert (with LaTeX/PDF dependencies such as TeXLive or Tectonic if generating PDFs).
  • Swarmauri base/core packages (installed automatically).

Installation

# pip
pip install swarmauri_tool_jupyterexportlatex

# poetry
poetry add swarmauri_tool_jupyterexportlatex

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterexportlatex

Quickstart

import json
import nbformat
from swarmauri_tool_jupyterexportlatex import JupyterExportLatexTool

notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
exporter = JupyterExportLatexTool()
response = exporter(
    notebook_node=notebook,
    use_custom_template=False,
    template_path=None,
    to_pdf=True,
)

if "latex_content" in response:
    Path("notebooks/example.tex").write_text(response["latex_content"], encoding="utf-8")

if pdf := response.get("pdf_file_path"):
    print("PDF saved to", pdf)
else:
    print("Error:", response.get("error"))

Tips

  • Install a TeX distribution (e.g., texlive, tectonic) when to_pdf=True.
  • Use use_custom_template=True and template_path to control the LaTeX layout.
  • Combine with notebook execution tools (execute → export → PDF) for reporting pipelines.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_tool_jupyterexportlatex-0.9.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterexportlatex-0.9.0.dev1.tar.gz
Algorithm Hash digest
SHA256 4dc73a59b2b5840677f06861d18733c39dd9bd9e0925f88fc389fd3e86036bf7
MD5 b4b44c923b65c334d906f46f42f06f73
BLAKE2b-256 f20fe7f5638be658f1c04404431bd8b6f01d3a1807b923513d9a04500daa2f70

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexportlatex-0.9.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterexportlatex-0.9.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2914482f60759448750a26a3d8301c5853d85cc90c2b5073a9a78be00f5fd00
MD5 4fa78b62e78a1662caa5da2511e4f5e9
BLAKE2b-256 39a15a67cffe7409a3cf5371db1629ec9e52337d0099cc651014f80c72566ebb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page