A tool that exports a Jupyter Notebook to LaTeX format using nbconvert’s LatexExporter, enabling further conversion to PDF.
Project description
Swarmauri Tool Jupyter Export LaTeX
Converts a Jupyter NotebookNode into LaTeX using nbconvert; optionally generates a PDF.
Features
- Uses nbconvert’s
LatexExporterwith 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) whento_pdf=True. - Use
use_custom_template=Trueandtemplate_pathto 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_tool_jupyterexportlatex-0.9.0.dev5.tar.gz.
File metadata
- Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev5.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adc91d9289e260fe796e9b7ace8fb4b5eb260fd87db06d1b28a8d57fefeba650
|
|
| MD5 |
e3007cf18f5678514df66e5002a45ad3
|
|
| BLAKE2b-256 |
0c7e55f423db26d62c013e2f60c37ceac12d703d55c545cdeb295b7fb1bd2ce6
|
File details
Details for the file swarmauri_tool_jupyterexportlatex-0.9.0.dev5-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_jupyterexportlatex-0.9.0.dev5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
572051f08727a9a06dcd68f2bb32142dbe4cb14689a4f680f53db1e7ea1dc51d
|
|
| MD5 |
0e6afdc9c9304a7079266f01c1cd9b72
|
|
| BLAKE2b-256 |
6cf2562a5d771ca6e662d83147bb277bb185307498b8920b2b775d2f6db2a8bb
|