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

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.8.3.dev16.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.dev16.tar.gz
Algorithm Hash digest
SHA256 9fe114aa94f0c8477fd97cbbe6c7b345fe1f16f8837daee2407a0ad18d440bc2
MD5 8295e55b28bb18aeb044871a7a2c35e4
BLAKE2b-256 53316ad0788ffdd2352acb6900aa8a146fc97588105dc43d86394f8a2aa7021a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexportlatex-0.8.3.dev16-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.dev16-py3-none-any.whl
Algorithm Hash digest
SHA256 f0200916d03ef85e24e24b1217d852335755098ce9773ae76519ab49dccd8d5d
MD5 8f7948bb17577ca9ba8005e4660126d6
BLAKE2b-256 83fe9ac694595dfc8c2090924a421ecfc13e9f701fcfeeef83f553784779dcc3

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