slatex / LaTeXML-Plugin-sTeX

A LaTeXML Plugin for Semantic LaTeX (sTeX)
LaTeX Project Public License v1.3c
2 stars 3 forks source link

\symdef does not create viable OMBINDS. #109

Open kohlhase opened 8 years ago

kohlhase commented 8 years ago

@dginev, I am assigning this to @angerhang, but I suspect he will need your help.

In MathHub/smglom/set/source/set.tex we have

\symdef[bvars=1]{bsetst}[3]{\mixfixii[nobrackets]{\{}{#2}{\,\vert\,}{#3}{\}}}
\symtest{bsetst}{\bsetst{a,b}{(a,b)}{a>b}}

and that generates

    <omdoc:notation cd="set" name="bsetst" stex:macro_name="bsetst" stex:nargs="3" xml:id="set.notation10" about="#set.notation10" stex:srcref="smglom/sets/source/set.tex#textrange(from=38;0,to=38;77)">
      <omdoc:prototype>
        <om:OMBIND>
          <om:OMS cd="set" cr="fun" name="bsetst"/>
          <om:OMBVAR>
            <omdoc:expr name="arg1"/>
          </om:OMBVAR>
          <omdoc:expr name="arg2"/>
          <omdoc:expr name="arg3"/>
        </om:OMBIND>
      </omdoc:prototype>
      <omdoc:rendering>
        <m:mo cr="fun">{</m:mo>
        <omdoc:render name="arg2" precedence="neginfty"/>
        <m:mo cr="fun">|</m:mo>
        <omdoc:render name="arg3" precedence="neginfty"/>
        <m:mo cr="fun">}</m:mo>
      </omdoc:rendering>
    </omdoc:notation>

which is exactly what we want (except that OpenMath does not allow multi-body OMBINDS, but we want to change that). BUT, it does not generate the right semantic macro, which you can see in MathHub/smglom/set/source/set.en.tex which contains $\bsetst{v}{A}{B}$ which generates

<om:OMOBJ stex:srcref="smglom/sets/source/set.en.tex#textrange(from=14;76,to=15;20)">
  <om:OMBIND>
    <om:OMS cd="set" name="bsetst"/>
    <om:OMBVAR><om:OMV name="&#x1D463;"/></om:OMBVAR>
    <om:OMV name="&#x1D434;"/>
  </om:OMBIND>
</om:OMOBJ>

which is wrong: it seems that the macro produced is doing the wrong thing. And I have no clue where it gets the #1 from. I guess that it somehow gets confused because the [bars=1] which signals \symdef to make an OMBIND is not used in the presentation.

kohlhase commented 8 years ago

If we solve this, I think we can also get a hold on #107

angerhang commented 8 years ago

I wonder which branch you are using when generating the omdoc for $\bsetst{v}{A}{B}$, if we use the KWARC master we get:

<om:OMOBJ stex:srcref="smglom/sets/source/set.en.tex#textrange(from=3;10,to=4;18)">
    <om:OMBIND>
        <om:OMA>
            <om:OMS cd="set" name="bsetst" />
            <om:OMV name="&#x1D434;" />
       </om:OMA>
        <om:OMBVAR>
            <om:OMV name="&#x1D463;" />
        </om:OMBVAR>
        <om:OMV name="&#x1D435;" />
   </om:OMBIND>
</om:OMOBJ>

when we use the the sync branch https://github.com/angerhang/LaTeXML up to date with Bruce's version, we get:

<om:OMOBJ>
    <om:OMA>
        <om:OMS cd="arithmetics" name="multiplication" />
        <om:OMSTR>\bsetst</om:OMSTR>
        <om:OMV name="&#x1D463;" />
        <om:OMV name="&#x1D434;" />
        <om:OMV name="&#x1D435;" />
    </om:OMA>
</om:OMOBJ>

Neither of these looks similar to the wrong version you showed.