Skip to content

Support \mathrel and \joinrel for composite relations #310

Description

@Happypig375

Implement TeX's \mathrel{content} atom-class wrapper and the plain-TeX \joinrel spacing primitive so compound relation symbols can be expressed semantically.

Required semantics:

  • \mathrel{...} makes the complete enclosed subformula a relation for inter-atom spacing while preserving its internal layout.
  • \joinrel contributes the plain-TeX relation join of negative 3mu; it must scale in math units with the active math style.
  • Preserve both constructs in the atom/display model and canonical serializer rather than flattening them to hard-coded spaces or a frontend transform.

Acceptance criteria:

  • Relation spacing before and after \mathrel matches built-in relation atoms in display, text, script, and scriptscript styles.
  • \joinrel joins representative composite constructions such as \mathrel{|}\joinrel= without disturbing adjacent outer relation spacing.
  • Nested groups, scripts, delimiters, empty/malformed arguments, and use at formula boundaries have structural and exact-error tests.
  • Parse → serialize → parse preserves atom classes, negative spacing, and grouped content.
  • Focused measurement and cross-frontend rendering tests cover composite relations and verify no clipping or double spacing.

The Comprehensive LaTeX Symbol List documents \mathrel and \joinrel as the spacing controls used to assemble composite relation symbols: https://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

Parent backlog: #81. This was identified from the WpfMath parity tracker #145.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area/ParsingLaTeX tokenization, parsing, commands, and serialization.Area/RenderingTypesetting, measurement, fonts, text layout, and drawing.Type/EnhancementA concrete change to CSharpMath behavior or capability.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions