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.2.1.tar.gz (16.2 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.2.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tagrefsorter-0.2.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tagrefsorter-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a98f81204695b5313b3b72e5896c70b53453ae0b5b2d055bec01dc34c4fdbb22
MD5 d28b50ad9eaa671b14e1dcfad175c0ea
BLAKE2b-256 23c5a7e128d7a5d386ada4a8b6f4df91bbc23fcbd6f84c4f6e032f1107a8a0df

See more details on using hashes here.

Provenance

The following attestation bundles were made for tagrefsorter-0.2.1.tar.gz:

Publisher: publish.yml on SuzuSys/TagRefSorter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: tagrefsorter-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tagrefsorter-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 820b78e4c86e0147540369e4d1a242f48e669d2a342dd4b7dde80740b54bdcf1
MD5 74760aeb7558d8427eca09fb24040e0c
BLAKE2b-256 9914af27d4c454c467413e603cf1c1dee2e7133bad2af65cd4d82ccaf911123a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tagrefsorter-0.2.1-py3-none-any.whl:

Publisher: publish.yml on SuzuSys/TagRefSorter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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