Closed m-iancu closed 8 years ago
Indeed this is a bug (I think it may even be a regression). This looks like there is only one conditional that needs to be inserted or fixed. @angerhang this is not really a priority, but fix if easy.
Looking at modules.sty.ltxml
, I see
my ($pre_notation_symbol_element) = $root->findnodes(
".//omdoc:notation[\@name='$name' and \@stex:nargs='$nargs' and ".
"preceding-sibling::omdoc:symbol[1]/\@name
= '$name']");
# If no <symbol> has been generated for this definition, generate one:
if (!$pre_notation_symbol_element) {
It seems that and \@stex:nargs='$nargs'
will prevent from finding any preceding siblings (as they ones in the examples have different number of arguments). Maybe just removing that will fix the problem. @angerhang please test.
I applied the changes that Miko suggested which seems reasonable to me.
Given
\symdef[name=addition]{intplusOp}{\mathop{+}}
\symdef[assocarg=1,name=addition]{intplus}[1]{\assoc[p=500]{\intplusOp}{#1}}
\symtest{intplus}{\intplus{a,b,3}}
we obtain
<omdoc:theory xml:id="intarith" about="#intarith" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/numberfields/source/intarith.tex#textrange(from=1;0,to=6;12)">
<omdoc:metadata xml:id="intarith.metadata1" about="#intarith.metadata1" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/numberfields/source/intarith.tex#textrange(from=1;0,to=6;12)">
<dc:creator xml:id="intarith.metadata1.creator1" about="#intarith.metadata1.creator1" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/numberfields/source/intarith.tex#textrange(from=1;0,to=6;12)">miko</dc:creator>
</omdoc:metadata>
<omdoc:symbol name="addition" xml:id="intarith.symbol2" about="#intarith.symbol2" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/numberfields/source/intarith.tex#textrange(from=2;0,to=2;45)"/>
<omdoc:notation cd="intarith" name="addition" stex:macro_name="intplusOp" stex:nargs="0" xml:id="intarith.notation3" about="#intarith.notation3" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/numberfields/source/intarith.tex#textrange(from=2;0,to=2;45)">
<omdoc:prototype>
<om:OMS cd="intarith" name="addition"/>
</omdoc:prototype>
<omdoc:rendering>
<m:mo>+</m:mo>
</omdoc:rendering>
</omdoc:notation>
<omdoc:notation cd="intarith" name="addition" stex:macro_name="intplus" stex:nargs="1" xml:id="intarith.notation4" about="#intarith.notation4" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/numberfields/source/intarith.tex#textrange(from=3;0,to=3;76)">
<omdoc:prototype>
<om:OMA>
<om:OMS cd="intarith" cr="fun" name="addition"/>
<omdoc:exprlist name="args">
<omdoc:expr name="arg"/>
</omdoc:exprlist>
</om:OMA>
</omdoc:prototype>
<omdoc:rendering precedence="500">
<omdoc:iterate name="args">
<omdoc:separator>
<m:mo cr="fun">+</m:mo>
</omdoc:separator>
<omdoc:render name="arg"/>
</omdoc:iterate>
</omdoc:rendering>
</omdoc:notation>
</omdoc:theory>
<omdoc:bibliography files="local" xml:id="omdoc1.bibliography2" about="#omdoc1.bibliography2" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/meta-inf/lib/post.tex#textrange(from=2;0,to=2;20)"/>
<omdoc:index xml:id="omdoc1.index3" about="#omdoc1.index3" stex:srcref="/Users/Hang/lmh/localmh/MathHub/smglom/meta-inf/lib/post.tex#textrange(from=3;1,to=3;12)"/>
</omdoc>
The output doesn't contain duplicates of addition
. If this also looks fine to you, I will just push this change to the remote.
From the MMT importer perspective this is good now. Should get rid of a lot of errors.
This has been temporarily fixed but we are still left with the discussion on how to handle stex:nargs
in #90 . Closing...
For instance
intarith.tex
insmglom/numberfields
produces duplicate symbols foraddition
,multiplication
. It seems that each symdef generates one and the code in the.tex
file is :Then the resulting
.omdoc
contains: