1.1.14 • Published 7 months ago

@suzu-sys/notion-eq v1.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Notion-Eq

An equation numbering tool for Notion.

  • Automatically adds equation numbers to LaTeX blocks in Notion documents.
  • Automatically replaces equation references with corresponding numbers (similar to LaTeX's \eqref).

Getting Started

Prepare Your Notion Environment

  1. Obtain an integration token.

  2. Identify the Notion page you want to process and get its Page ID.

  3. Set up the AlignEqRefs database and get its Database ID.

Setup

Create a .env file in the current directory and add the following:

NOTION_TOKEN=*********************
PAGE_ID=*********************
ALIGN_EQ_REFS_DB_ID=*********************

Installation (Optional)

npm i -g @suzu-sys/notion-eq
# OR use it via npx (no installation required)

Usage

1. Add Equation Numbers

Use \tag{} or \tag{<digits>} in your LaTeX blocks to mark equations for numbering. Any digits you enter will be overwritten with the correct number automatically.

  • Equation block with a single \tag{}:

    x^2 + 2x + 1 \tag{}
  • Equation block with multiple \tag{}s:

    \begin{align}
    \mathbf U^T\mathbf \Sigma^{-1}\mathbf U &= \mathbf\Lambda\tag{} \\
    \mathbf\Sigma^{-1} &= \mathbf U\mathbf\Lambda\mathbf U^T\tag{}
    \end{align}

2. Reference Equations

To reference a numbered equation, insert a link to the equation block from a text block. The link title does not affect numbering.

If the equation block contains multiple \tag{}s, register the referencing text block in the AlignEqRefs database.

3. Run the Tool

# If installed:
notion-eq
# OR use npx:
npx @suzu-sys/notion-eq

Example Output

  • Before
  • After

.env Parameters

ParameterDescription
NOTION_TOKENYour Notion integration token
PAGE_IDThe ID of the Notion page to process.
ALIGN_EQ_REFS_DB_IDThe ID of the AlignEqRefs database.
EQ_PREFIX (Optional)Prefix of equation number in text blocks. Default: (
EQ_SUFFIX (Optional)Suffix of equation number in text blocks. Default: )

!NOTE
EQ_PREFIX and EQ_SUFFIX apply only to how equation numbers appear in text blocks, not in LaTeX blocks.

Page and database IDs are 32-character alphanumeric strings, found at the end of a Notion page or database URL.

TypeExample URL and ID
Pagehttps://www.notion.so/Sample-Page-9a3f0c7d5b8e1f24c6d07b1e4f3a2d8c?pvs=...
Databasehttps://www.notion.so/0f9b3d7ca1e45f28bdc07e2f6a3c9d14?v=...

AlignEqRefs Database

The AlignEqRefs database is used to handle references to individual equations within an equation block that contains multiple \tag{}s.

PropertyTypeFormatExample Value
Paragraph LinkTitleLink to the referencing text block. Link title does not affect numbering.Link
IndexTextComma-separated list of 0-based \tag{} indices from the equation block. Only links to blocks with multiple \tag{}s are counted. Each index corresponds to the order of such links in the referencing text block.1,0,1

!NOTE
Example
ref(U,0) and ref(U,1) refer to individual equations within a block that has multiple \tag{}s.
ref(x^2) refer to a block with only a single \tag{}.
If a text block contains:
"... ref(U,0) ... ref(x^2) ... ref(U,1) ..."
then the Index field should be "0,1".
Links to single-tag blocks (like ref(x^2)) are ignored when determining the order.

1.1.14

7 months ago

1.1.13

7 months ago

1.1.12

7 months ago

1.1.11

7 months ago

1.1.10

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago