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.8.3.dev17.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.8.3.dev17.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.8.3.dev17.tar.gz
Algorithm Hash digest
SHA256 e0d549747685274627250cd04b70da9b284616c976bcc927ce987354c1ca09da
MD5 4508be42ff1dded7367f10f67c1ac259
BLAKE2b-256 79be6a12f4a3e356643893f45c703f8ac3a31f47793980dbe99534d365da3f0d

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexportlatex-0.8.3.dev17-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.8.3.dev17-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.8.3.dev17-py3-none-any.whl
Algorithm Hash digest
SHA256 d61c6c2057d164e597b078a4145bab112f192bda4d6005a0cf9d2cf10ccd46c3
MD5 2f43a6cdaa09230d6a477d9dff8112af
BLAKE2b-256 34934e69ce0a5b0c7f62a4f16eda983635c8c0f5ac724f7fafd8e016019163f0

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