Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Wiki
  • Embedding the semantic tree in MathML

Embedding the semantic tree in MathML · Changes

Page history
Created page from dev-list posting authored Mar 30, 2015 by Peter Krautzberger's avatar Peter Krautzberger
Hide whitespace changes
Inline Side-by-side
Embedding-the-semantic-tree-in-MathML.md 0 → 100644
View page @ 8338263b
[OP on mathjax-dev](https://groups.google.com/forum/#!topic/mathjax-dev/BpP3bF-NvaY)
Starting example: `a+b+c` which might be realized as
```html
<math>
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
<mo>+</mo>
<mi>c</mi>
</math>
```
which would yield [a semantic tree](https://github.com/zorkow/speech-rule-engine/blob/sloan_branch/doc/grammar.tex0 looking like
```
+
|--- a
|--- b
|--- c
```
which could be embedded as follows
<math>
<mrow data-math-semantic-parent="sum" data-math-semantic-children="3">
<mi data-math-semantic-child>a</mi>
<mo data-math-semantic-operator>+</mo>
<mi data-math-semantic-child>b</mi>
<mo data-math-semantic-operator>+</mo>
<mi data-math-semantic-child>c</mi>
</mrow>
</math>
In other words,
* add mrows when necessary for semantic-tree-nodes with children
* identify children
* do some countin.
The hope is that this simple parent/child structure works well recursively, e.g.,
```
a + b*d + c
```
i.e.,
```html
<math>
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
<mo>&#x22C5;</mo>
<mi>d</mi>
<mo>+</mo>
<mi>c</mi>
</math>
```
would lead to a semantic tree of
```
+
|--- a
|--- *
| |--- b
| |--- c
|--- d
```
and we simply start from the leafs adding an mrow for * etc. to get
```html
<math>
<mrow data-math-semantic-parent="sum" data-math-semantic-children="3">
<mi data-math-semantic-child> a</mi>
<mo data-math-semantic-operator>+</mo>
<mrow data-math-semantic-parent="product" data-math-semantic-children="2">
<mi data-math-semantic-child>b</mi>
<mo data-math-semantic-operator>&#x22C5;</mo>
<mi data-math-semantic-child>d</mi>
</mrow>
<mo data-math-semantic-operator>+</mo>
<mi data-math-semantic-child>c</mi>
</mrow>
</math>
```
This is assuming the MathML tree numbering (IDs) that Neil, Davide and the folks at Texthelp designed.
Questions:
* Is this too simplistic?
* Is adding mrows too destructive?
* Do we need/want to be more destructive than that?
\ No newline at end of file
Clone repository

MathJax Wiki

  • Contributing
    • Contributor License Agreement etc
    • Quick guide to translating mathjax
  • Development
    • Development Process
      • Release Process Checklist
      • Documentation Update Process
      • Source Control Policies
    • Design Documents
      • MathJax Roadmap
      • CDN Hosting
        • CDN requirements
        • CDN Hosting at Google Cloud Storage
      • Performance Discussion
      • Profiling and Diagnostics Tools
      • Documentation generation guide
      • Testing
        • Platforms supported
        • Test Machines
  • MathJax web presence