diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/statements.sty.ltxml')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/statements.sty.ltxml | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/statements.sty.ltxml b/Master/texmf-dist/tex/latex/stex/statements.sty.ltxml new file mode 100644 index 00000000000..d938af97167 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/statements.sty.ltxml @@ -0,0 +1,142 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('omdoc'); +RequirePackage('myindex'); +DefCMPEnvironment('{assertion} OptionalKeyVals:stat', + "<omdoc:assertion ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() type='&KeyVal(#1,'type')'>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + ."</omdoc:assertion>\n"); +DefCMPEnvironment('{simpleDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='simple' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:definition>\n"); +DefCMPEnvironment('{PatternDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='pattern' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "#body" + . "</omdoc:definition>\n"); +DefEnvironment('{PatternRule}{}', + "<omdoc:requation>#1 #body</omdoc:requation>"); +DefEnvironment('{PatternCMP}{}', + "<omdoc:CMP>#body</omdoc:CMP>"); +DefEnvironment('{RecDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='inductive' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:definition>\n"); +DefCMPEnvironment('{example} OptionalKeyVals:stat', + "<omdoc:example " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "for='&KeyVal(#1,'for')'>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:example>\n"); +DefCMPEnvironment('{axiom} OptionalKeyVals:stat', + "<omdoc:axiom ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:axiom>\n"); +DefEnvironment('{consymb} OptionalKeyVals:stat', + "<omdoc:symbol ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()" + . "name='&KeyVal(#1,'name')'>" + . "<omdoc:metadata>" + . "<dc:description>" + . "#body" + . "</dc:description>" + . "</omdoc:metadata>" + . "</omdoc:symbol>\n"); +DefConstructor('\symtype{}{}',"<omdoc:type system='#1'>#2</omdoc:type>"); +DefCMPEnvironment('{definition} OptionalKeyVals:stat', sub { + my ($doc, $keyvals, %props) = @_; + my @symbols = @{$props{defs} || []}; + foreach my $symb(@symbols) { + $doc->openElement('omdoc:symbol', name=>$symb); + $doc->closeElement('omdoc:symbol'); } + my %attrs = (); + my $id = $keyvals->getValue('id') if $keyvals; + $attrs{'xml:id'} = $id if $id; + my $ffor = $keyvals->getValue('for') if $keyvals; + my $for = $ffor . join(' ',@symbols) if $ffor; + $attrs{for} = $for if $for; + $doc->openElement('omdoc:definition', %attrs); + my $title = $keyvals->getValue('title') if $keyvals; + if ($title) { + $doc->openElement('omdoc:metadata'); + $doc->openElement('dc:title'); + $doc->absorb($title); + $doc->closeElement('dc:title'); + $doc->closeElement('omdoc:metadata'); } + $doc->openElement('omdoc:CMP'); + $doc->openElement('omdoc:p'); + $doc->absorb($props{body}) if $props{body}; + $doc->closeElement('omdoc:p'); + $doc->closeElement('omdoc:CMP'); + $doc->closeElement('omdoc:definition'); + return; }, + afterDigestBegin=>sub { + my ($stomach, $whatsit) = @_; + my @symbols = (); + $whatsit->setProperty(defs=>\@symbols); + AssignValue('defs', \@symbols, 'global'); + return; }, + afterDigest => sub { + AssignValue('defs', undef, 'global'); + return; }); + +DefConstructor('\definiendum[]{}', + "<omdoc:term role='definiendum' name='#1' cd='#theory'>#2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }); +DefMacro('\defin{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END); + (T_CS('\definiendum'), T_OTHER('['), $_[1]->unlist, T_OTHER(']'), @args, T_CS('\defin@index'), @args); }); +DefMacro('\twindef{}{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END, T_BEGIN, $_[2]->unlist, T_END); + (T_CS('\twindef@def'), @args, T_CS('\twindef@index'), @args); }); +DefMacro('\atwindef{}{}{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END, T_BEGIN, $_[2]->unlist, T_END, + T_BEGIN, $_[3]->unlist, T_END); + (T_CS('\atwindef@def'), @args, T_CS('\atwindef@index'), @args); }); +DefConstructor('\twindef@def{}{}', + "<omdoc:term role='definiendum' name='#1-#2' cd='#theory'>#1 #2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString.'-'.$whatsit->getArg(2)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias => ''); +DefConstructor('\atwindef@def{}{}{}', + "<omdoc:term role='definiendum' name='#1-#2-#3' cd='#theory'>#1 #2 #3</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString.'-'.$whatsit->getArg(2)->toString + .'-'.$whatsit->getArg(3)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias => ''); +DefCMPEnvironment('{notation} OptionalKeyVals:stat', + "<omdoc:omtext type='notation' ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').not')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n"); +DefConstructor('\notatiendum OptionalKeyVals:notation {}', + "<omdoc:phrase type='notation'>#1</omdoc:phrase>"); +1; |