Rewrite Rulesphysics/quantity-to-qty

physics/quantity-to-qty

Collapse quantity to the shorter qty helper.

Rewrite patterns#

  1. paren\quantity(#1)\qty(#1)
  2. bracket\quantity[#1]\qty[#1]
  3. brace\quantity{#1}\qty{#1}
  4. vertical-bar\quantity|#1|\qty|#1|

Examples#

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

qty alias#

Before

\quantity(a+b)

After this rule

\qty(a+b)

Rendering verified with the declared packages.

qty alias brace context#

Before

g=\quantity{\frac{a}{b}}

After this rule

g=\qty{\frac{a}{b}}

Rendering verified with the declared packages.

qty alias bracket context#

Before

\quantity[a+b]^{-1}

After this rule

\qty[a+b]^{-1}

Rendering verified with the declared packages.

qty alias vertical bar context#

Before

\quantity|x-y|<\varepsilon

After this rule

\qty|x-y|<\varepsilon

Rendering verified with the declared packages.

Same family#

Notes#

This alias preserves the selected delimiter form; fence expansion belongs to qty-specific rules.

Disable this rule#

TransformEngine(profile="corpus", disable_rules=["physics/quantity-to-qty"])
new TransformEngine({ profile: 'corpus', disableRules: ['physics/quantity-to-qty'] })

Open in Playground