Rewrite Rulesphysics/cosine-to-cos

physics/cosine-to-cos

Collapse a bare cosine helper to the standard cos operator.

Rewrite patterns#

  1. bare\cosine\cos

Examples#

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

cosine oscillation#

Before

E(t)=E_0\cosine\omega t

After this rule

E(t)=E_0\cos\omega t

Rendering verified with the declared packages.

Downstream rules#

Same family#

Notes#

In LaTeX physics.sty 1.3, \cosine is the original \cos saved with \let, a plain operator that grabs nothing, while the redefined \cos grabs a following [...] power and (...) argument. The rule renames only a bare \cosine, one not followed by (, [, or a brace group; a \cosine that carries scripts is bare. The renamed command gets the empty argument slots of the active \cos record. In faithful, named-fn-to-operatorname rewrites the skipped branches to \operatorname{cos} and keeps the delimiters literal. Touches-only convergence: every Applied removes one bare \cosine; non-matching nodes return Skipped. The produced command and canonical reference use the physics record, which overrides the base definition whenever this rule is enabled.

Disable this rule#

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

Open in Playground