Skip to content

canonicalize: merge "arc" with the trig name when there is a space between them - #1167

Open
pablgonz wants to merge 1 commit into
daisy:mainfrom
pablgonz:arc-mspace
Open

pablgonz wants to merge 1 commit into
daisy:mainfrom
pablgonz:arc-mspace

Conversation

@pablgonz

@pablgonz pablgonz commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #957.

arc\,cos x is common in LaTeX (and babel-spanish writes \arcsen as arc\,sen). merge_arc_trig only looked at the next sibling, so the mspace stopped the merge:

<math><mi>arc</mi><mspace width="0.167em"/><mi>cos</mi><mspace width="0.167em"/><mi>x</mi></math>
  • Before: arc of cosine x
  • After: arccos of x (same as without the space)

merge_arc_trig now skips mspace and blank mtext before the trig name, and removes them when it merges. If the next element is not a trig function, nothing changes.

  • New tests clean_up_arc_mspace and clean_up_arc_mspace_not_trig in src/canonicalize.rs.
  • Two Spanish tests (arc_trig_babel_split, zoom_in_all_babel_arc) are updated: the split form now reads the same as \arcsen / \arctg ("arco seno", "arco tangente, abrir paréntesis…"), which is what we want.
  • cargo test and cargo clippy --tests pass.

After this is merged, the temporary Spanish rules arc-trig-separado* in Rules/Languages/es/SharedRules/general.yaml are no longer needed; I will remove them in a separate PR to beta-0.7.9.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor
Linux library size: 0.61 MiB (+0.00%)
Revision Release liblibmathcat.so
Base (fcc2f04) 0.61 MiB (635,928 bytes)
PR (20eeda2) 0.61 MiB (635,944 bytes)
Change +16 bytes (+0.00%)

Built with default features, Rust 1.96.0, and Ubuntu 24.04. Workflow run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

arc + space + trig name is not merged

1 participant