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

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev3.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.dev3.tar.gz
Algorithm Hash digest
SHA256 54d38b1dc5761873863051053affafa662acb6b382671d3d3df1d49b32ba64eb
MD5 2ebc0b8a75f34ab08eb9dcf429f8c045
BLAKE2b-256 a71ca45411a2a5605e4fb6a4e754a107bb9f3d2247f24cb55c17f751a2ce6b9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev3-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.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 13b60b5edcc68a3ec610538c87210f86e870e80f775fd656af3fd48bc9d56908
MD5 ed742619f8997e8fd83622a02dc76a7b
BLAKE2b-256 b24f24d3102be300addf40be6db9fb16886c30cb54f0870218a5bf3143a68453

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