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.dev7.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev7.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.dev7.tar.gz
Algorithm Hash digest
SHA256 55731af6c124248bc5e113dc6fb26ce5706430199acff91877ee49ae5b85482f
MD5 b073ba3e282fe3b62ae221651a2c795e
BLAKE2b-256 26cf67bf0cfed82617d0de5caf2b7c8a94c1bded3a1c529890deab42e6f093a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev7-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.dev7-py3-none-any.whl
Algorithm Hash digest
SHA256 4053dbeb79e968534c03cf72d01198a654f7cfbe3014dd7810fd7b30b07e1178
MD5 b95ce77990c49a7a0f7b02b98074dd42
BLAKE2b-256 a2f0ce70b87c06efa8304750a90c23658ded0ad9a5ad262dccc9b8e1d3397eaf

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