Metadata-Version: 2.4
Name: nb2latex
Version: 0.1.0
Summary: CLI to convert Jupyter notebooks to a single LaTeX document
Author-email: Archie Benn <archiesnbenn@gmail.com>
License: MIT License
        
        Copyright (c) 2025 [Archie Benn]
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nbconvert>=7.16.6
Requires-Dist: notebook
Requires-Dist: ipykernel
Dynamic: license-file

# nb2latex

Convert multiple Jupyter notebooks into a single LaTeX document and PDF.

## Overview

`nb2latex` is a lightweight Python CLI tool that takes multiple `.ipynb` files and combines them into one clean LaTeX document. It extracts the main body of each .tex file produced from the corresponding .ipynb file using `nbconvert` and stitches them together into a single .tex file which is then compiled by `pdflatex` to output a PDF. A table of contents and title page are also included.

## How it works

- Converts selected `.ipynb` notebooks to LaTeX using `nbconvert`.
- Strips unnecessary LaTeX preamble, \begin{document}, and \end{document} in each .tex file.
- Combines main bodies into one .tex document and uses the preamble from `nbconvert`.
- Adds title page and table of contents automatically.
- Compiles the final `.tex` to PDF using `pdflatex`.
- Cleans up excess files post-compile.


## Requirements

- Python >= 3.12 
- Pandoc (required for `nbconvert`)
- A LaTeX distribution providing `pdflatex` on PATH (e.g MiKTeX or TeX Live)

Install dependencies:

```bash
pip install nb2latex
```

## (Optional environment)

You can also recreate the environment using Micromamba/Conda and the provided environment.yml to install all dependencies except LaTeX distribution.

Micromamba:
```bash
micromamba create -f environment.yml
micromamba activate nb2latexEnv
```
Or Conda:
```bash
conda env create -f environment.yml
conda activate nb2latexEnv
```

## Usage

```bash
nb2latex --title "LaTeX notebooks" notebook1.ipynb notebook2.ipynb notebook3.ipynb
```

