Skip to main content

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 align environment,

    $$\begin{align}
    ...
    \end{align}$$
    

    then each line inside the align environment 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tagrefsorter-0.1.3.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tagrefsorter-0.1.3-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file tagrefsorter-0.1.3.tar.gz.

File metadata

  • Download URL: tagrefsorter-0.1.3.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

Hashes for tagrefsorter-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2d775e0476afb969403c2de3fdd4f7cf9fddc14816bfc127f53eecd81dd3ac4f
MD5 6b73b43e6bfb26355fb0ad0aaf373210
BLAKE2b-256 ba8c1090411c8b0c9c8c4994776580e0e0a01a46008ad3da3a4f46ba1e8409d6

See more details on using hashes here.

File details

Details for the file tagrefsorter-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tagrefsorter-0.1.3-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

Hashes for tagrefsorter-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 621ac7f44cc681a9c65c601c1b15d8e448a0239b84a1cf558c60f3e408fdaa69
MD5 f40ec7e8207744c91ecc32c91b43fa30
BLAKE2b-256 fba17ccf02500d8f1ad723d8eabc5ab4932b00b326694fe6cd90bc424c51fd28

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