CLI tool to normalize LaTeX \tag numbering in Jupyter Notebook files
Project description
tagrefsorter
A CLI tool to normalize LaTeX \tag{} numbering in Jupyter Notebook (.ipynb) files.
Installation
pip install tagrefsorter
Usage
tagrefsorter path/to/notebook.ipynb
The notebook is overwritten in place.
Algorithm Overview
tagrefsorter processes LaTeX math blocks in markdown cells of a Jupyter Notebook and normalizes equation numbering based on the following rules:
-
For each display math block written as
$$ ... $$, a LaTeX\tag{}is added if missing, or updated if already present, so that equation numbers become sequential. -
If a display math block contains an
alignenvironment,$$\begin{align} ... \end{align}$$
then each line inside the
alignenvironment is treated as an individual equation. A\tag{}is added or updated for each line, and equation numbers are assigned sequentially in appearance order. -
Existing tags of the form
\tag{x}are considered author-specified equation identifiers. If a markdown cell contains a reference written as$(x)$, it is interpreted as a reference to\tag{x}. When equation numbers are renumbered, all corresponding$(x)$references are automatically updated to match the new equation number.
As a result, equation numbering and references remain consistent even after equations are reordered, added, or removed.
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 tagrefsorter-0.1.2.tar.gz.
File metadata
- Download URL: tagrefsorter-0.1.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5be1614100897316fc05854ab8bdeed69d157c5a4def49f8afbeb894757c9c0
|
|
| MD5 |
0319b06aff455507d5bfaf81c4898f9d
|
|
| BLAKE2b-256 |
20854b6f27fa824fdbbee9d4cb40011b12da093b3fb5455d6a959150edecadbb
|
File details
Details for the file tagrefsorter-0.1.2-py3-none-any.whl.
File metadata
- Download URL: tagrefsorter-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ef77fa2d9642dab2e80f98b98cbf97c59d38c5c8ee5bbb474431d4735bc3e1
|
|
| MD5 |
696623c65d64b2743240974bb5e3e01e
|
|
| BLAKE2b-256 |
6bb4ebb7189d458ca409ecdf6777a8d722ca5e22fd0dee0408a765620e23b597
|