Rewrite Rulesbase/eqalign-to-aligned-env

base/eqalign-to-aligned-env

Rewrite eqalign to the standard aligned environment.

Rewrite patterns#

  1. cr\eqalign{#1 \cr #2}\begin{aligned} #1 \\ #2 \end{aligned}
  2. linebreak-arguments\eqalign{#1 \\*[#2] #3}\begin{aligned} #1 \\*[#2] #3 \end{aligned}
  3. newline\eqalign{#1 \newline #2}\begin{aligned} #1 \\ #2 \end{aligned}
  4. leading-row-scripts\eqalign{#1 \cr_{#2}^{#3}#4}\begin{aligned} #1 \\{}_{#2}^{#3}#4 \end{aligned}
  5. leading-row-primes\eqalign{#1 \cr'#2}\begin{aligned} #1 \\{}'#2 \end{aligned}

Examples#

Each example shows this rule applied in isolation. A complete normalization profile may make additional changes.

Three line aligned derivatives#

Before

\eqalign{f(x)&=x^3-1 \cr f'(x)&=3x^2 \cr f''(x)&=6x}

After this rule

\begin{aligned} f(x)&=x^3-1 \\ f'(x)&=3x^2 \\ f''(x)&=6x \end{aligned}

The rendered result has pixel differences from the input.

Continued alignment#

Before

\eqalign{a&=b+c \cr &=d}

After this rule

\begin{aligned} a&=b+c \\ &=d \end{aligned}

The rendered result has pixel differences from the input.

Same family#

Notes#

Convert only known body-level \cr, \\, and \newline row separators. Normalize \cr and \newline to an unstarred linebreak with no spacing argument; preserve the original star and optional spacing slots on \\ (including \\*, \\[2pt], and \\*[2pt]). Split a separator through any Scripted base chain, transfer its leading subscript, superscript, and Prime content to a fresh empty base at the start of the next row, and preserve nested script layers. Do not split separators inside explicit groups or nested environments, and leave unknown names such as \crcr untouched. Preserve real internal empty rows and the body sequence, including trailing separators. Only the plain-TeX source command is eliminated; existing AMS environments are out of scope.

Disable this rule#

TransformEngine(profile="corpus", disable_rules=["base/eqalign-to-aligned-env"])
new TransformEngine({ profile: 'corpus', disableRules: ['base/eqalign-to-aligned-env'] })

Open in Playground