Skip to content

MTEF selector -126 (0x82) causes parse failure #23

Description

@eshreyareddy

MTEF Selector '-126' (0x82) Causes Parse Failure

Issue

Getting parse errors when converting some MTEF OLE objects to MathML. Both mathtype_to_mathml and mathtype_to_mathml_plus gems fail on selector value -126 (0x82 hex).

Error Messages

mathtype_to_mathml_plus (v0.0.15):

undefined method 'default_namespace=' for nil

mathtype_to_mathml (v0.0.7):

selection '-126' does not exist in :choices for obj.equation[0].payload

Reproduction

Extract MathType OLE object from DOCX (word/embeddings/oleObject*.bin) and attempt conversion:

require 'mathtype_to_mathml_plus'
MathTypeToMathMLPlus::Converter.new('oleObjectXXX.bin').convert

The error occurs consistently on equations with selector value -126.

Note: I have sample .bin files that reproduce this, but they're extracted from internal documents.

Analysis

  • Selector -126 (0x82 unsigned) is outside documented MTEF v5 spec range
  • Likely a MathType 6/7 extension
  • All equations with this selector fail consistently

Expected

Parser should handle selector 0x82 or fail gracefully with a clear message.

Actual

Hard failure with no MathML output.

Question

What does selector 0x82 represent? Can support be added for this construct?

Workaround

Currently preserving failed equations as images instead of MathML.

Thanks!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions