diff options
author | Karl Berry <karl@freefriends.org> | 2010-07-20 22:30:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-07-20 22:30:22 +0000 |
commit | cdfe96a3444a4d0664b9702c4ff6fe6622257834 (patch) | |
tree | 577232accd4bf41d7480fae7c177ceef147c8fea /Master/texmf-dist/tex/latex/stex | |
parent | 47e2d96a8faed88dfedd17ca5352227d585a6710 (diff) |
stex update once more
git-svn-id: svn://tug.org/texlive/trunk@19548 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex')
38 files changed, 3087 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/cmathml/cmathml.sty.ltxml b/Master/texmf-dist/tex/latex/stex/cmathml/cmathml.sty.ltxml index a6ce629f220..fdc0b2eae33 100644 --- a/Master/texmf-dist/tex/latex/stex/cmathml/cmathml.sty.ltxml +++ b/Master/texmf-dist/tex/latex/stex/cmathml/cmathml.sty.ltxml @@ -940,7 +940,7 @@ DefConstructor('\Couterproduct [] {}{}', . "<ltx:XMTok meaning='outerproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" . "<ltx:XMArg>#2</ltx:XMArg>" . "<ltx:XMArg>#3</ltx:XMArg>" - . "</ltx:XMApp>"); + . "</ltx:XMApp>");#$ DefConstructor('\Cintegers []', "<ltx:XMTok meaning='integers' role='ID' ?#1(definitionURL='#1')()/>"); DefConstructor('\Creals []', diff --git a/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty new file mode 100644 index 00000000000..a7cf322fcaf --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty @@ -0,0 +1,175 @@ +%% +%% This is file `dcm.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% dcm.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{dcm}[2010/06/25 v0.3 Dublin Core Metadata] +\RequirePackage{sref} +\omdaddkey{dcm@person}{id} +\omdaddkey{dcm@person}{birthdate} +\omdaddkey{dcm@person}{email} +\omdaddkey{dcm@person}{url} +\omdaddkey{dcm@person}{affiliation} +\omdaddkey{dcm@person}{personaltitle} +\omdaddkey{dcm@person}{academictitle} +\omdaddkey{dcm@person}{department} +\omdaddkey{dcm@person}{workaddress} +\omdaddkey{dcm@person}{privaddress} +\omdaddkey{dcm@person}{worktel} +\omdaddkey{dcm@person}{privtel} +\omdaddkey{dcm@person}{workfax} +\omdaddkey{dcm@person}{privfax} +\omdaddkey{dcm@person}{worktelfax} +\omdaddkey{dcm@person}{privtelfax} +\def\dcm@pers@def#1#2{\expandafter\xdef\csname dcm@person@\dcm@person@id @#1\endcsname{#2}} +\def\dcm@pers@ref#1#2{\csname dcm@person@#1@#2\endcsname} +\let\dcm@persons=\relax +\newcommand{\DCMperson}[2][]{\omdsetkeys{dcm@person}{#1} +\ifx\dcm@person@id\@empty\@latex@warning{key 'id' undefined in DCMperson}\else +\dcm@pers@def{name}{#2} +\dcm@pers@def{email}{\dcm@person@email} +\dcm@pers@def{birthdate}{\dcm@person@birthdate} +\dcm@pers@def{url}{\dcm@person@url} +\dcm@pers@def{affiliation}{\dcm@person@affiliation} +\dcm@pers@def{workaddress}{\dcm@person@workaddress} +\dcm@pers@def{privaddress}{\dcm@person@privaddress} +\dcm@pers@def{personaltitle}{\dcm@person@personaltitle} +\dcm@pers@def{academictitle}{\dcm@person@academictitle} +\dcm@pers@def{department}{\dcm@person@department} +\dcm@pers@def{workaddress}{\dcm@person@workaddress} +\dcm@pers@def{privaddress}{\dcm@person@privaddress} +\dcm@pers@def{worktel}{\dcm@person@worktel} +\dcm@pers@def{privtel}{\dcm@person@privtel} +\dcm@pers@def{workfax}{\dcm@person@workfax} +\dcm@pers@def{privfax}{\dcm@person@privfax} +\dcm@pers@def{worktelfax}{\dcm@person@worktelfax} +\dcm@pers@def{privtelfax}{\dcm@person@privtelfax} +\@ifundefined{dcm@persons}{\xdef\dcm@persons{\dcm@person@id}}{\xdef\dcm@persons{\dcm@persons,\dcm@person@id}} +\fi} +\newenvironment{DCmetadata}[1][]% +{\def\@style{#1}} % to set the way things are presented. +{\@ifundefined{dcm@\@style @block}{\message{style {\@style} not defined}}{\csname dcm@\@style @block\endcsname}} +\def\dc@mtabline#1#2{\xdef\tab@line{}% +\@for\@p:={#1}\do{\xdef\tab@line{\tab@line&\dcm@pers@ref\@p{#2}}} +\tab@line} +\def\dcm@atabline#1#2#3{\xdef\tab@line{}% +\@for\@p:={#1}\do{\xdef\tab@line{\tab@line: \dcm@pers@ref\@p{#3}}} +\tab@line} +\def\dcm@bitabline#1#2#3#4{\xdef\tab@line{}% +\@for\@p:={#1}\do{\xdef\tab@line{\tab@line&\dcm@pers@ref\@p{#2} #3 \dcm@pers@ref\@p{#4}}} +\tab@line} +\def\DCMcreators#1{\@for\@I:=#1\do{% +\ifx\csname dcm@person@\@I @id\endcsname\@empty% undefined \dcm@person@id +\PackageError{dcm}{reference to undefined DCMperson \@I}% +{you must define a person with id=\@I\MessageBreak% +via the macro \protect\DCMperson, before you can use it in \protect\DCMcreators}\fi}% +\def\dcm@creators{#1}} +\def\DCMcontributors#1{\@for\@I:=#1\do{% +\ifx\csname dcm@person@\@I @id\endcsname\@empty% undefined \dcm@person@id +\PackageError{dcm}{reference to undefined DCMperson \@I}% +{you must define a person with id=\@I\MessageBreak% +via the macro \protect\DCMperson, before you can use it in \protect\DCMcontributors}}% +\else% all \dcm@person@id in the list are defined +\def\dcm@contributors{#1}\fi} +\def\DCMtitle#1{\def\dcm@title{#1}\providecommand{\dcm@shorttitle}{#1}} +\def\dcm@subtitle{} +\def\DCMsubtitle#1{\def\dcm@subtitle{#1}} +\def\dcm@shorttitle{} +\def\DCMshorttitle#1{\def\dcm@shorttitle{#1}} +\def\DCMsubject#1{\def\dcm@subject{#1}} +\long\def\DCMdescription#1{\long\def\dcm@description{#1}} +\def\DCMpublisher#1{\def\dcm@publisher{#1}} +\def\dcm@date{\today} +\def\DCMdate#1{\def\dcm@date{#1}} +\def\DCMtype#1{\def\dcm@type{#1}} +\def\DCMidentifier#1#2{\def\dcm@scheme{#1}\def\dcm@identifier{#2}} +\def\DCMsource#1{\def\dcm@source{#1}} +\def\DCMlanguage#1{\def\dcm@language{#1}} +\def\DCMrelation#1{\def\dcm@relation{#1}} +\def\DCMrights#1{\long\def\dcm@rights{#1}} +\def\DCMlicense#1{\def\dcm@license{#1}} +\def\dcm@license{All rights reserved} +\def\DCMlicensenotice#1{\long\def\dcm@license{\\[1ex]License: #1}} +\def\DCMcopyrightnotice#1#2{\DCMrights{Copyright {\copyright} #1: #2}} +\def\cclicense#1{\def\attribution{\def\dcm@by{yes}} + \def\noncommercial{\def\dcm@nc{yes}} + \def\sharealike{\defdcm@sharealike{yes}} + \def\noderivativeworks{\def\dcm@derivatives{no}}} +\long\def\DCMabstract#1{\long\def\dcm@abstract{#1}} +\def\dcm@authorblock{\newcounter{authors}\stepcounter{authors} +{\let\tabularnewline\relax + \@for\@I:=\dcm@creators\do{\stepcounter{authors}} + \def\@authors{}\def\@affs{}\def\@urls{} + \@for\@I:=\dcm@creators\do + {\xdef\@authors{\@authors&\csname dcm@person@\@I @name\endcsname} + \xdef\@affs{\@affs&\csname dcm@person@\@I @affiliation\endcsname} + \xdef\@urls{\@urls&\csname dcm@person@\@I @url\endcsname}} + \message{authors: \@authors}} + \begin{tabular}[t]{l*{\theauthors}{c}}\@authors\\\@affs\\\@urls\end{tabular}} +\def\dcm@titlepage@block{\begin{titlepage} + \null\vfil\vskip 60\p@ + \begin{center} + \ifx\dcm@title\@empty + \PackageWarning{dcm}{No title specified}{\LARGE Add title here\par} + \else\LARGE \dcm@title \par\fi + \ifx\dcm@subtitle\@empty + \vskip 3em\Large \dcm@subtitle \par\vskip 3em + \else\large\lineskip .75em\dcm@authorblock\vskip 1.5em\fi + \ifx\dcm@date\@empty + \PackageWarning{dcm}{No date specified}{\large\today\par} + \else{\large\dcm@date\par}\vskip 2em\fi + \end{center}\vskip2em + \ifx\dcm@abstract\@empty + \PackageWarning{dcm}{No Abstract specified}\else + \begin{quote}\textbf\dcm@abstract@heading:\dcm@abstract\end{quote}\fi + \vskip 2em\par\vfil\noindent + {\small\noindent\dcm@rights\dcm@license} + \end{titlepage}} +\def\dcm@maketitle@block{\def\@title{\dcm@title\ifx\dcm@subtitle\empty\else\newline\dcm@subtitle\fi} +\def\@author{\dcm@authorblock}\def\@date{\dcm@date}\maketitle} +\srefaddidkey{dcm@sect} +\omdaddkey{dcm@sect}{short} +\omdaddkey{dcm@sect}{creators} +\omdaddkey{dcm@sect}{contributors} +\def\dcm@section#1#2#3{\def\dcm@sect@type{#1}\omdsetkeys{dcm@sect}{#3}\sref@target% +\ifx\dcm@sect@short\@empty\csname #1\endcsname{#2}% +\else\csname #1\endcsname[\dcm@sect@short]{#2}\fi~% +\@ifundefined{sect@style} % +{\dcm@section@default@style{#1}}% +{\csname dcm@section@\sect@style @style\endcsname{#1}}} +\def\dcm@section@default@style#1{% +\ifx\dcm@sect@creators\@empty\else% +\textbf{\dcm@creators@heading}:% +\@for\@I:=\dcm@sect@creators\do{~\csname dcm@person@\@I @name\endcsname}\fi% +\ifx\dcm@sect@contributors\@empty\else% there are contributors +\dcm@contributors@connector% +\@for\@I:=\dcm@sect@contributors\do{~\csname dcm@person@\@I @name\endcsname}\\\fi} +\newcommand{\DCMchapter}[2][]% +{\dcm@section{chapter}{#2}{#1}\sref@label@id{\dcm@chapter@heading\ \thechapter}} +\newcommand{\DCMsection}[2][]% +{\dcm@section{section}{#2}{#1}\sref@label@id{\dcm@section@heading\ \thesection}} +\newcommand{\DCMsubsection}[2][]% +{\dcm@section{subsection}{#2}{#1}\sref@label@id{\dcm@subsection@heading\ \thesubsection}} +\newcommand{\DCMsubsubsection}[2][]% +{\dcm@section{subsubsection}{#2}{#1}\sref@label@id{\dcm@subsubsection@heading\ \thesubsubsection}} +\newcommand{\DCMparagraph}[2][]% +{\dcm@section{paragraph}{#2}{#1}\sref@label@id{this \dcm@paragraph@heading}} +\def\ISOtimestamp{\count1=\time\divide\count1 by 60 % hours +\count2=\count1\multiply\count2 by 60% minutes in \count1 hours +\count3=\time\advance\count3 by -\count2 % minutes +\the\year -\ifnum\month>9\else0\fi\the\month-\ifnum\day>9\else0\fi\the\day +T\ifnum\count1>9\else0\fi\the\count1:\ifnum\count3>9\else0\fi\the\count3:00Z} +\def\dcm@abstract@heading{Abstract} +\def\dcm@creators@heading{Author(s)} +\def\dcm@contributors@connector{with contributions from} +\def\dcm@chapter@heading{Chapter} +\def\dcm@section@heading{Section} +\def\dcm@subsection@heading{Subsection} +\def\dcm@subsubsection@heading{Subsubsection} +\endinput +%% +%% End of file `dcm.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml new file mode 100644 index 00000000000..c4dbe33283e --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/dcm/dcm.sty.ltxml @@ -0,0 +1,160 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Global; +use LaTeXML::Package; +RequirePackage('sref'); + sub getKeyValue_noDelim { + my ($keyval,$key)=@_; + my $valuelist = ToString($keyval->getValue($key)); + $valuelist =~ s/^{(.*)}$/$1/g if $valuelist; + return $valuelist; +} +sub ExportMetadata { + my $keys = shift; + my($id, $email,$affill,$address,$url,$name)=$keys + && map(getKeyValue_noDelim($keys,$_),qw(id email affiliation address url name)); + if ($id) { + AssignValue('DCM_'.$id.'_email',$email,'global') if $email; + AssignValue('DCM_'.$id.'_affiliation',$affill,'global') if $affill; + AssignValue('DCM_'.$id.'_address',$email,'global') if $email; + AssignValue('DCM_'.$id.'_url',$url,'global') if $url; + AssignValue('DCM_'.$id.'_name',$name,'global') if $name; + } else {print STDERR "Warning: key 'id' undefined in \\DCMperson\n"}; + return;} +DefKeyVal('dcm@person','id','Semiverbatim'); +DefKeyVal('dcm@person','birthdate','Semiverbatim'); +DefKeyVal('dcm@person','email','Semiverbatim'); +DefKeyVal('dcm@person','url','Semiverbatim'); +DefKeyVal('dcm@person','affiliation','Semiverbatim'); +DefKeyVal('dcm@person','personaltitle','Semiverbatim'); +DefKeyVal('dcm@person','academictitle','Semiverbatim'); +DefKeyVal('dcm@person','department','Semiverbatim'); +DefKeyVal('dcm@person','workaddress','Semiverbatim'); +DefKeyVal('dcm@person','privaddress','Semiverbatim'); +DefKeyVal('dcm@person','worktel','Semiverbatim'); +DefKeyVal('dcm@person','privtel','Semiverbatim'); +DefKeyVal('dcm@person','workfax','Semiverbatim'); +DefKeyVal('dcm@person','privfax','Semiverbatim'); +DefKeyVal('dcm@person','worktelfax','Semiverbatim'); +DefKeyVal('dcm@person','privtelfax','Semiverbatim'); + +DefConstructor('\DCMperson OptionalKeyVals:dcm@person {}','', +beforeDigest=> sub { AssignValue(inPreamble=>0); }, +afterDigest=>sub { + my ($stomach,$whatsit)=@_; + my $keys=$whatsit->getArg(1); + my $name=ToString($whatsit->getArg(2)); + $keys->setValue('name',$name); + ExportMetadata($keys); + return; +});#$ +sub FishOutMetadata { + my ($document,$keyvals)=@_; + foreach my $role(qw(creators contributors)) { + my $idlist_string=getKeyValue_noDelim($keyvals,$role); + my @ids = split(/,\s*/, $idlist_string); + foreach my $id(@ids) { + my $name = LookupValue('DCM_'.$id.'_name'); + if ($name) { + my $prop_role = $role; +chop $prop_role if $prop_role; + $document->insertElement("dc:$prop_role",$name) if $role; + } else {print STDERR "Warning: no $role with 'id' $id !\n";} + } + } + return;}#$ +DefEnvironment('{DCmetadata}[]', "<omdoc:metadata>#body</omdoc:metadata>"); +DefConstructor('\DCMcreators{}',sub{ + my ($document,$args,%properties) = @_; + my $keyval = LaTeXML::KeyVals->new('dcm@person',T_BEGIN,T_END,('creators'=>$args)); + FishOutMetadata($document,$keyval); + return;}); +DefConstructor('\DCMcontributors{}',sub{ + my ($document,$args,%properties) = @_; + my $keyval = LaTeXML::KeyVals->new('dcm@person',T_BEGIN,T_END,('contributors'=>$args)); + FishOutMetadata($document,$keyval); + return;}); +DefConstructor('\DCMtitle{}',"<dc:title>#1</dc:title>"); +DefConstructor('\DCMsubject{}',"<dc:subject>#1</dc:subject>"); +DefConstructor('\DCMdescription{}',"<dc:description>#1</dc:description>"); +DefConstructor('\DCMpublisher{}',"<dc:publisher>#1</dc:publisher>"); +DefConstructor('\DCMdate{}',"<dc:date>#1</dc:date>"); +DefConstructor('\DCMtype{}',"<dc:type>#1</dc:type>"); +DefConstructor('\DCMidentifier{}{}',"<dc:identifier scheme='#1'>#2</dc:identifier>"); +DefConstructor('\DCMsource{}',"<dc:source>#1</dc:source>"); +DefConstructor('\DCMlanguage{}',"<dc:language>#1</dc:language>"); +DefConstructor('\DCMrelation{}',"<dc:relation>#1</dc:relation>"); +DefConstructor('\DCMrights{}',"<dc:rights>#1</dc:rights>"); +DefMacro('\DCMlicensenotice{}','\DCMrights{#1}'); +DefMacro('\DCMcopyrightnotice{}{}','\DCMrights{Copyright {\copyright} #1: #2}'); +DefConstructor('\cclicense{}',"<cc:license>#1</cc:license>"); +DefConstructor('\attribution',"<cc:attribution/>"); +DefConstructor('\noncommercial',"<cc:noncommercial/>"); +DefConstructor('\sharealike',"<cc:sharealike/>"); +DefConstructor('\noderivativeworks',"<cc:noderivativeworks>"); +DefConstructor('\DCMabstract{}',"<dc:description>#1</dc:description>"); +Tag('omdoc:omgroup', autoClose=>1); +DefConstructor('\DCMchapter OptionalKeyVals:omgroup {}',sub { + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:chapter',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMsection OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:section',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMsubsection OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:subsection',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMsubsubsection OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:subsubsection',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +DefConstructor('\DCMparagraph OptionalKeyVals:omgroup {}',sub{ + my ($document,$keyvals,$title,%properties) = @_; + my $id=$keyvals->getValue('id')||""; + $document->openElement('omdoc:paragraph',('xml:id'=>$id)); + $document->openElement('omdoc:metadata'); + $document->insertElement('dc:title',$title); + FishOutMetadata($document,$keyvals); + return;}); +Tag('omdoc:chapter',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:section',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:subsection',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:subsubsection',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:paragraph',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('omdoc:subparagraph',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:description',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:date',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:creator',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:contributor',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:title',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:subject',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:publisher',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:type',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:identifier',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:language',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +Tag('dc:rights',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1); +RawTeX('\def\ISOtimestamp{\count1=\time\divide\count1 by 60 % hours +\count2=\count1\multiply\count2 by 60% minutes in \count1 hours +\count3=\time\advance\count3 by -\count2 % minutes +\the\year -\the\month-\the\day T\the\count1:\the\count3:00Z}'); +Tag('dc:title',afterOpen=>\&numberIt,afterClose=>\&locateIt); +1; diff --git a/Master/texmf-dist/tex/latex/stex/beamerthemeJacobs.sty b/Master/texmf-dist/tex/latex/stex/mikoslides/beamerthemeJacobs.sty index 7a64c6cc0b8..7a64c6cc0b8 100644 --- a/Master/texmf-dist/tex/latex/stex/beamerthemeJacobs.sty +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/beamerthemeJacobs.sty diff --git a/Master/texmf-dist/tex/latex/stex/cc-by-sa.eps b/Master/texmf-dist/tex/latex/stex/mikoslides/cc-by-sa.eps index fb5a0a662ec..fb5a0a662ec 100644 --- a/Master/texmf-dist/tex/latex/stex/cc-by-sa.eps +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/cc-by-sa.eps diff --git a/Master/texmf-dist/tex/latex/stex/cc-by-sa.png b/Master/texmf-dist/tex/latex/stex/mikoslides/cc-by-sa.png Binary files differindex f0a944e0b89..f0a944e0b89 100644 --- a/Master/texmf-dist/tex/latex/stex/cc-by-sa.png +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/cc-by-sa.png diff --git a/Master/texmf-dist/tex/latex/stex/cc_somerights.eps b/Master/texmf-dist/tex/latex/stex/mikoslides/cc_somerights.eps index e9dc0ed4094..e9dc0ed4094 100644 --- a/Master/texmf-dist/tex/latex/stex/cc_somerights.eps +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/cc_somerights.eps diff --git a/Master/texmf-dist/tex/latex/stex/cc_somerights.jpg b/Master/texmf-dist/tex/latex/stex/mikoslides/cc_somerights.jpg Binary files differindex f945b897622..f945b897622 100644 --- a/Master/texmf-dist/tex/latex/stex/cc_somerights.jpg +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/cc_somerights.jpg diff --git a/Master/texmf-dist/tex/latex/stex/cc_somerights.pdf b/Master/texmf-dist/tex/latex/stex/mikoslides/cc_somerights.pdf Binary files differindex 2bb2c99eb89..2bb2c99eb89 100644 --- a/Master/texmf-dist/tex/latex/stex/cc_somerights.pdf +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/cc_somerights.pdf diff --git a/Master/texmf-dist/tex/latex/stex/jacobs-logo.eps b/Master/texmf-dist/tex/latex/stex/mikoslides/jacobs-logo.eps index ebeb54c892e..ebeb54c892e 100644 --- a/Master/texmf-dist/tex/latex/stex/jacobs-logo.eps +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/jacobs-logo.eps diff --git a/Master/texmf-dist/tex/latex/stex/jacobs-logo.pdf b/Master/texmf-dist/tex/latex/stex/mikoslides/jacobs-logo.pdf Binary files differindex 6e9afa1ed60..6e9afa1ed60 100644 --- a/Master/texmf-dist/tex/latex/stex/jacobs-logo.pdf +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/jacobs-logo.pdf diff --git a/Master/texmf-dist/tex/latex/stex/jacobs-logo.png b/Master/texmf-dist/tex/latex/stex/mikoslides/jacobs-logo.png Binary files differindex 0bbe28c44fc..0bbe28c44fc 100644 --- a/Master/texmf-dist/tex/latex/stex/jacobs-logo.png +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/jacobs-logo.png diff --git a/Master/texmf-dist/tex/latex/stex/mikoaffiliation.sty b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoaffiliation.sty index 3004b99b7ba..3004b99b7ba 100644 --- a/Master/texmf-dist/tex/latex/stex/mikoaffiliation.sty +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoaffiliation.sty diff --git a/Master/texmf-dist/tex/latex/stex/mikoaffiliation.sty.ltxml b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoaffiliation.sty.ltxml index c580ea36045..c580ea36045 100644 --- a/Master/texmf-dist/tex/latex/stex/mikoaffiliation.sty.ltxml +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoaffiliation.sty.ltxml diff --git a/Master/texmf-dist/tex/latex/stex/mikoslides.cls b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoslides.cls index 2c0c85d07c9..2c0c85d07c9 100644 --- a/Master/texmf-dist/tex/latex/stex/mikoslides.cls +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoslides.cls diff --git a/Master/texmf-dist/tex/latex/stex/mikoslides.cls.ltxml b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoslides.cls.ltxml index a8870d52036..a8870d52036 100644 --- a/Master/texmf-dist/tex/latex/stex/mikoslides.cls.ltxml +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/mikoslides.cls.ltxml diff --git a/Master/texmf-dist/tex/latex/stex/shading-l2r.eps b/Master/texmf-dist/tex/latex/stex/mikoslides/shading-l2r.eps index 39a8ebc4cc6..39a8ebc4cc6 100644 --- a/Master/texmf-dist/tex/latex/stex/shading-l2r.eps +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/shading-l2r.eps diff --git a/Master/texmf-dist/tex/latex/stex/shading-l2r.png b/Master/texmf-dist/tex/latex/stex/mikoslides/shading-l2r.png Binary files differindex 2eabe7a8b17..2eabe7a8b17 100644 --- a/Master/texmf-dist/tex/latex/stex/shading-l2r.png +++ b/Master/texmf-dist/tex/latex/stex/mikoslides/shading-l2r.png diff --git a/Master/texmf-dist/tex/latex/stex/modules/modules.sty b/Master/texmf-dist/tex/latex/stex/modules/modules.sty new file mode 100644 index 00000000000..2e11bb955ad --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/modules/modules.sty @@ -0,0 +1,224 @@ +%% +%% This is file `modules.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% modules.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{modules}[2010/06/25 v1.0 Semantic Markup] +\newif\ifmod@show\mod@showfalse +\DeclareOption{show}{\mod@showtrue} +\newif\ifmod@qualified\mod@qualifiedfalse +\DeclareOption{qualifiedimports}{\mod@qualifiedtrue} +\ProcessOptions +\RequirePackage{sref} +\RequirePackage{xspace} +\RequirePackage{xcomment} +\define@key{module}{cd}{} +\define@key{module}{id}{% +\edef\this@module{\expandafter\noexpand\csname module@defs@#1\endcsname}% +\global\@namedef{module@defs@#1}{}% +\ifmod@qualified +\edef\this@qualified@module{\expandafter\noexpand\csname module@defs@qualified@#1\endcsname}% +\global\@namedef{module@defs@qualified@#1}{}% +\fi +\def\mod@id{#1}% +\expandafter\edef\csname #1@cd@file@base\endcsname{\mod@path}% +\expandafter\g@addto@macro\csname module@defs@#1\expandafter\endcsname\expandafter% +{\expandafter\def\csname #1@cd@file@base\expandafter\endcsname\expandafter{\mod@path}}} +\newenvironment{module}[1][]{\setkeys{module}{#1}}{} +\def\activate@defs#1{\csname module@defs@#1\endcsname} +\def\export@defs#1{\@ifundefined{mod@id}{}% +{\expandafter\expandafter\expandafter\g@addto@macro\expandafter% +\this@module\expandafter{\csname module@defs@#1\endcsname}}} +\def\coolurion{} +\def\coolurioff{} +\newcommand{\importmodule}[2][]{{\def\mod@path{#1}% +\ifx\mod@path\@empty\else\requiremodules{#1}\fi}% +\activate@defs{#2}\export@defs{#2}} +\newcommand{\importOMDocmodule}[3][]{\importmodule[#1]{#3}} +\let\metalanguage=\importmodule +\def\mod@newcommand{\@star@or@long\mod@new@command} +\def\mod@new@command#1{\@testopt{\@mod@newcommand#1}0} +\def\@mod@newcommand#1[#2]{\kernel@ifnextchar [{\mod@xargdef#1[#2]}{\mod@argdef#1[#2]}} +\long\def\mod@argdef#1[#2]#3{\@yargdef#1\@ne{#2}{#3}} +\long\def\mod@xargdef#1[#2][#3]#4{\expandafter\def\expandafter#1\expandafter{% +\expandafter\@protected@testopt\expandafter #1\csname\string#1\endcsname{#3}}% +\expandafter\@yargdef\csname\string#1\endcsname\tw@{#2}{#4}} +\define@key{symdef}{local}[true]{\@symdeflocaltrue} +\define@key{symdef}{name}{} +\define@key{symdef}{assocarg}{} +\define@key{symdef}{bvars}{} +\define@key{symdef}{bvar}{} +\newif\if@symdeflocal +\def\symdef{\@ifnextchar[{\@symdef}{\@symdef[]}} +\def\@symdef[#1]#2{\@ifnextchar[{\@@symdef[#1]{#2}}{\@@symdef[#1]{#2}[0]}} +\def\@mod@nc#1{\mod@newcommand{#1}[1]} +\def\@@symdef[#1]#2[#3]#4{% +\@symdeflocalfalse\setkeys{symdef}{#1}% +\expandafter\mod@newcommand\csname modules@#2@pres\endcsname[#3]{#4}% +\expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname}% +\expandafter\@mod@nc\csname mod@symref@#2\expandafter\endcsname\expandafter% +{\expandafter\mod@termref\expandafter{\mod@id}{#2}{##1}}% +\if@symdeflocal\else% +\@ifundefined{mod@id}{}{% +\expandafter\g@addto@macro\this@module% +{\expandafter\mod@newcommand\csname modules@#2@pres\endcsname[#3]{#4}}% +\expandafter\g@addto@macro\this@module% +{\expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname}}% +\expandafter\g@addto@macro\csname module@defs@\mod@id\expandafter\endcsname\expandafter% +{\expandafter\@mod@nc\csname mod@symref@#2\expandafter\endcsname\expandafter% +{\expandafter\mod@termref\expandafter{\mod@id}{#2}{##1}}}% +\ifmod@qualified% +\expandafter\g@addto@macro\this@qualified@module% +{\expandafter\mod@newcommand\csname modules@#2@pres@qualified\endcsname[#3]{#4}}% +\expandafter\g@addto@macro\this@qualified@module% +{\expandafter\def\csname#2atqualified\endcsname{\csname modules@#2@pres@qualified\endcsname}}% +\fi% +}\fi} +\def\resymdef{\@ifnextchar[{\@resymdef}{\@resymdef[]}} +\def\@resymdef[#1]#2{\@ifnextchar[{\@@resymdef[#1]{#2}}{\@@resymdef[#1]{#2}[0]}} +\def\@@resymdef[#1]#2[#3]#4{\expandafter\renewcommand\csname modules@#2@pres\endcsname[#3]{#4}} +\let\abbrdef\symdef +\def\mod@path{} +\def\mod@true{true} +\omdaddkey[false]{termdef}{local} +\omdaddkey{termdef}{name} +\newcommand{\termdef}[3][]{\omdsetkeys{termdef}{#1}% +\expandafter\mod@newcommand\csname#2\endcsname[0]{#3\xspace} +\ifx\termdef@local\mod@true\else% +\@ifundefined{mod@id}{}{\expandafter\g@addto@macro\this@module% +{\expandafter\mod@newcommand\csname#2\endcsname[0]{#3\xspace}}} +\fi} +\def\@captitalize#1{\uppercase{#1}} +\newcommand\capitalize[1]{\expandafter\@captitalize #1} +\def\mod@termref#1#2#3{\def\@test{#3} +\@ifundefined{#1@cd@file@base} + {\protect\G@refundefinedtrue + \@latex@warning{\protect\termref with unidentified cd "#1": the cd key must + reference an active module} + \def\@label{sref@#2 @target}} + {\def\@label{sref@#2@#1@target}}% +\expandafter\ifx\csname #1@cd@file@base\endcsname\@empty% local reference +\sref@hlink@ifh{\@label}{\ifx\@test\@empty #2\else #3\fi}\else% +\def\@uri{\csname #1@cd@file@base\endcsname.pdf\#\@label}% +\sref@href@ifh{\@uri}{\ifx\@test\@empty #2\else #3\fi}\fi} +\def\mod@simplify#1{\expandafter\mod@simpl#1/\relax} +\def\mod@simpl#1/#2\relax{\def\@second{#2}% +\ifx\mod@blaaaa\@empty\edef\mod@savedprefix{}\def\mod@blaaaa{aaa}\else\fi% +\ifx\@second\@empty\edef\mod@savedprefix{\mod@savedprefix#1}% +\else\mod@simplhelp#1/#2\relax\fi} +\def\mod@updir{..} +\def\mod@simplhelp#1/#2/#3\relax{\def\@first{#1}\def\@second{#2}\def\@third{#3}% +\ifx\@third\@empty% base case +\ifx\@second\mod@updir\else% +\ifx\mod@second\@empty\edef\mod@savedprefix{\mod@savedprefix#1}% +\else\edef\mod@savedprefix{\mod@savedprefix#1/#2}% +\fi% +\fi% +\else% +\ifx\@first\mod@updir% +\edef\mod@savedprefix{\mod@savedprefix#1/}\mod@simplhelp#2/#3\relax% +\else% +\ifx\@second\mod@updir\mod@simpl#3\relax% +\else\edef\mod@savedprefix{\mod@savedprefix#1/}\mod@simplhelp#2/#3\relax% +\fi% +\fi% +\fi}% +\newcommand{\defpath}[2]{\expandafter\newcommand\csname #1\endcsname[1]{#2/##1}} +\newif\ifmodules +\gdef\mod@reg{} +\def\mod@update#1{\ifx\mod@reg\@empty\xdef\mod@reg{#1}\else\xdef\mod@reg{#1@\mod@reg}\fi} +\def\mod@check#1@#2///#3\relax{% +\def\mod@one{#1}\def\mod@two{#2}\def\mod@three{#3}% +\expandafter% +\ifx\mod@three\mod@one\modulestrue% +\else% +\ifx\mod@two\@empty\modulesfalse\else\mod@check#2///#3\relax\fi% +\fi} +\def\mod@search#1{% +\modulesfalse\expandafter\mod@check\mod@reg @///#1\relax% +\ifmodules\else\mod@update{#1}\fi} +\def\mod@reguse#1{\modulesfalse\expandafter\mod@check\mod@reg @///#1\relax} +\def\mod@prefix{} +\def\mod@updatedpre#1{% +\edef\mod@prefix{\mod@prefix\mod@pathprefix@check#1/\relax}} +\def\mod@pathprefix@check#1/#2\relax{% +\ifx\\#2\\% no slash in string +\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}% +\fi} +\def\mod@pathprefix@help#1/#2\relax{% +\ifx\\#2\\% end of recursion +\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}% +\fi} +\long\def\mod@ReturnAfterFi#1\fi{\fi#1} +\def\mod@pathpostfix@check#1/#2\relax{% slash +\ifx\\#2\\%no slash in string +#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}% +\fi} +\def\mod@pathpostfix@help#1/#2\relax{% +\ifx\\#2\\% +#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}% +\fi} +\def\mod@updatedpost#1{% +\edef\mod@savedprefix{\mod@savedprefix\mod@pathpostfix@check#1/\relax}} +\def\mod@updatesms{\edef\mod@savedprefix{\mod@savedprefix.sms}} +\newcommand{\requiremodules}[1]{% +{\mod@updatedpre{#1}% add the new file to the already existing path +\let\mod@savedprefix\mod@prefix% add the path to the new file to the prefix +\mod@updatedpost{#1}% +\def\mod@blaaaa{}% macro used in the simplify function (remove .. from the prefix) +\mod@simplify{\mod@savedprefix}% remove |xxx/..| from the path (in case it exists) +\mod@reguse{\mod@savedprefix}% +\ifmodules\else% +\mod@updatesms% update the file to contain the .sms extension +\let\newreg\mod@reg% use to compare, in case the .sms file was loaded before +\mod@search{\mod@savedprefix}% update registry +\ifx\newreg\mod@reg\else\input{\mod@savedprefix}\fi% check if the registry was updated and load if necessary +\fi}} +\def\sinput#1{ +{\mod@updatedpre{#1}% add the new file to the already existing path +\let\mod@savedprefix\mod@prefix% add the path to the new file to the prefix +\mod@updatedpost{#1}% +\def\mod@blaaaa{}% macro used in the simplify function (remove .. from the prefix) +\mod@simplify{\mod@savedprefix}% remove |xxx/..| from the path (in case it exists) +\mod@reguse{\mod@savedprefix}% +\let\newreg\mod@reg% use to compare, in case the .sms file was loaded before +\mod@search{\mod@savedprefix}% update registry +\ifx\newreg\mod@reg%\message{This file has been previously introduced} +\else\input{\mod@savedprefix}% +\fi}} +\let\sinputref=\sinput +\def\requirepackage#1#2{\makeatletter\input{#1.sty}\makeatother} +\srefaddidkey{view} +\omdaddkey{view}{from} +\omdaddkey{view}{to} +\omdaddkey{view}{title} +\ifmod@show +\newsavebox{\viewbox} +\newcounter{view}[section] +\def\view@heading{{\textbf{View} \thesection.\theview} + \sref@label@id{View \thesection.\theproblem} + \@ifundefined{view@title}{:\quad}{\quad(\view@title)\hfill\\}} +\newenvironment{view}[1][]{\omdsetkeys{view}{#1}\sref@target\stepcounter{view} +\begin{lrbox}{\viewbox}\begin{minipage}{.9\textwidth}\importmodule{\view@to}} +{\end{minipage}\end{lrbox} +\setbox0=\hbox{\begin{minipage}{.9\textwidth}% +\noindent\view@heading\rm% +\end{minipage}} +\smallskip\noindent\fbox{\vbox{\box0\vspace*{.2em}\usebox\viewbox}}\smallskip} +\else\newxcomment[]{view}\fi +\def\vassign#1#2{#1\ensuremath{\mapsto #2}} +\define@key{module}{uses}{% +\@for\module@tmp:=#1\do{\activate@defs\module@tmp\export@defs\module@tmp}} +\define@key{module}{usesqualified}{% +\@for\module@tmp:=#1\do{\activate@defs{qualified@\module@tmp}\export@defs\module@tmp}} +\def\csymdef{\@ifnextchar[{\@csymdef}{\@csymdef[]}} +\def\@csymdef[#1]#2{\@ifnextchar[{\@@csymdef[#1]{#2}}{\@@csymdef[#1]{#2}[0]}} +\def\@@csymdef[#1]#2[#3]#4#5{\@@symdef[#1]{#2}[#3]{#4}} +\def\notationdef[#1]#2#3{} +\endinput +%% +%% End of file `modules.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/modules/modules.sty.ltxml b/Master/texmf-dist/tex/latex/stex/modules/modules.sty.ltxml new file mode 100644 index 00000000000..39d1584c14b --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/modules/modules.sty.ltxml @@ -0,0 +1,498 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Global; +use LaTeXML::Package; +DefEnvironment('{module} OptionalKeyVals:Module', + "?#excluded()(<omdoc:theory " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')(xml:id='#id')>#body</omdoc:theory>)", +# beforeDigest=>\&useTheoryItemizations, + afterDigestBegin=>sub { + my($stomach, $whatsit)=@_; + $whatsit->setProperty(excluded=>LookupValue('excluding_modules')); + + my $keys = $whatsit->getArg(1); + my($id, $cd)=$keys + && map(ToString($keys->getValue($_)),qw(id cd)); + #make sure we have an id or give a stub one otherwise: +if (not $id) { +#do magic to get a unique id for this theory +$whatsit->setProperties(beginItemize('theory')); +$id = ToString($whatsit->getProperty('id')); +} + $cd = $id unless $cd; + # update the catalog with paths for modules + my $module_paths = LookupValue('module_paths') || {}; + $module_paths->{$id} = LookupValue('last_module_path'); + AssignValue('module_paths', $module_paths, 'global'); + + #Update the current module position + AssignValue(current_module => $id); + AssignValue(module_cd => $cd) if $cd; + + #activate the module in our current scope + $STATE->activateScope("module:".$id); + + #Activate parent scope, if present + my $parentmod = LookupValue('parent_module'); + use_module($parentmod) if $parentmod; + #Update the current parent module + AssignValue("parent_of_$id"=>$parentmod,'global'); + AssignValue("parent_module" => $id); + return; }, + afterDigest => sub { + #Move a step up on the module ancestry + AssignValue("parent_module" => LookupValue("parent_of_".LookupValue("parent_module"))); + return; + }); +sub use_module { + my($module,%ancestors)=@_; + $module = ToString($module); + if (defined $ancestors{$module}) { + Fatal(":module \"$module\" leads to import cycle!"); + } + $ancestors{$module}=1; + # Depth-first load definitions from used modules, disregarding cycles + foreach my $used_module (@{ LookupValue("module_${module}_uses") || []}){ + use_module($used_module,%ancestors); + } + # then load definitions for this module + $STATE->activateScope("module:$module"); }#$ +DefMacro('\coolurion',sub {AssignValue('cooluri'=>1);}); +DefMacro('\coolurioff',sub {AssignValue('cooluri'=>0);}); +sub omext { + my ($mod)=@_; my $dest=''; + if (ToString($mod)) { + #We need a constellation of abs_path invocations + # to make sure that all symbolic links get resolved + my ($d,$f,$t) = pathname_split(abs_path(ToString($mod))); + $d = pathname_relative(abs_path($d),abs_path(cwd())); + $dest=$d."/".$f; + } + $dest.=".omdoc" if (ToString($mod) && !LookupValue('cooluri')); + return Tokenize($dest);} +sub importmoduleI { + my($stomach,$whatsit)=@_; + my $file = $whatsit->getArg(1); + my $omdocmod = $file.".omdoc" if $file; + my $module = $whatsit->getArg(2); + $module = ToString($module); + my $containing_module = LookupValue('current_module'); + #set the relation between the current module and the one to be imported + PushValue("module_".$containing_module."_uses"=>$module) if $containing_module; + #check if we've already loaded this module file or no file path given + if((!$file) || (LookupValue('file_'.$module.'_loaded'))) {use_module($module);} #if so activate it! + else { + #if not: + my $gullet = $stomach->getGullet; + #1) mark as loaded + AssignValue('file_'.$module.'_loaded' => 1, 'global'); + #open a group for its definitions so that they are localized + $stomach->bgroup; + #update the last module path + AssignValue('last_module_path', $file); + #queue the closing tag for this module in the gullet where it will be executed + #after all other definitions of the imported module have been taken care of + $gullet->unread(Invocation(T_CS('\end@requiredmodule'), T_OTHER($module))->unlist); + #we only need to load the sms definitions without generating any xml output, so we set the flag to 1 + AssignValue('excluding_modules' => 1); + #queue this module's sms file in the gullet so that its definitions are imported + $gullet->input($file,['sms']); + } + return;} +DefConstructor('\importmodule OptionalSemiverbatim {}', + "<omdoc:imports from='?#1(&omext(#1))\##2'/>", + afterDigest=>sub{ importmoduleI(@_)}); +DefConstructor('\importOMDocmodule OptionalSemiverbatim {}{}',"<omdoc:imports from='#3\##2'/>", +afterDigest=>sub{ + #Same as \importmodule, just switch second and third argument. + my ($stomach,$whatsit) = @_; + my $path = $whatsit->getArg(1); + my $ouri = $whatsit->getArg(2); + my $module = $whatsit->getArg(3); + $whatsit->setArgs(($path, $module,$ouri)); + importmoduleI($stomach,$whatsit); + return; +}); +DefConstructor('\metalanguage OptionalSemiverbatim {}', + "<omdoc:imports type='metalanguage' from='?#1(&omext(#1))\##2'/>", + afterDigest=>sub{ importmoduleI(@_)}); +DefMacro('\DefMathOp OptionalKeyVals:symdef {}', + sub { + my($self,$keyval,$pres)=@_; + my $name = KeyVal($keyval,'name') if $keyval; + #Rewrite this token + my $scopes = $STATE->getActiveScopes; + DefMathRewrite(active=>$scopes,xpath=>'descendant-or-self::ltx:XMath',match=>ToString($pres),replace=>"\\".ToString($name)); + #Invoke symdef + (Invocation(T_CS('\symdef'),$keyval,$name,undef,undef,$pres)->unlist); + }); +DefMacro('\symdef OptionalKeyVals:symdef {}[][]{}', + sub { + my($self,@args)=@_; + ((Invocation(T_CS('\@symdef'),@args)->unlist), + (LookupValue('excluding_modules') ? () + : (Invocation(T_CS('\@symdef@pres'), @args)->unlist))); }); + +#Current list of recognized formatter command sequences: +our @PresFormatters = qw (infix prefix postfix assoc mixfixi mixfixa mixfixii mixfixia mixfixai mixfixaii mixfixiii); +DefPrimitive('\@symdef OptionalKeyVals:symdef {}[][]{}', sub { + my($stomach,$keys,$cs,$nargs,$opt,$presentation)=@_; + my($name,$cd,$role,$bvars,$bvar)=$keys + && map($_ && $_->toString,map($keys->getValue($_), qw(name cd role + bvars bvar))); + $cd = LookupValue('module_cd') unless $cd; + $name = $cs unless $name; + #Store for later lookup + AssignValue("symdef.".ToString($cs).".cd"=>ToString($cd),'global'); + AssignValue("symdef.".ToString($cs).".name"=>ToString($name),'global'); + $nargs = (ref $nargs ? $nargs->toString : $nargs || 0); + my $module = LookupValue('current_module'); + my $scope = (($keys && ($keys->getValue('local') || '' eq 'true')) ? 'module_local' : 'module').":".$module; + + #The DefConstructorI Factory is responsible for creating the \symbol command sequences as dictated by the \symdef + DefConstructorI("\\".$cs->toString,convertLaTeXArgs($nargs,$opt), sub { + my ($document,@args) = @_; + my @props = @args; + my $localpres = $presentation; + @args = splice(@props,0,$nargs); + my %prs = @props; + $prs{isbound} = "BINDER" if ($bvars || $bvar); + my $wrapped; + my $parent=$document->getNode; + if(! defined $parent->lookupNamespacePrefix("http://omdoc.org/ns")){ # namespace not already declared? + $document->getDocument->documentElement->setNamespace("http://omdoc.org/ns","omdoc",0); } + my $symdef_scope=$parent->exists('ancestor::omdoc:rendering'); #Are we in a \symdef rendering? + if (($localpres =~/^LaTeXML::Token/) && $symdef_scope) { + #Note: We should probably ask Bruce whether this maneuver makes sense + # We jump back to digestion, at a processing stage where it has been already completed + # Hence need to reinitialize all scopes and make a new group. This is probably expensive to do. + + my @toks = $localpres->unlist; + while(@toks && $toks[0]->equals(T_SPACE)){ shift(@toks); } # Remove leading space + my $formatters = join("|",@PresFormatters); + $formatters = qr/$formatters/; + $wrapped = (@toks && ($toks[0]->toString =~ /^\\($formatters)$/)); + $localpres = Invocation(T_CS('\@use'),$localpres) unless $wrapped; + # Plug in the provided arguments, doing a nasty reversion: + my @sargs = map (Tokens($_->revert), @args); + $localpres = Tokens(LaTeXML::Expandable::substituteTokens($localpres,@sargs)) if $nargs>0; + #Digest: + my $stomach = $STATE->getStomach; + $stomach->beginMode('inline-math'); + $STATE->activateScope($scope); + use_module($module); + use_module(LookupValue("parent_of_".$module)) if LookupValue("parent_of_".$module); + $localpres=$stomach->digest($localpres); + $stomach->endMode('inline-math'); + } + else { #Some are already digested to Whatsit, usually when dropped from a wrapping constructor + } + if ($nargs == 0) { + if (!$symdef_scope) { #Simple case - discourse flow, only a single XMTok + #Referencing XMTok when not in \symdefs: + $document->insertElement('ltx:XMTok',undef,(name=>$cs->toString, meaning=>$name,omcd=>$cd,role => $role,scriptpos=>$prs{'scriptpos'})); + } + else { + if ($symdef_scope && ($localpres =~/^LaTeXML::Whatsit/) && (!$wrapped)) {#1. Simple case: converts to a single token + $localpres->setProperties((name=>$cs->toString, meaning=>$name,omcd=>$cd,role => $role,scriptpos=>$prs{'scriptpos'})); + } + else { + #Experimental treatment - COMPLEXTOKEN + #$role=$role||'COMPLEXTOKEN'; + #$document->openElement('ltx:XMApp',role=>'COMPLEXTOKEN'); + #$document->insertElement('ltx:XMTok',undef,(name=>$cs->toString, meaning=>$name, omcd=>$cd, role=>$role, scriptpos=>$prs{'scriptpos'})); + #$document->openElement('ltx:XMWrap'); + #$document->absorb($localpres); + #$document->closeElement('ltx:XMWrap'); + #$document->closeElement('ltx:XMApp'); + } + #We need expanded presentation when invoked in \symdef scope: + + #Suppress errors from rendering attributes when absorbing. + #This is bad style, but we have no way around it due to the digestion acrobatics. + my $verbosity = $LaTeXML::Global::STATE->lookupValue('VERBOSITY'); + my $errors = $LaTeXML::Global::STATE->getStatus('error'); + $LaTeXML::Global::STATE->assignValue('VERBOSITY',-5); + + #Absorb presentation: + $document->absorb($localpres); + + #Return to original verbosity and error state: + $LaTeXML::Global::STATE->assignValue('VERBOSITY',$verbosity); + $LaTeXML::Global::STATE->setStatus('error',$errors); + + #Strip all/any <rendering><Math><XMath> wrappers: + #TODO: Ugly LibXML work, possibly do something smarter + my $parent = $document->getNode; + my @renderings=$parent->findnodes(".//omdoc:rendering"); + foreach my $render(@renderings) { + my $content=$render; + while ($content && $content->localname =~/^rendering|[X]?Math/) { + $content = $content->firstChild; + } + my $sibling = $content->parentNode->lastChild; + my $localp = $render->parentNode; + while ((defined $sibling) && (!$sibling->isSameNode($content))) { + my $clone = $sibling->cloneNode(1); + $localp->insertAfter($clone,$render); + $sibling = $sibling->previousSibling; + } + $render->replaceNode($content); + } + } + } + else {#2. Constructors with arguments + if (!$symdef_scope) { #2.1 Simple case, outside of \symdef declarations: + #Referencing XMTok when not in \symdefs: + $document->openElement('ltx:XMApp',scriptpos=>$prs{'scriptpos'},role=>$prs{'isbound'}); + $document->insertElement('ltx:XMTok',undef,(name=>$cs->toString, meaning=>$name, omcd=>$cd, role=>$role, scriptpos=>$prs{'operator_scriptpos'})); + foreach my $carg (@args) { + if ($carg =~/^LaTeXML::Token/) { + my $stomach = $STATE->getStomach; + $stomach->beginMode('inline-math'); + $carg=$stomach->digest($carg); + $stomach->endMode('inline-math'); + } + $document->openElement('ltx:XMArg'); + $document->absorb($carg); + $document->closeElement('ltx:XMArg'); + } + $document->closeElement('ltx:XMApp'); + } + else { #2.2 Complex case, inside a \symdef declaration + #We need expanded presentation when invoked in \symdef scope: + + #Suppress errors from rendering attributes when absorbing. + #This is bad style, but we have no way around it due to the digestion acrobatics. + my $verbosity = $LaTeXML::Global::STATE->lookupValue('VERBOSITY'); + my $errors = $LaTeXML::Global::STATE->getStatus('error'); + $LaTeXML::Global::STATE->assignValue('VERBOSITY',-5); + + #Absorb presentation: + $document->absorb($localpres); + + #Return to original verbosity and error state: + $LaTeXML::Global::STATE->assignValue('VERBOSITY',$verbosity); + $LaTeXML::Global::STATE->setStatus('error',$errors); + + #Strip all/any <rendering><Math><XMath> wrappers: + #TODO: Ugly LibXML work, possibly do something smarter? + my $parent = $document->getNode; + if(! defined $parent->lookupNamespacePrefix("http://omdoc.org/ns")){ # namespace not already declared? + $document->getDocument->documentElement->setNamespace("http://omdoc.org/ns","omdoc",0); } + my @renderings=$parent->findnodes(".//omdoc:rendering"); + foreach my $render(@renderings) { + my $content=$render; + while ($content && $content->localname =~/^rendering|[X]?Math/) { + $content = $content->firstChild; + } + my $sibling = $content->parentNode->lastChild; + my $localp = $render->parentNode; + while ((defined $sibling) && (!$sibling->isSameNode($content))) { + my $clone = $sibling->cloneNode(1); + $localp->insertAfter($clone,$render); + $sibling = $sibling->previousSibling; + } + $render->replaceNode($content); + } + } + }}, + properties => {name=>$cs->toString, meaning=>$name,omcd=>$cd,role => $role}, + scope=>$scope); + return; }); +DefPrimitive('\abbrdef OptionalKeyVals:symdef {}[][]{}', sub { + my($stomach,$keys,$cs,$nargs,$opt,$presentation)=@_; + my $module = LookupValue('current_module'); + my $scope = (($keys && ($keys->getValue('local') || '' eq 'true')) ? 'module_local' : 'module').":$module"; + DefMacroI("\\".$cs->toString,convertLaTeXArgs($nargs,$opt),$presentation, + scope=>$scope); + return; }); +DefMacro('\defpath{}{}', sub { + my ($gullet,$arg1,$arg2)=@_; + $arg1 = ToString($arg1); + $arg2 = ToString($arg2); + my $paths = LookupValue('defpath')||{}; + $$paths{"$arg1"}=$arg2; + AssignValue('defpath'=>$paths,'global'); + DefMacro('\\'.$arg1.' {}',$arg2."/#1"); + });#$ +DefPrimitive('\requiremodules{}', sub { + my($stomach,$module)=@_; + my $GULLET = $stomach->getGullet; + $module = Digest($module)->toString; + if(LookupValue('file_'.$module.'_loaded')) {} + else { + AssignValue('file_'.$module.'_loaded' => 1, 'global'); + $stomach->bgroup; + AssignValue('last_module_path', $module); + $GULLET->unread(T_CS('\end@requiredmodule')); + AssignValue('excluding_modules' => 1); + $GULLET->input($module,['sms']); + } + return;}); + +DefPrimitive('\end@requiredmodule{}',sub { + #close the group + $_[0]->egroup; + #print STDERR "END: ".ToString(Digest($_[1])->toString); + #Take care of any imported elements in this current module by activating it and all its dependencies + #print STDERR "Important: ".ToString(Digest($_[1])->toString)."\n"; + use_module(ToString(Digest($_[1])->toString)); + return; });#$ +DefPrimitive('\sinput Semiverbatim', sub { + my($stomach,$module)=@_; + my $GULLET = $stomach->getGullet; + $module = Digest($module)->toString; + AssignValue('file_'.$module.'_loaded' => 1, 'global'); + $stomach->bgroup; + AssignValue('last_module_path', $module); + $GULLET->unread(Invocation(T_CS('\end@requiredmodule'),T_OTHER($module))->unlist); + $GULLET->input($module,['tex']); + return;});#$ +DefConstructor('\sinputref{}',"<omdoc:ref xref='#1.omdoc' type='include'/>"); +DefMacro('\@symdef@pres OptionalKeyVals:symdef {}[][]{}', sub { + my($self,$keys, $cs,$nargs,$opt,$presentation)=@_; + + my($name,$cd,$role)=$keys + && map($_ && $_->toString,map($keys->getValue($_), qw(name cd role))); + $cd = LookupValue('module_cd') unless $cd; + $name = $cs unless $name; + AssignValue('module_name'=>$name) if $name; + $nargs = 0 unless ($nargs); + my $nargkey = ToString($name).'_args'; + AssignValue($nargkey=>ToString($nargs)) if $nargs; + $name=ToString($name); + + Invocation(T_CS('\@symdef@pres@aux'), + $cs, + ($nargs || Tokens(T_OTHER(0))), + symdef_presentation_pmml($cs,ToString($nargs)||0,$presentation), +# symdef_presentation_TeX($presentation), + (Tokens(T_OTHER($name))), + (Tokens(T_OTHER($cd))), + $keys)->unlist; });#$ +sub symdef_presentation_pmml { + my($cs,$nargs,$presentation)=@_; + my @toks = $presentation->unlist; + while(@toks && $toks[0]->equals(T_SPACE)){ shift(@toks); } # Remove leading space + $presentation = Tokens(@toks); + # Wrap with \@use, unless already has a recognized formatter. + my $formatters = join("|",@PresFormatters); + $formatters = qr/$formatters/; + $presentation = Invocation(T_CS('\@use'),$presentation) + unless (@toks && ($toks[0]->toString =~ /^\\($formatters)$/)); + # Low level substitution. + my @args = map(Invocation(T_CS('\@SYMBOL'),T_OTHER("arg:".($_))),1..$nargs); + $presentation = Tokens(LaTeXML::Expandable::substituteTokens($presentation,@args)); + $presentation; }#$ +sub getSymmdefProperties { + my $cd = LookupValue('module_cd'); + my $name = LookupValue('module_name'); + my $nargkey = ToString($name).'_args'; + my $nargs = LookupValue($nargkey); + $nargs = 0 unless ($nargs); + my %props = ('cd'=>$cd,'name'=>$name,'nargs'=>$nargs); + return %props;} +DefConstructor('\@use{}', sub{ + my ($document,$args,%properties) = @_; + #Notation created at \@symdef@pres@aux + #Create the rendering: + $document->openElement('omdoc:rendering'); + $document->openElement('ltx:Math'); + $document->openElement('ltx:XMath'); + if ($args->isMath) {$document->absorb($args);} + else { $document->insertElement('ltx:XMText',$args);} + $document->closeElement('ltx:XMath'); + $document->closeElement('ltx:Math'); + $document->closeElement('omdoc:rendering'); +}, +properties=>sub { getSymmdefProperties($_[1]);}, + mode=>'inline_math'); +sub get_cd { + my($name,$cd,$role)=@_; + return $cd;} +DefConstructor('\@symdef@pres@aux{}{}{}{}{} OptionalKeyVals:symdef', sub { + my ($document,$cs,$nargs,$pmml,$name,$cd,$keys)=@_; + my $assocarg = ToString($keys->getValue('assocarg')) if $keys; + $assocarg = $assocarg||"0"; + my $bvars = ToString($keys->getValue('bvars')) if $keys; + $bvars = $bvars||"0"; + my $bvar = ToString($keys->getValue('bvar')) if $keys; + $bvar = $bvar||"0"; + my $appElement = 'om:OMA'; $appElement = 'om:OMBIND' if ($bvars || $bvar); + + $document->insertElement("omdoc:symbol",undef,(name=>$cs,"xml:id"=>ToString($cs).".sym")); + $document->openElement("omdoc:notation",(name=>$name,cd=>$cd)); + #First, generate prototype: + $nargs = ToString($nargs)||0; + $document->openElement('omdoc:prototype'); + $document->openElement($appElement) if $nargs; + my $cr="fun" if $nargs; + $document->insertElement('om:OMS',undef, + (cd=>$cd, + name=>$name, + "cr"=>$cr)); + if ($bvar || $bvars) { + $document->openElement('om:OMBVAR'); + if ($bvar) { + $document->insertElement('omdoc:expr',undef,(name=>"arg$bvar")); + } else { + $document->openElement('omdoc:exprlist',(name=>"args")); + $document->insertElement('omdoc:expr',undef,(name=>"arg")); + $document->closeElement('omdoc:exprlist'); + } + $document->closeElement('om:OMBVAR'); + } + for my $id(1..$nargs) { + next if ($id==$bvars || $id==$bvar); + if ($id!=$assocarg) { + my $argname="arg$id"; + $document->insertElement('omdoc:expr',undef,(name=>"$argname")); + } + else { + $document->openElement('omdoc:exprlist',(name=>"args")); + $document->insertElement('omdoc:expr',undef,(name=>"arg")); + $document->closeElement('omdoc:exprlist'); + } + } + $document->closeElement($appElement) if $nargs; + $document->closeElement('omdoc:prototype'); + #Next, absorb rendering: + $document->absorb($pmml); + $document->closeElement("omdoc:notation"); + }, afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $keys = $whatsit->getArg(6); + my $module = LookupValue('current_module'); + $whatsit->setProperties(for=>ToString($whatsit->getArg(1))); + $whatsit->setProperty(role=>($keys ? $keys->getValue('role') + : (ToString($whatsit->getArg(2)) ? 'applied' + : undef))); }); +sub symdef_presentation_TeX { + my($presentation)=@_; + my @tokens = $presentation->unlist; + my(@frag,@frags) = (); + while(my $tok = shift(@tokens)){ + if($tok->equals(T_PARAM)){ + push(@frags,Invocation(T_CS('\@symdef@pres@text'),Tokens(@frag))) if @frag; + @frag=(); + my $n = shift(@tokens)->getString; + push(@frags,Invocation(T_CS('\@symdef@pres@arg'),T_OTHER($n+1))); } + else { + push(@frag,T_OTHER($tok->getString)); }} # IMPORTANT! Neutralize the tokens! + push(@frags,Invocation(T_CS('\@symdef@pres@text'),Tokens(@frag))) if @frag; + Tokens(map($_->unlist,@frags)); } +DefConstructor('\@symdef@pres@arg{}', "<omdoc:recurse select='#select'/>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $select = $whatsit->getArg(1); + $select = ref $select ? $select->toString : ''; + $whatsit->setProperty(select=>"*[".$select."]"); }); +DefConstructor('\@symdef@pres@text{}', "<omdoc:text>#1</omdoc:text>"); +DefConstructor('\requirepackage{} Semiverbatim',"<omdoc:imports from='#2'/>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $select = $whatsit->getArg(1); + RequirePackage($select->toString); });#$ +Tag('omdoc:recurse',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:imports',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:theory',afterOpen=>\&numberIt,afterClose=>\&locateIt); +1; diff --git a/Master/texmf-dist/tex/latex/stex/omd/omd.sty b/Master/texmf-dist/tex/latex/stex/omd/omd.sty new file mode 100644 index 00000000000..b3d8301d2e3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omd/omd.sty @@ -0,0 +1,27 @@ +%% +%% This is file `omd.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% omd.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{omd}[2010/06/25 v0.9 OMDoc Metadata Framework] +\RequirePackage{keyval}[1997/11/10] +\newcommand\omdaddkey[3][]{\omd@ext@clear@keys{#2}{#3}{#1}% +\define@key{#2}{#3}[#1]{\expandafter\gdef\csname #2@#3\endcsname{##1}}} +\newcommand\omdsetkeys[2]{\csname clear@#1@keys\endcsname\setkeys{#1}{#2}} +\newcommand\omd@ext@clear@keys[3]{\@omd@ext@clear@keys{#1}{#1@#2}{#3}} +\newcommand\@omd@ext@clear@keys[3]{\@ifundefined{clear@#1@keys}% +{\expandafter\def\csname clear@#1@keys\endcsname% +{\expandafter\gdef\csname #2\endcsname{#3}}}% +{\expandafter\g@addto@macro\csname clear@#1@keys\endcsname% +{\expandafter\gdef\csname #2\endcsname{#3}}}} +\newcommand\omdaddkeynew[3][]{\omd@ext@clear@keys{#2}{#3}{#1}% +\define@key{#2}{#3}{\expandafter\gdef\csname #2@#3\endcsname{##1}}} +\newcommand\omd@unspecified{an omd-defined key left unspecified} +\newcommand\omdifus[4]{\message{testing #1@#2=\csname#1@#2\endcsname}\expandafter\ifx\csname #1@#2\endcsname\omd@unspecified{#3}\else{#4}\fi} +\endinput +%% +%% End of file `omd.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/omd/omd.sty.ltxml b/Master/texmf-dist/tex/latex/stex/omd/omd.sty.ltxml new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omd/omd.sty.ltxml diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls new file mode 100644 index 00000000000..de669642d66 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls @@ -0,0 +1,26 @@ +%% +%% This is file `omdoc.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% omdoc.dtx (with options: `cls') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesClass{omdoc}[2010/06/25 v1.0 OMDoc Documents] +\def\omdoc@class{article} +\DeclareOption{report}{\def\omdoc@class{report}\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{book}{\def\omdoc@class{book}\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{chapter}{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{part}{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{showignores}{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{extrefs}{\PassOptionsToPackage{\CurrentOption}{sref}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ProcessOptions +\LoadClass{\omdoc@class} +\RequirePackage{omdoc} +\let\orig@document=\document +\renewcommand{\document}[1][]{\orig@document} +\endinput +%% +%% End of file `omdoc.cls'. diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml new file mode 100644 index 00000000000..866a6339f5b --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml @@ -0,0 +1,53 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use LaTeXML::Util::Pathname; +use Cwd qw(cwd abs_path); +DeclareOption('report',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('book',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('chapter',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('part',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('showignores',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('extrefs',sub {PassOptions('sref','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption(undef,sub {PassOptions('article','cls',ToString(Digest(T_CS('\CurrentOption')))); }); +ProcessOptions(); +LoadClass('article'); +RequirePackage('sref'); +RegisterNamespace('omdoc'=>"http://omdoc.org/ns"); +RegisterNamespace('om'=>"http://www.openmath.org/OpenMath"); +RegisterNamespace('m'=>"http://www.w3.org/1998/Math/MathML"); +RegisterNamespace('dc'=>"http://purl.org/dc/elements/1.1/"); +RegisterNamespace('cc'=>"http://creativecommons.org/ns"); +RegisterNamespace('stex'=>"http://kwarc.info/ns/sTeX"); +RegisterNamespace('ltx'=>"http://dlmf.nist.gov/LaTeXML"); +RelaxNGSchema('omdoc+ltxml', + '#default'=>"http://omdoc.org/ns", + 'om'=>"http://www.openmath.org/OpenMath", + 'm'=>"http://www.w3.org/1998/Math/MathML", + 'dc'=>"http://purl.org/dc/elements/1.1/", + 'cc'=>"http://creativecommons.org/ns", + 'ltx'=>"http://dlmf.nist.gov/LaTeXML", + 'stex'=>"http://kwarc.info/ns/sTeX"); +RequirePackage('omdoc'); +sub xmlBase { + my $baseuri = LookupValue('baseuri'); + my $baselocal = LookupValue('baselocal'); + my $cdir = abs_path(cwd()); + $cdir =~ s/^$baselocal//; + my ($d,$f,$t) = pathname_split(LookupValue('SOURCEFILE')); + $t = '' if LookupValue('cooluri'); + Tokenize($baseuri.$cdir.'/'.$f.$t); } +DefEnvironment('{document} OptionalKeyVals:omdoc', + "<omdoc:omdoc " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')" + . "(?&Tokenize(&LookupValue('SOURCEBASE'))" + . "(xml:id='&Tokenize(&LookupValue('SOURCEBASE')).omdoc')()) " + . "?&Tokenize(&LookupValue('baseuri'))" + . "(xml:base='&xmlBase()')() " + . "?#locator(stex:srcref='#locator')()>" + . "#body" + ."</omdoc:omdoc>", + beforeDigest=> sub { AssignValue(inPreamble=>0); }, + afterDigest=> sub { $_[0]->getGullet->flush; return; }); +1; diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty new file mode 100644 index 00000000000..f0ead1392bd --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty @@ -0,0 +1,70 @@ +%% +%% This is file `omdoc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% omdoc.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{omdoc}[2010/06/25 v1.0 OMDoc document Structure] +\newif\if@chapter\@chapterfalse +\newif\if@part\@partfalse +\newcount\section@level\section@level=3 +\newif\ifshow@ignores\show@ignoresfalse +\def\omdoc@class{article} +\DeclareOption{report}{\def\omdoc@class{report}\section@level=2} +\DeclareOption{book}{\def\omdoc@class{book}\section@level=1} +\DeclareOption{chapter}{\section@level=2\@chaptertrue} +\DeclareOption{part}{\section@level=1\@chaptertrue\@parttrue} +\DeclareOption{showignores}{\show@ignorestrue} +\DeclareOption{extrefs}{\PassOptionsToPackage{\CurrentOption}{sref}} +\ProcessOptions +\RequirePackage{sref} +\RequirePackage{comment} +\srefaddidkey{omgroup} +\omdaddkey{omgroup}{creators} +\omdaddkey{omgroup}{contributors} +\omdaddkey{omgroup}{type} +\omdaddkey{omgroup}{short} +\omdaddkey{omgroup}{display} +\newenvironment{omgroup}[2][]% title +{\bgroup\omdsetkeys{omgroup}{#1}\sref@target +\ifx\omgroup@display\st@flow\noindent{\Large\textbf{#2}\\[.3ex]\noindent\ignorespaces} +\else +\if@part\ifnum\section@level=1\part{#2}\sref@label@id{Part \thepart}\fi\fi +\if@chapter\ifnum\section@level=2\chapter{#2}\sref@label@id{Chapter \thechapter}\fi\fi +\ifnum\section@level=3\section{#2}\sref@label@id{Section \thesection}\fi +\ifnum\section@level=4\subsection{#2}\sref@label@id{Subsection \thesubsection}\fi +\ifnum\section@level=5\subsubsection{#2}\sref@label@id{Subsubsection \thesubsubsection}\fi +\ifnum\section@level=6\paragraph{#2}\sref@label@id{this paragraph}\fi +\ifnum\section@level=7\subparagraph{#2}\sref@label@id{this subparagraph}\fi +\advance\section@level by 1 +\fi}{\egroup} +\ifshow@ignores +\omdaddkey{ignore}{type} +\omdaddkey{ignore}{comment} +\newenvironment{ignore}[1][] +{\omdsetkeys{ignore}{#1}\textless\ignore@type\textgreater\bgroup\itshape} +{\egroup\textless/\ignore@type\textgreater} +\renewenvironment{ignore}{}{}\else\excludecomment{ignore}\fi +\long\def\STRlabel#1#2{\STRlabeldef{#1}{#2}{#2}} +\def\STRcopy#1{\expandafter\ifx\csname STR@#1\endcsname\relax +\message{STR warning: reference #1 undefined!} +\else\csname STR@#1\endcsname\fi} +\newcommand{\STRsemantics}[3][]{#2\def\@test{#1}\ifx\@test\@empty\STRlabeldef{#1}{#2}\fi} +\def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname} +\def\black#1{\textcolor{black}{#1}} +\def\blue#1{\textcolor{blue}{#1}} +\def\red#1{\textcolor{red}{#1}} +\def\green#1{\textcolor{green}{#1}} +\def\cyan#1{\textcolor{cyan}{#1}} +\def\magenta#1{\textcolor{magenta}{#1}} +\def\brown#1{\textcolor{brown}{#1}} +\def\yellow#1{\textcolor{yellow}{#1}} +\def\yellow#1{\textcolor{yellow}{#1}} +\def\orange#1{\textcolor{orange}{#1}} +\newcommand{\baseURI}[2][]{} +\endinput +%% +%% End of file `omdoc.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml new file mode 100644 index 00000000000..181b90aa0d9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml @@ -0,0 +1,109 @@ +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use Cwd qw(cwd abs_path); +DeclareOption('report',''); +DeclareOption('book',''); +DeclareOption('chapter',''); +DeclareOption('part',''); +DeclareOption('showignores',''); +DeclareOption('extrefs',''); +RequirePackage('sref'); +RequirePackage('omtext'); +DefEnvironment('{omgroup} OptionalKeyVals:omgroup {}', + "<omdoc:omgroup layout='sectioning'" + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()" + . "?&KeyVal(#1,'type')(type='&KeyVal(#1,'type')')()>\n" + . "<dc:title ?#locator(stex:srcref='#locator')()>#2</dc:title>\n" + . "#body\n" + . "</omdoc:omgroup>"); +DefParameterType('IfBeginFollows', sub { + my ($gullet) = @_; + $gullet->skipSpaces; + my $next = $gullet->readToken; + $gullet->unread($next); + $next = ToString($next); + #Hm, falling back to regexp handling, the $gullet->ifNext approach didn't work properly + return 1 unless ($next=~/^\\begin/); + return; + }, + reversion=>'', optional=>1);#$ +Let('\group@item@maybe@unwrap','\relax'); +DefMacro('\group@item[] IfBeginFollows', sub { + my($gullet,$tag,$needswrapper)=@_; + ( T_CS('\group@item@maybe@unwrap'), + ($needswrapper ? (Invocation(T_CS('\group@item@wrap'),$tag)->unlist) : ()) ); }); +DefConstructor('\group@item@wrap {}', + "<omdoc:omtext>" + . "?#1(<dc:title>#1</dc:title>)()" + . "<omdoc:CMP><omdoc:p>", + beforeDigest=>sub { + Let('\group@item@maybe@unwrap','\group@item@unwrap'); + #$_[0]->bgroup; + useCMPItemizations(); + return; }, + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\group@item@unwrap', + "", + beforeDigest=>sub { + # $_[0]->egroup;#$ + Let('\group@item@maybe@unwrap','\relax'); }, + beforeConstruct=>sub { + $_[0]->maybeCloseElement('omdoc:p'); + $_[0]->maybeCloseElement('omdoc:CMP'); + $_[0]->maybeCloseElement('omdoc:omtext'); + }); +Let('group@item@maybe@unwrap','\relax'); +Let('\itemize@item'=>'\group@item'); +Let('\enumerate@item'=>'\group@item'); +Let('\description@item'=>'\group@item'); +DefEnvironment('{itemize}', + "<omdoc:omgroup xml:id='#id' layout='itemize'>" + . "#body" + ."</omdoc:omgroup>", + properties=>sub { beginItemize('itemize'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{enumerate}', + "<omdoc:omgroup xml:id='#id' layout='enumerate'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('enumerate'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{description}', + "<omdoc:omgroup xml:id='#id' layout='description'>" + . "#body" + ."</omdoc:omgroup>", + properties=>sub { beginItemize('description'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefKeyVal('ignore','type','Semiverbatim'); +DefKeyVal('ignore','comment','Semiverbatim'); +DefEnvironment('{ignore} OptionalKeyVals:ignore', + "<omdoc:ignore %&KeyVals(#1)>#body</omdoc:ignore>"); +DefConstructor('\STRlabel{}{}', sub { + my($document,$label,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +DefConstructor('\STRcopy{}',"<omdoc:ref xref='##1'/>"); +DefConstructor('\STRsemantics[]{}{}', sub { + my($document,$label,$ignore,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +DefMacro('\STRlabeldef{}{}', ""); +sub omdocColorMacro { + my ($color, @args) = @_; + my $tok_color = TokenizeInternal($color); + (T_BEGIN, T_CS('\@omdoc@color'), T_BEGIN, $tok_color->unlist, + T_END, T_CS('\@omdoc@color@content'), T_OTHER('['), $tok_color->unlist, T_OTHER(']'), + T_BEGIN, $args[1]->unlist, T_END, T_END); } +DefMacro('\@omdoc@color{}', sub { MergeFont(color=>$_[1]->toString); return; });#$ +DefConstructor('\@omdoc@color@content[]{}', + "?#isMath(#2)(<omdoc:phrase ?#1(style='color:#1')()>#2</omdoc:phrase>)"); +foreach my $color(qw(blue red green magenta cyan brown yellow)) { + DefMacro("\\".$color.'{}', sub { omdocColorMacro($color, @_); }); }#$ +DefConstructor('\newpage',''); +Tag('omdoc:ignore',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:ref',afterOpen=>\&numberIt,afterClose=>\&locateIt); +DefMacro('\baseURI []Semiverbatim', sub { + AssignValue('baselocal'=>abs_path(ToString(Expand($_[1])))); + AssignValue('baseuri'=>ToString(Expand($_[2])));}); +DefConstructor('\url Semiverbatim',"<omdoc:link href='#1'>#1</omdoc:link>"); +DefConstructor('\href Semiverbatim {}',"<omdoc:link href='#1'>#2</omdoc:link>"); +1; diff --git a/Master/texmf-dist/tex/latex/stex/omtext/omtext.sty b/Master/texmf-dist/tex/latex/stex/omtext/omtext.sty new file mode 100644 index 00000000000..ccb306c2d0a --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omtext/omtext.sty @@ -0,0 +1,78 @@ +%% +%% This is file `omtext.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% omtext.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{omtext}[2010/06/25 v1.0 OMDoc Text Fragments] +\newif\ifindex\indextrue +\DeclareOption{noindex}{\indexfalse} +\ProcessOptions +\ifindex\makeindex\fi +\RequirePackage{sref} +\RequirePackage{comment} +\srefaddidkey{omtext} +\omdaddkey[]{omtext}{functions} +\omdaddkey{omtext}{display} +\omdaddkey{omtext}{for} +\omdaddkey{omtext}{from} +\omdaddkey{omtext}{type} +\omdaddkey{omtext}{title} +\omdaddkey{omtext}{theory} +\omdaddkey{omtext}{continues} +\omdaddkey{omtext}{verbalizes} +\def\st@flow{flow} +\def\omtext@pre@skip{\smallskip} +\def\omtext@post@skip{} +\providecommand{\stDMemph}[1]{\textbf{#1}} +\newenvironment{omtext}[1][]{\bgroup\omdsetkeys{omtext}{#1}\sref@label@id{this paragraph}% +\def\lec##1{\@lec{##1}} +\ifx\omtext@display\st@flow\else\omtext@pre@skip\par\noindent% +\ifx\omtext@title\@empty\else\stDMemph{\omtext@title}: \fi\fi\ignorespaces} +{\egroup\omtext@post@skip} +\srefaddidkey{phrase} +\omdaddkey{phrase}{style} +\omdaddkey{phrase}{class} +\omdaddkey{phrase}{index} +\omdaddkey{phrase}{verbalizes} +\omdaddkey{phrase}{type} +\newenvironment{phrase}[1][]{\omdsetkeys{phrase}{#1}}{} +\def\nlex#1{\green{\sl{#1}}} +\def\nlcex#1{*\green{\sl{#1}}} +\def\@sinlinequote#1{``{\sl{#1}}''} +\def\@@sinlinequote#1#2{\@sinlinequote{#2}~#1} +\newcommand{\sinlinequote}[2][] +{\def\@opt{#1}\ifx\@opt\@empty\@sinlinequote{#2}\else\@@sinlinequote\@opt{#2}\fi} +\def\begin@sblockquote{\begin{quote}\sl} +\def\end@sblockquote{\end{quote}} +\def\begin@@sblockquote#1{\begin@sblockquote} +\def\end@@sblockquote#1{\def\@@lec##1{{\rm ##1}}\@lec{#1}\end@sblockquote} +\newenvironment{sblockquote}[1][] + {\def\@opt{#1}\ifx\@opt\@empty\begin@sblockquote\else\begin@@sblockquote\@opt\fi} + {\ifx\@opt\@empty\end@sblockquote\else\end@@sblockquote\@opt\fi} +\providecommand{\@@lec}[1]{(#1)} +\def\@lec#1{\strut\hfil\strut\null\nobreak\hfill\hbox{\@@lec{#1}}} +\def\lec#1{\@lec{#1}\par} +\newcommand\mygraphics[2][]{\includegraphics[#1]{#2}} +\newcommand\mycgraphics[2][]{\begin{center}\includegraphics[#1]{#2}\end{center}} +\newcommand\mybgraphics[2][]{\fbox{\includegraphics[#1]{#2}\end{center}}} +\newcommand{\omdoc@index}[2][]{\def\@test{#1}% +\ifindex\ifx\@test\@empty\index{#2}\else\index{#1@#2}\fi\fi} +\newcommand{\indexalt}[3][]{{#2}\omdoc@index[#1]{#3}} % word in text and index +\newcommand{\indextoo}[2][]{{#2}\omdoc@index[#1]{#2}} % word in text and index +\newcommand{\@twin}[3][]{\def\@test{#1}% +\ifindex\ifx\@test\@empty\index{#2!#3}\else\index{#1@#2!#3}\fi\index{#3!#2}\fi} +\newcommand{\twinalt}[4][]{#2\@twin[#1]{#3}{#4}} +\newcommand{\twintoo}[3][]{{#2 #3}\@twin[#1]{#2}{#3}} % and use the word compound too +\newcommand{\@atwin}[4][]{\def\@test{#1}% +\ifindex\ifx\@test\@empty\index{#2!#3!#4}\else\index{#1@#2!#3!#4}\fi\index{#3!#2 (#1)}\fi} +\newcommand{\atwinalt}[5][]{#2\@atwin[#1]{#3}{#4}{#4}} +\newcommand{\atwintoo}[4][]{{#2 #3 #4}\@atwin[#1]{#2}{#3}{#4}} % and use it too +\def\printindex{\IfFileExists{\jobname.ind}{\input{\jobname.ind}}{}} +\def\omspace#1{\hspace*{#1}} +\endinput +%% +%% End of file `omtext.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/omtext/omtext.sty.ltxml b/Master/texmf-dist/tex/latex/stex/omtext/omtext.sty.ltxml new file mode 100644 index 00000000000..b29c789eafd --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omtext/omtext.sty.ltxml @@ -0,0 +1,266 @@ +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use Cwd qw(cwd abs_path); +DeclareOption('noindex',''); +RequirePackage('sref'); +Tag('omdoc:metadata',afterOpen=>\&numberIt,afterClose=>\&locateIt,autoClose=>1,autoOpen=>1); +DefConstructor('\CMP@itemize@item[]', + "<omdoc:li>?#1(<dc:title ?#locator(stex:srcref='#locator')()>#1</dc:title>)()", + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\CMP@enumerate@item[]', + "<omdoc:li>?#1(<dc:title ?#locator(stex:srcref='#locator')()>#1</dc:title>)()", + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\CMP@description@item[]', + "<omdoc:di>" + . "?#1(<omdoc:dt>#1</omdoc:dt>)()<omdoc:dd>", # trust di and dt to autoclose + properties=>sub{ RefStepItemCounter(); }); +DefEnvironment('{CMP@itemize}', + "<omdoc:ul>#body</omdoc:ul>", + properties=>sub { beginItemize('CMP@itemize'); }, + beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{CMP@itemize}')); }); +DefEnvironment('{CMP@enumerate}', + "<omdoc:ol xml:id='#id'>#body</omdoc:ol>", + properties=>sub { beginItemize('CMP@enumerate'); }, + beforeDigest=>sub { Let(T_CS('\end{enumerate}') =>T_CS('\end{CMP@enumerate}')); }); +DefEnvironment('{CMP@description}', + "<omdoc:dl xml:id='#id'>#body</omdoc:dl>", + properties=>sub { beginItemize('CMP@description'); }, + beforeDigest=>sub { Let(T_CS('\end{description}') =>T_CS('\end{CMP@description}'));}); +sub useCMPItemizations { + Let(T_CS('\begin{itemize}') =>T_CS('\begin{CMP@itemize}')); + Let(T_CS('\begin{enumerate}') =>T_CS('\begin{CMP@enumerate}')); + Let(T_CS('\begin{description}')=>T_CS('\begin{CMP@description}')); + return; } +sub declareFunctions{ + my ($stomach,$whatsit) = @_; + my $keyval = $whatsit->getArg(1); + my $funval = KeyVal($keyval,'functions') if KeyVal($keyval,'functions'); + my @funsymbs = ParseKeyValList($funval); + #Unread the function declarations at the Gullet + foreach (@funsymbs) { + $stomach->getGullet->unread(Tokenize('\lxDeclare[role=FUNCTION]{$'.$_.'$}')->unlist); + } + return; +} +Tag('omdoc:CMP', afterOpen => sub {AssignValue('_LastSeenCMP', $_[1], 'global');return;});#$ +Tag('omdoc:li', autoClose=>1); +Tag('omdoc:dd', autoClose=>1); +Tag('omdoc:di', autoClose=>1); +DefKeyVal('omtext','functions','Semiverbatim'); +DefKeyVal('omtext','display','Semiverbatim'); +DefKeyVal('omtext','for','Semiverbatim'); +DefKeyVal('omtext','from','Semiverbatim'); +DefKeyVal('omtext','type','Semiverbatim'); +DefKeyVal('omtext','title','Plain'); #Math mode in titles. +DefKeyVal('omtext','theory','Semiverbatim'); +DefKeyVal('omtext','continues','Semiverbatim'); +DefKeyVal('omtext','verbalizes','Semiverbatim'); +DefCMPEnvironment('{omtext} OptionalKeyVals:omtext', + "<omdoc:omtext " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "?&KeyVal(#1,'type')(type='&KeyVal(#1,'type')')() " + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')() " + . "?&KeyVal(#1,'from')(from='&KeyVal(#1,'from')')()>" + . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()" + . "<omdoc:CMP>" + . "<omdoc:p>" + . "#body"); +sub DefCMPEnvironment { + my ($proto, $replacement, %options) = @_; + my @before = $options{beforeDigest} ? ($options{beforeDigest}) : (); + push(@before, \&useCMPItemizations); + $options{beforeDigest} = \@before; + my @after = $options{afterDigestBegin} ? ($options{afterDigestBegin}) : (); + push(@after, \&declareFunctions); + $options{afterDigestBegin} = \@after; + DefEnvironment($proto, $replacement, %options); +} +sub DefCMPConstructor { + my ($proto, $replacement, %options) = @_; + my @before = $options{beforeDigest} ? ($options{beforeDigest}) : (); + push(@before, \&useCMPItemizations); + $options{beforeDigest} = \@before; + DefConstructor($proto, $replacement, %options); +} +DefKeyVal('phrase','id','Semiverbatim'); +DefKeyVal('phrase','style','Semiverbatim'); +DefKeyVal('phrase','class','Semiverbatim'); +DefKeyVal('phrase','index','Semiverbatim'); +DefKeyVal('phrase','verbalizes','Semiverbatim'); +DefKeyVal('phrase','type','Semiverbatim'); +DefConstructor('\phrase OptionalKeyVals:phrase {}', + "<omdoc:phrase %&KeyVals(#1)>#2</omdoc:phrase>"); +DefConstructor('\nlex{}', + "<omdoc:phrase type='nlex'>#1</omdoc:phrase>"); +DefConstructor('\nlcex{}', + "<omdoc:phrase type='nlcex'>#1</omdoc:phrase>"); +DefConstructor('\sinlinequote [] {}', + "<omdoc:phrase type='inlinequote'>" + . "?#1(<dc:source ?#locator(stex:srcref='#locator')()>#1</dc:source>\n)()" + . "#2" + . "</omdoc:phrase>"); +DefEnvironment('{sblockquote} []', + "<omdoc:omgroup type='quote'" + . "?#1(<dc:source>#1</dc:source>\n)()" + . "#body" + . "</omdoc:omgroup>"); +DefConstructor('\lec{}', + "\n<omdoc:note type='line-end-comment'>#1</omdoc:note>"); +RawTeX(' +\newcommand\mygraphics[2][]{\includegraphics[#1]{#2}} +\newcommand\mycgraphics[2][]{\begin{center}\includegraphics[#1]{#2}\end{center}} +\newcommand\mybgraphics[2][]{\fbox{\includegraphics[#1]{#2}\end{center}}} +'); +DefConstructor('\indextoo[]{}', + "<omdoc:idx>" + . "<omdoc:idt>#2</omdoc:idt>" + . "<omdoc:ide ?#1(sort-by='#1')()>" + . "<omdoc:idp>#2</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>"); +DefConstructor('\indexalt[]{}{}', + "<omdoc:idx>" + . "<omdoc:idt>#2</omdoc:idt>" + . "<omdoc:ide ?#1(sort-by='#1')()>" + . "<omdoc:idp>#3</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>"); +DefConstructor('\twintoo[]{}{}', + "<omdoc:idx>" + . "<omdoc:idt>#2 #3</omdoc:idt>" + . "<omdoc:ide ?#1(sort-by='#1')()>" + . "<omdoc:idp>#2</omdoc:idp>" + . "<omdoc:idp>#3</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>"); +DefConstructor('\twinalt[]{}{}{}', + "<omdoc:idx>" + . "<omdoc:idt>#2</omdoc:idt>" + . "<omdoc:ide ?#1(sort-by='#1')()>" + . "<omdoc:idp>#2</omdoc:idp>" + . "<omdoc:idp>#3</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>"); +DefConstructor('\atwintoo[]{}{}{}', + "<omdoc:idx>" + . "<omdoc:idt>#2 #3</omdoc:idt>" + . "<omdoc:ide ?#1(sort-by='#1')()>" + . "<omdoc:idp>#2</omdoc:idp>" + . "<omdoc:idp>#3</omdoc:idp>" + . "<omdoc:idp>#4</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>"); + +DefConstructor('\atwinalt[]{}{}{}{}', + "<omdoc:idx>" + . "<omdoc:idt>#2</omdoc:idt>" + . "<omdoc:ide ?#1(sort-by='#1')()>" + . "<omdoc:idp>#2</omdoc:idp>" + . "<omdoc:idp>#3</omdoc:idp>" + . "<omdoc:idp>#4</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>"); +DefConstructor('\printindex','<omdoc:index/>'); +DefConstructor('\par',sub { $_[0]->maybeCloseElement('omdoc:p'); }, + alias=>"\\par\n"); +Tag('omdoc:p', autoClose=>1, autoOpen=>1); +Tag('omdoc:CMP', autoClose=>1, autoOpen=>1); +Tag('omdoc:omtext', autoClose=>1, autoOpen=>1); +DefConstructor('\omspace{}',''); +DefConstructor('\emph{}',"<omdoc:phrase class='emphasis'>#1</omdoc:phrase>"); +DefConstructor('\em',"<omdoc:phrase class='emphasis'>"); +DefConstructor('\texttt{}',"<omdoc:phrase class='code'>#1</omdoc:phrase>"); +DefConstructor('\textbf{}',"<omdoc:phrase class='bold'>#1</omdoc:phrase>"); +Tag('omdoc:phrase', autoClose=>1); +DefEnvironment('{center}','#body'); +DefEnvironment('{flushleft}','#body'); +DefEnvironment('{flushright}','#body'); +DefEnvironment('{minipage}[]{}','#body'); +DefEnvironment('{quote}', + "<omdoc:phrase type='quote' style='display:block'>" + . "#body" + ."</omdoc:phrase>"); +DefEnvironment('{quotation}', + "<omdoc:phrase type='quote' style='display:block'> + . "#body" + ."</omdoc:phrase>"); +DefEnvironment('{LARGE}','#body'); +DefEnvironment('{Large}','#body'); +DefEnvironment('{large}','#body'); +DefEnvironment('{small}','#body'); +DefEnvironment('{footnotesize}','#body'); +DefEnvironment('{tiny}','#body'); +DefEnvironment('{scriptsize}','#body'); +DefConstructor('\LARGE',''); +DefConstructor('\Large',''); +DefConstructor('\large',''); +DefConstructor('\small',''); +DefConstructor('\footnotesize',''); +DefConstructor('\scriptsize',''); +DefConstructor('\tiny',''); +DefConstructor('\fbox{}','#1'); +DefConstructor('\footnote[]{}', + "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); +DefConstructor('\footnotemark[]',""); +DefConstructor('\footnotetext[]{}', + "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); +DefConstructor('\sf', ''); +DefConstructor('\sc', ''); +Tag('omdoc:p',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:omtext',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:omgroup',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:CMP',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:link',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:meta',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:resource',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:ul',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:li',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:di',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:dt',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:dd',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:ol',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:dl',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:idx',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:phrase',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:note',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('ltx:tabular',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('ltx:thead',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('ltx:td',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('ltx:tr',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('ltx:caption',afterOpen=>\&numberIt,afterClose=>\&locateIt); +sub numberIt { + my($document,$node,$whatsit)=@_; + my(@parents)=$document->findnodes('ancestor::*[@xml:id]',$node); + my $prefix= (@parents ? $parents[$#parents]->getAttribute('xml:id')."." : ''); + my(@siblings)=$document->findnodes('preceding-sibling::*[@xml:id]',$node); + my $n = scalar(@siblings)+1; + my $id = ($node -> getAttribute('xml:id')); + $node->setAttribute('xml:id'=>$prefix."p$n") unless $id; + my $about = $node -> getAttribute('about'); + $node->setAttribute('about'=>'#'.$node->getAttribute('xml:id')) unless $about; + #Also, provide locators: + my $locator = $whatsit->getProperty('locator'); + #Need to inherit locators if missing: + $locator = (@parents ? $parents[$#parents]->getAttribute('stex:srcref') : '') unless $locator; + $node->setAttribute('stex:srcref'=>$locator) if $locator; } +sub locateIt { + my($document,$node,$whatsit)=@_; + #Estimate trailer locator: + my $trailer = $whatsit->getProperty('trailer'); + return unless $trailer; #Nothing we can do if the trailer isn't defined + $trailer = $trailer->getLocator; + return unless ($trailer && $trailer!~/^\s*$/); #Useless if broken + my $locator = $node->getAttribute('stex:srcref'); + if ($locator) { + $locator =~ /^(.+from=\d+;\d+)/; + my $from = $1; + $trailer =~ /(,to=\d+;\d+.+)$/; + my $to = $1; + $locator = $from.$to; + } else { + $locator = $trailer; #This should never happen + } + $node->setAttribute('stex:srcref' => $locator); +} +1; diff --git a/Master/texmf-dist/tex/latex/stex/presentation/presentation.sty b/Master/texmf-dist/tex/latex/stex/presentation/presentation.sty new file mode 100644 index 00000000000..536ddcfc1a9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/presentation/presentation.sty @@ -0,0 +1,157 @@ +%% +%% This is file `presentation.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% presentation.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{presentation}[2010/06/25 v1.0 presentation for semantic macros] +\RequirePackage{keyval}[1997/11/10] +\def\pres@default@precedence{0} +\def\pres@infty{1000000} +\def\iprec{\pres@infty} +\def\niprec{-\pres@infty} +\def\pres@initial@precedence{0} +\def\pres@current@precedence{\pres@initial@precedence} +\def\pres@default@lbrack{(}\def\pres@lbrack{\pres@default@lbrack} +\def\pres@default@rbrack{)}\def\pres@rbrack{\pres@default@rbrack} +\def\PrecSet#1{\def\pres@default@precedence{#1}} +\def\PrecWrite#1{\ifnum\pres@p>\pres@current@precedence\else{#1}\fi} +\def\prepost@clearkeys{\def\pres@p@key{\pres@default@precedence}\def\pres@pi@key{\niprec} +\def\pres@lbrack{\pres@default@lbrack}\def\pres@rbrack{\pres@default@rbrack}} +\define@key{prepost}{lbrack}{\def\pres@lbrack{#1}} +\define@key{prepost}{rbrack}{\def\pres@lbrack{#1}} +\define@key{prepost}{p}{\def\pres@p@key{#1}} +\define@key{prepost}{pi}{\def\pres@pi@key{#1}} +\newcommand{\prefix}[3][]%key, fn, arg +{\prepost@clearkeys\setkeys{prepost}{#1} +{#2}\pres@lbrack{\edef\pres@current@precedence{\pres@pi@key}#3}\pres@rbrack} +\newcommand{\postfix}[3][]%key, fn, arg +{\prepost@clearkeys\setkeys{prepost}{#1} +\pres@lbrack{\edef\pres@current@precedence{\pres@pi@key}#3}\pres@rbrack{#2}} +\def\clearkeys{\let\pres@p@key=\relax +\let\pres@pi@key=\relax% +\let\pres@pi@key=\relax% +\let\pres@pii@key=\relax% +\let\pres@piii@key=\relax} +\define@key{mi}{nobrackets}[yes]{\def\pres@p@key{\pres@infty}% +\def\pres@pi@key{-\pres@infty}} +\define@key{mi}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{mi}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{mi}{p}{\def\pres@p@key{#1}} +\define@key{mi}{pi}{\def\pres@pi@key{#1}} +\def\prep@keys@mi% +{\edef\pres@lbrack{\@ifundefined{pres@lbrack@key}\pres@default@lbrack\pres@lbrack@key} +\edef\pres@rbrack{\@ifundefined{pres@rbrack@key}\pres@default@rbrack\pres@rbrack@key} +\edef\pres@p{\@ifundefined{pres@p@key}\pres@default@precedence\pres@p@key} +\edef\pres@pi{\@ifundefined{pres@pi@key}\pres@p\pres@pi@key}} +\newcommand{\mixfixi}[4][]%key, pre, arg, post +{\clearkeys\setkeys{mi}{#1}\prep@keys@mi% +\PrecWrite\pres@lbrack% +#2{\edef\pres@current@precedence{\pres@pi}#3}#4% +\PrecWrite\pres@rbrack} +\def\@assoc#1#2#3{% precedence, function, argv +\let\@tmpop=\relax% do not print the function the first time round +\@for\@I:=#3\do{\@tmpop% print the function +{\edef\pres@current@precedence{#1}\@I}% +\let\@tmpop=#2}}%update the function +\newcommand{\mixfixa}[5][]%key, pre, arg, post, assocop +{\clearkeys\setkeys{mi}{#1}\prep@keys@mi% +\PrecWrite\pres@lbrack{#2}{\@assoc\pres@pi{#5}{#3}}{#4}\PrecWrite\pres@rbrack} +\define@key{mii}{nobrackets}[yes]{\def\pres@p@key{\pres@infty}% +\def\pres@pi@key{-\pres@infty}\def\pres@pii@key{-\pres@infty}} +\define@key{mii}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{mii}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{mii}{p}{\def\pres@p@key{#1}} +\define@key{mii}{pi}{\def\pres@pi@key{#1}} +\define@key{mii}{pii}{\def\pres@pii@key{#1}} +\def\prep@keys@mii{\prep@keys@mi% +\edef\pres@pii{\@ifundefined{pres@pii@key}\pres@p\pres@pii@key}} +\newcommand{\mixfixii}[6][]%key, pre, arg1, mid, arg2, post +{\clearkeys\setkeys{mii}{#1}\prep@keys@mii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}#6% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixia}[7][]%key, pre, arg1, mid, arg2, post, assocop +{\clearkeys\setkeys{mii}{#1}\prep@keys@mii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\@assoc\pres@pii{#7}{#5}}#6% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixai}[7][]%key, pre, arg1, mid, arg2, post, assocop +{\clearkeys\setkeys{mii}{#1}\prep@keys@mii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\@assoc\pres@pi{#7}{#3}}% +#4{\edef\pres@current@precedence{\pres@pii}#5}#6% +\PrecWrite\pres@rbrack} +\define@key{miii}{nobrackets}[yes]{\def\pres@p@key{\pres@infty}% +\def\pres@pi@key{-\pres@infty}\def\pres@pii@key{-\pres@infty}\def\pres@pii@key{-\pres@infty}} +\define@key{miii}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{miii}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{miii}{p}{\def\pres@p@key{#1}} +\define@key{miii}{pi}{\def\pres@pi@key{#1}} +\define@key{miii}{pii}{\def\pres@pii@key{#1}} +\define@key{miii}{piii}{\def\pres@piii@key{#1}} +\def\prep@keys@miii{\prep@keys@mii\edef\pres@piii{\@ifundefined{pres@piii@key}{\pres@p}{\pres@piii@key}}} +\newcommand{\mixfixiii}[8][]%key, pre, arg1, mid1, arg2, mid2, arg3, post +{\clearkeys\setkeys{miii}{#1}\prep@keys@miii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}% +#6{\edef\pres@current@precedence{\pres@pii}#7}#8% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixaii}[9][]%key, pre, arg1, mid1, arg2, mid2, arg3, post, sep +{\clearkeys\setkeys{miii}{#1}\prep@keys@miii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\@assoc\pres@pi{#9}{#3}}% +#4{\edef\pres@current@precedence{\pres@pii}#5}% +#6{\edef\pres@current@precedence{\pres@pii}#7}#8% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixiai}[9][]%key, pre, arg1, mid1, arg2, mid2, arg3, post, assocop +{\clearkeys\setkeys{miii}{#1}\prep@keys@miii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\@assoc\pres@pi{#9}{#5}}% +#6{\edef\pres@current@precedence{\pres@pii}#7}#8% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixiia}[9][]%key, pre, arg1, mid1, arg2, mid2, arg3, post,assocop +{\clearkeys\setkeys{miii}{#1}\prep@keys@miii% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}% +#6{\@assoc\pres@pi{#9}{#7}}#8% +\PrecWrite\pres@rbrack} +\newcommand{\prefixa}[4][]%keys, fn, arg, sep +{\prepost@clearkeys\setkeys{prepost}{#1} +{#2}\pres@lbrack{\@assoc\pres@pi@key{#3}{#4}}\pres@rbrack} +\newcommand{\postfixa}[4][]%keys, fn, arg, sep +{\prepost@clearkeys\setkeys{prepost}{#1} +\pres@lbrack{\@assoc\pres@pi@key{#3}{#4}}\pres@rbrack{#2}} +\newcommand{\infix}[4][]{\mixfixii[#1]{}{#3}{#2}{#4}{}} +\newcommand{\assoc}[3][]{\mixfixa[#1]{}{#3}{}{#2}} +\def\setegroup#1#2{\expandafter\def\csname #1@egroup\endcsname{#2}} +\def\elide#1#2#3{\@ifundefined{#1@egroup}% +{\def\@elevel{0} +\PackageError{presentation}{undefined egroup #1, assuming value 0}% +{When calling \protect\elide{#1}... the elision group #1 has be have\MessageBreak +been set by \protect\setegroup before, e.g. by \protect\setegroup{an}{0}.}}% +{\edef\@elevel{\csname #1@egroup\endcsname}}% +\ifnum\@elevel>#2\else{#3}\fi} +\def\provideEdefault#1#2{\expandafter\def\csname#1@edefault\endcsname{#2} +\@ifundefined{this@module}{}% +{\expandafter\g@addto@macro\this@module{\expandafter\def\csname#1@edefault\endcsname{#2}}}} +\def\setEdefault#1#2{\expandafter\def\csname #1@edfault\endcsname{#2}} +\def\fromEcontext#1{\csname #1@edefault\endcsname} +\newcommand{\vname}[2][]{#2\def\@opt{#1}\ifx\@opt\@empty\else\expandafter\gdef\csname MOD@name@#1\endcsname{#2}\fi} +\def\vnref#1{\csname MOD@name@#1\endcsname} +\newcommand{\primvar}[2][]{\vname[#1]{#2^\prime}} +\newcommand{\pprimvar}[2][]{\vname[#1]{#2^{\prime\prime}}} +\newcommand{\uivar}[3][]{\vname[#1]{{#2}^{#3}}} +\newcommand{\livar}[3][]{\vname[#1]{{#2}_{#3}}} +\newcommand{\ulivar}[4][]{\vname[#1]{{#2}^{#3}_{#4}}} +\endinput +%% +%% End of file `presentation.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/presentation/presentation.sty.ltxml b/Master/texmf-dist/tex/latex/stex/presentation/presentation.sty.ltxml new file mode 100644 index 00000000000..ecbcc524c20 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/presentation/presentation.sty.ltxml @@ -0,0 +1,381 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +DefMacro('\iprec','1000000'); +DefMacro('\niprec','-1000000'); +DefMacro('\prefix[]{}{}','\@prefix[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}'); +DefConstructor('\@prefix OptionalKeyVals:mi {}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . "argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "#2" + . "<m:mrow>" + . "<m:mo fence='true'>(</m:mo>" + . "#3" + . "<m:mo fence='true'>)</m:mo>" + . "</m:mrow>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { + #Default argument precedence is -\infty + my $keyval = $_[1]->getArg(1); + $keyval->setValue('pi',-1000000) unless ($keyval && defined($keyval->getValue('pi'))); + applyPrecedencePreferences(@_); + }, + properties=>sub { getSymmdefProperties($_[1]); }); +DefMacro('\postfix []{}{}','\@postfix[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}'); +DefConstructor('\@postfix OptionalKeyVals:mi {}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + ."argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mrow>" + . "<m:mo fence='true'>(</m:mo>" + . "#3" + . "<m:mo fence='true'>)</m:mo>" + . "</m:mrow>" + . "#2" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { + #Default argument precedence is -\infty + my $keyval = $_[1]->getArg(1); + $keyval->setValue('pi',-1000000) unless ($keyval && defined($keyval->getValue('pi'))); + applyPrecedencePreferences(@_); + }, + properties=>sub { getSymmdefProperties($_[1]); }); +our $max_arguments = 10; #Currently max 10 arguments to \symdef. +DefKeyVal('mi','lbrack','Semiverbatim'); +DefKeyVal('mi','rbrack','Semiverbatim'); +DefKeyVal('mi','p','Semiverbatim'); +DefKeyVal('mi','pi','Semiverbatim'); +DefKeyVal('mi','pii','Semiverbatim'); #Why are we using this at mixfixai ? +DefKeyVal('mi','cd','Semiverbatim'); +DefKeyVal('mi','name','Semiverbatim'); +DefKeyVal('mi','nobrackets','Semiverbatim'); +sub argument_precedence { + my ($keyval) = @_; + my $attr = 'pi'; + my @precs = (); + foreach (1..$max_arguments) { + if (defined KeyVal($keyval,$attr)) { + push @precs, ToString(KeyVal($keyval,$attr)) + } else { + push @precs, ""; + } + $attr = $attr.'i'; + } + return join(" ",@precs)." "; +} +sub applyPrecedencePreferences { + my ($stomach,$whatsit) = @_; + my @args = $whatsit->getArgs; + my $keyvals = shift @args; + return unless (defined $keyvals); + my %kvhash = %{$keyvals->getKeyVals}; + #Default p (operator precedence) if not set: + my $default_precedence = LookupValue('default_precedence'); + $keyvals->setValue('p',$default_precedence) unless defined($keyvals->getValue('p')); + return unless (exists $kvhash{'nobrackets'}); + $keyvals->setValue('p',1000000); + $keyvals->setValue('pi',-1000000); + $keyvals->setValue('pii',-1000000); + $keyvals->setValue('piii',-1000000); + return; +}#$ +DefMacro('\mixfixi[]{}{}{}', + '\@mixfixi[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}'); +DefConstructor('\@mixfixi OptionalKeyVals:mi {}{}{}', + "<omdoc:rendering" + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')')" + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2 #3 #4" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\mixfixa[]{}{}{}{}', + '\@mixfixa[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}' + . '{$\crossrefOp[fun]{#5}$}'); +DefConstructor('\@mixfixa OptionalKeyVals:mi {}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#5</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "#4" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefKeyVal('mii','lbrack','Semiverbatim'); +DefKeyVal('mii','rbrack','Semiverbatim'); +DefKeyVal('mii','p','Semiverbatim'); +DefKeyVal('mii','pi','Semiverbatim'); +DefKeyVal('mii','pii','Semiverbatim'); +DefKeyVal('mii','cd','Semiverbatim'); +DefKeyVal('mii','name','Semiverbatim'); +DefKeyVal('mii','nobrackets','Semiverbatim'); +DefMacro('\mixfixii[]{}{}{}{}{}', + '\@mixfixii[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}{$#5 $}' + . '{$\crossrefOp[fun]{#6}$}'); +DefConstructor('\@mixfixii OptionalKeyVals:mi {}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . "argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2 #3 #4 #5 #6" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\mixfixia[]{}{}{}{}{}{}', + '\@mixfixia[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}{$#5 $}' + . '{$\crossrefOp[fun]{#6}$}' + . '{$\crossrefOp[fun]{#7}$}'); +DefConstructor('\@mixfixia OptionalKeyVals:mi {}{}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2 #3 #4" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#7</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "#6" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\mixfixai[]{}{}{}{}{}{}', + '\@mixfixai[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + .'{$\crossrefOp[fun]{#4}$}{$#5 $}' + .'{$\crossrefOp[fun]{#6}$}' + .'{$\crossrefOp[fun]{#7}$}'); +DefConstructor('\@mixfixai OptionalKeyVals:mi {}{}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#7</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "#4 #5 #6" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefKeyVal('miii','lbrack','Semiverbatim'); +DefKeyVal('miii','rbrack','Semiverbatim'); +DefKeyVal('miii','p','Semiverbatim'); +DefKeyVal('miii','pi','Semiverbatim'); +DefKeyVal('miii','pii','Semiverbatim'); +DefKeyVal('miii','piii','Semiverbatim'); +DefKeyVal('miii','cd','Semiverbatim'); +DefKeyVal('miii','name','Semiverbatim'); +DefKeyVal('miii','nobrackets','Semiverbatim'); +DefMacro('\mixfixiii[]{}{}{}{}{}{}{}', + '\@mixfixiii[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}{$#5 $}' + . '{$\crossrefOp[fun]{#6}$}{$#7 $}' + . '{$\crossrefOp[fun]{#8}$}'); +DefConstructor('\@mixfixiii OptionalKeyVals:mi {}{}{}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2 #3 #4 #5 #6 #7 #8" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\mixfixaii[]{}{}{}{}{}{}{}{}', + '\@mixfixaii[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}{$#5 $}' + . '{$\crossrefOp[fun]{#6}$}{$#7 $}' + . '{$\crossrefOp[fun]{#8}$}' + . '{$\crossrefOp[fun]{#9}$}'); +DefConstructor('\@mixfixaii OptionalKeyVals:mi {}{}{}{}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#9</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "#4 #5 #6 #7 #8" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\mixfixiai[]{}{}{}{}{}{}{}{}', + '\@mixfixiai[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}{$#5 $}' + . '{$\crossrefOp[fun]{#6}$}{$#7 $}' + . '{$\crossrefOp[fun]{#8}$}' + . '{$\crossrefOp[fun]{#9}$}'); +DefConstructor('\@mixfixiai OptionalKeyVals:mi {}{}{}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2 #3 #4" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#9</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "#6 #7 #8" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\mixfixiia[]{}{}{}{}{}{}{}{}', + '\@mixfixiia[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}' + . '{$\crossrefOp[fun]{#4}$}{$#5 $}' + . '{$\crossrefOp[fun]{#6}$}{$#7 $}' + . '{$\crossrefOp[fun]{#8}$}' + . '{$\crossrefOp[fun]{#9}$}'); +DefConstructor('\@mixfixiia OptionalKeyVals:mi {}{}{}{}{}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . " argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mo egroup='fence' fence='true'>(</m:mo>" + . "#2 #3 #4 #5 #6" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#9</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "#8" + . "<m:mo egroup='fence' fence='true'>)</m:mo>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { applyPrecedencePreferences(@_);}, + properties=>sub { getSymmdefProperties($_[1]); });#$ +DefMacro('\prefixa[]{}{}{}','\@prefixa[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}{$#4 $}'); +DefConstructor('\@prefixa OptionalKeyVals:mi {}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + . "argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "#2" + . "<m:mrow>" + . "<m:mo fence='true'>(</m:mo>" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#4</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<m:mo fence='true'>)</m:mo>" + . "</m:mrow>" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { + #Default argument precedence is -\infty + my $keyval = $_[1]->getArg(1); + $keyval->setValue('pi',-1000000) unless ($keyval && defined($keyval->getValue('pi'))); + applyPrecedencePreferences(@_); + }, + properties=>sub { getSymmdefProperties($_[1]); }); +DefMacro('\postfixa []{}{}{}','\@postfixa[#1]{$\crossrefOp[fun]{#2}$}{$#3 $}{$#4 $}'); +DefConstructor('\@postfixa OptionalKeyVals:mi {}{}{}', + "<omdoc:rendering " + . "?&defined(&KeyVal(#1,'p'))(precedence='&KeyVal(#1,'p')') " + ."argprec='&argument_precedence(#1)'>" + . "<m:mrow>" + . "<m:mrow>" + . "<m:mo fence='true'>(</m:mo>" + . "<omdoc:iterate name='args' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')>" + . "<omdoc:separator>#4</omdoc:separator>" + . "<omdoc:render name='arg' " + . "?&defined(&KeyVal(#1,'pi'))(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<m:mo fence='true'>)</m:mo>" + . "</m:mrow>" + . "#2" + . "</m:mrow>" + ."</omdoc:rendering>", + afterDigest=>sub { + #Default argument precedence is -\infty + my $keyval = $_[1]->getArg(1); + $keyval->setValue('pi',-1000000) unless ($keyval && defined($keyval->getValue('pi'))); + applyPrecedencePreferences(@_); + }, + properties=>sub { getSymmdefProperties($_[1]); }); +RawTeX(' +\newcommand{\infix}[4][]{\mixfixii[#1]{}{#3}{#2}{#4}{}} +\newcommand{\assoc}[3][]{\mixfixa[#1]{}{#3}{}{#2}} +'); +sub cvar_id { + my ($id)=@_; + $id=ToString($id); + if (!$id) { + $id=LookupValue('cvar_id'); + $id=0 unless $id; + $id++; + AssignValue('cvar_id',$id,'global'); + } + $id="cvar.$id"; $id;} +DefConstructor('\vname[]{}', + "<ltx:XMWrap role='ID' xml:id='&cvar_id(#1)'>#2</ltx:XMWrap>", + requireMath=>1); +DefConstructor('\crossrefOp[]{}', + "?#2(<ltx:XMApp role='CROSSREFOP'>" + . "<ltx:XMTok role='CROSSREFOP' cr='?#1(#1)(fun)'/>" + . "<ltx:XMWrap>#2</ltx:XMWrap>" + ."</ltx:XMApp>)()", + requireMath=>1); +DefMacro('\vnref{}','\@XMRef{#1}'); +RawTeX(' +\newcommand{\primvar}[2][]{\vname[#1]{#2^\prime}} +\newcommand{\pprimvar}[2][]{\vname[#1]{#2^{\prime\prime}}} +\newcommand{\uivar}[3][]{\vname[#1]{{#2}^{#3}}} +\newcommand{\livar}[3][]{\vname[#1]{{#2}_{#3}}} +\newcommand{\ulivar}[4][]{\vname[#1]{{#2}^{#3}_{#4}}} +'); +1; diff --git a/Master/texmf-dist/tex/latex/stex/reqdoc/reqdoc.sty b/Master/texmf-dist/tex/latex/stex/reqdoc/reqdoc.sty new file mode 100644 index 00000000000..ce58e497acd --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/reqdoc/reqdoc.sty @@ -0,0 +1,65 @@ +%% +%% This is file `reqdoc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% reqdoc.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{reqdoc}[2010/06/25 v0.3 Semantic Requirement Documents] +\newif\if@deps\@depsfalse +\DeclareOption{recorddeps}{\@depstrue} +\ProcessOptions +\RequirePackage{sref} +\RequirePackage{longtable} +\newif\ifreqsnum\reqsnumfalse +\omdaddkey{reqs}{numbering} +\omdaddkey[R]{reqs}{prefix} +\def\reqs@no{no} +\newenvironment{requirements}[1][]% +{\omdsetkeys{reqs}{#1}\ifx\reqs@numbering\reqs@no\reqsnumfalse\else\reqsnumtrue\fi}{} +\omdaddkey{req}{id} +\omdaddkey{req}{prio} +\omdaddkey{req}{refs} +\omdaddkey{req}{num} +\newcounter{reqnum}[section] +\def\req@do@refs#1#2{\let\@tmpop=\relax\@for\@I:=#1\do{\@tmpop\req@do@ref{\@I}\let\@tmpop=#2}} +\def\req@do@ref#1{\sref@hlink@ifh{#1}{\req@ref{#1}{number}}} +\def\req@def@aux#1#2#3{\expandafter\xdef\csname req@#1@#2\endcsname{#3}} +\def\req@write@aux#1#2#3{\protected@write\@auxout{}{\string\req@def@aux{#1}{#2}{\thesection.#3}}} +\def\req@def#1#2#3{\req@def@aux{#1}{#2}{#3}\req@write@aux{#1}{#2}{#3}} +\def\req@ref#1#2{\csname req@#1@#2\endcsname} +\def\print@req@prio{\ifx\req@prio\@empty\else(Priority: \req@prio)\fi} +\def\print@req@label{\sref@target@ifh\req@id{\reqs@prefix\arabic{reqnum}: }} +\def\print@req@refs{\ifx\req@refs\@empty\else\hfill [from~\req@do@refs{\req@refs}{,}]\fi} +\newenvironment{requirement}[1][]% +{\omdsetkeys{req}{#1}\stepcounter{reqnum} +\ifreqsnum\ifx\req@id\@empty\else\req@def\req@id{number}\thereqnum\fi +\noindent\textbf{\print@req@label}\fi +\newcommand{\reqnote}[1]{\par\noindent Note: ##1} +\print@req@prio} +{\medskip\print@req@refs} +\newenvironment{reqtable}[1][]{\omdsetkeys{reqs}{#1} +\begin{center}\begin{longtable}{|l|l|p{6cm}|p{5cm}|l|}\hline +\# & Prio & Requirement & Notes & Refs\\\hline\hline} +{\end{longtable}\end{center}} +\newcommand{\reqline}[3][]% +{\omdsetkeys{req}{#1}\stepcounter{reqnum} +\req@def\req@id{number}\thereqnum% remember the number for reference +\textbf{\sref@target@ifh\req@id{\reqs@prefix\arabic{reqnum}}}& +\req@prio &\req@do@refs\req@refs{,}\tabularnewline\hline} +\newcommand{\importreqs}[1]{\req@dep@write{"#1.tex"}{IMPORTREQS}\makeatletter\input{#1.aux}\makeatother} +\newcommand{\rinput}[1]{\req@dep@write{"#1.tex"}{[dt="input"]}\bgroup\@depsfalse\input{#1}\egroup} +\if@deps\newwrite\req@depfile +\immediate\openout\req@depfile=\jobname.deps +\AtEndDocument{\closeout\req@depfile} +\renewcommand{\importmodule}[2][]{\req@dep@write{"#1.tex"}{[dt="importmodule"]}\def\@test{#1}% +\ifx\@test\@empty\else\requiremodules{#1}\fi +\expandafter\gdef\csname#2@cd@file@base\endcsname{#1} +\activate@defs{#2}\export@defs{#2}} +\fi +\def\req@dep@write#1#2{\if@deps\protected@write\req@depfile{}{#1 #2}\fi} +\endinput +%% +%% End of file `reqdoc.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/reqdoc/reqdoc.sty.ltxml b/Master/texmf-dist/tex/latex/stex/reqdoc/reqdoc.sty.ltxml new file mode 100644 index 00000000000..f7b9edf4d8a --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/reqdoc/reqdoc.sty.ltxml @@ -0,0 +1,23 @@ +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RegisterNamespace('r'=>"http://omdoc.org/ontology/requirements#"); +RegisterDocumentNamespace('r'=>"http://omdoc.org/ontology/requirements#"); +DefEnvironment('{requirements} OptionalKeyVals:reqs', + "<omdoc:omgroup type='itemize'>#body</omdoc:omgroup>"); +DefCMPEnvironment('{requirement} OptionalKeyVals:req', + "<omdoc:omtext ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() r:dummy='to ensure the namespace'>" + . "<omdoc:meta property='texttype' content='r:requirement'/>" + . "?&KeyVal(#1,'refs')(<omdoc:link rel='r:dependsOn' href='#&KeyVal(#1,'refs')'/>)()" + . "#body" + ."</omdoc:omtext>"); +DefConstructor('\reqnote{}', + "<omdoc:note type='requirement'>#1</omdoc:note>"); +DefEnvironment('{reqtable} OptionalKeyVals:reqs', + "<omdoc:omgroup type='itemize'>#body</omdoc:omgroup>"); +DefCMPConstructor('\reqline OptionalKeyVals:req{}{}', + "<omdoc:omtext type='requirement'><omdoc:CMP>#2</omdoc:CMP></omdoc:omtext>" + ."<omdoc:omtext type='note'><omdoc:CMP>#3</omdoc:CMP></omdoc:omtext>"); +DefConstructor('\importreqs {}',"<omdoc:imports from='#1'/>"); +DefMacro('\rinput','\input'); +1; diff --git a/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty b/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty new file mode 100644 index 00000000000..6a101124b4b --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty @@ -0,0 +1,71 @@ +%% +%% This is file `sproof.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% sproof.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{sproof}[2010/06/25 v0.9f Semantic Markup for Proofs] +\RequirePackage{sref} +\srefaddidkey{spf} +\omdaddkey{spf}{display} +\omdaddkey{spf}{for} +\omdaddkey{spf}{from} +\omdaddkey[\sproof@box]{spf}{proofend} +\omdaddkey{spf}{type} +\omdaddkey{spf}{title} +\omdaddkey{spf}{continues} +\def\spf@flow{flow} +\newenvironment{pst@with@label}[1]{\edef\pst@label{#1}\advance\count10 by 1\count\count10=1} +{\advance\count10 by -1} +\def\the@pst@label{\pst@label.\number\count\count10} +\def\next@pst@label{\global\advance\count\count10 by 1} +\def\sproof@box{\hbox{\vrule\vbox{\hrule width 6 pt\vskip 6pt\hrule}\vrule}} +\def\spf@proofend{\sproof@box} +\def\sproofend{\ifx\spf@proofend\@empty\else\hfil\null\nobreak\hfill\spf@proofend\par\smallskip\fi} +\def\sProofEndSymbol#1{\def\sproof@box{#1}} +\newcommand{\spfsketch}[2][]{\omdsetkeys{spf}{#1}\sref@target +\ifx\spf@display\spf@flow\else{\stDMemph{\ifx\spf@type\@empty{Proof}\else\spf@type\fi}:}\fi{ #2}% +\sref@label@id{this \ifx\spf@type\@empty{Proof}\else\spf@type\fi}} +\newenvironment{@proof}[2][]{\omdsetkeys{spf}{#1}\sref@target +\count10=10 +\ifx\spf@display\spf@flow\else{\stDMemph{\ifx\spf@type\@empty{Proof}\else\spf@type\fi}:}\fi{ #2}% +\sref@label@id{this \ifx\spf@type\@empty{Proof}\else\spf@type\fi} +\def\pst@label{}\newcount\pst@count% initialize the labeling mechanism +\begin{description}\begin{pst@with@label}{P}} +{\end{pst@with@label}\end{description}} +\newenvironment{sproof}[2][]{\begin{@proof}[#1]{#2}}{\sproofend\end{@proof}} +\newenvironment{sProof}[2][]{\begin{@proof}[#1]{#2}}{\end{@proof}} +\newcommand{\spfidea}[2][]{\omdsetkeys{spf}{#1}% +\stDMemph{\ifx\spf@type\@empty{Proof Idea}\else\spf@type\fi:} #2\sproofend} +\newenvironment{spfstep}[1][]{\omdsetkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\ifx\spf@title\@empty\else{(\stDMemph{\spf@title})}\fi} +{\next@pst@label} +\newenvironment{sproofcomment}[1][]{\omdsetkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi} +{\next@pst@label} +\newenvironment{spfcases}[2][]{\omdsetkeys{spf}{#1} +\def\@test{#2}\ifx\@test\empty\else +\ifx\spf@display\spf@flow {#2}\else\item[\the@pst@label]{#2} \fi\fi +\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\end{pst@with@label}\next@pst@label} +\newenvironment{spfcase}[2][]{\omdsetkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\def\@test{#2}\ifx\@test\@empty\else{\stDMemph{#2}:}\fi +\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}\next@pst@label} +\newenvironment{subproof}{\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}} +\srefaddidkey{just} +\omdaddkey{just}{method} +\omdaddkey{just}{premises} +\omdaddkey{just}{args} +\newenvironment{justification}[1][]{}{} +\newcommand{\premise}[2][]{#2} +\newcommand{\justarg}[2][]{#2} +\endinput +%% +%% End of file `sproof.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty.ltxml b/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty.ltxml new file mode 100644 index 00000000000..91dc3034627 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty.ltxml @@ -0,0 +1,122 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('sref'); +DefConstructor('\sproofend',""); +DefConstructor('\spfsketch OptionalKeyVals:pf{}', + "<omdoc:proof " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext>" + . "<omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n)()" + . "</omdoc:proof>\n"); +DefConstructor('\sProofEndSymbol {}',''); +DefCMPEnvironment('{sproof} OptionalKeyVals:pf{}', + "<omdoc:proof " + . "?&KeyVal(#1,'for')(for='&hash_wrapper(&KeyVal(#1,'for'))')()" + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext>" + . "<omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n)()" + . "#body" + . "</omdoc:proof>\n"); +DefMacro('\sProof','\sproof'); +DefMacro('\endsProof','\endsproof'); +DefCMPConstructor('\spfidea OptionalKeyVals:pf {}', + "<omdoc:proof " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()" + . "?&KeyVal(#1,'for')(for='&hash_wrapper(&KeyVal(#1,'for'))')()>\n" + . "<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n" + . "</omdoc:proof>\n"); +DefCMPEnvironment('{spfstep} OptionalKeyVals:pf', + "<omdoc:derive " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:derive>\n", + beforeConstruct=>sub { + $_[0]->maybeCloseElement('omdoc:p'); + $_[0]->maybeCloseElement('omdoc:CMP'); + }); +DefCMPEnvironment('{sproofcomment} OptionalKeyVals:pf', + "<omdoc:omtext " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>"); +DefEnvironment('{spfcases} OptionalKeyVals:pf {}', + "<omdoc:derive " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()>\n" + . "<omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP>\n" + . "<omdoc:method xref='#proof-by-cases'>#body</omdoc:method>" + . "</omdoc:derive>\n"); +DefEnvironment('{spfcase} OptionalKeyVals:pf{}', + "<omdoc:proof " + . "?&defined(&KeyVal(#1,'id'))(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext>" + . "<omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n)()" + . "#body" + . "</omdoc:proof>\n"); +DefEnvironment('{subproof}', + "<omdoc:proof>\n #body\n</omdoc:proof>\n"); +DefKeyVal('just','id','Semiverbatim'); +DefKeyVal('just','method','Semiverbatim'); +DefKeyVal('just','premises','Semiverbatim'); +DefKeyVal('just','args','Semiverbatim'); +sub extractBodyText { + my ($box, $remove) = @_; + my $str = ''; + my @boxes = $box->unlist; + foreach my $b(@boxes) { + my $s = ''; + if ($b =~ /LaTeXML::Whatsit/) { + my $body = $b->getBody; + $s = $body ? extractBodyText($body, $remove) : ''; + } elsif ($b =~ /LaTeXML::Box/) { + $s = $b->toString || ''; + @{$b}[0] = '' if $remove; } + $str .= $s; } + $str =~ s/\s+/ /g; + $str; } + +DefEnvironment('{justification} OptionalKeyVals:just', sub { + my ($doc, $keys, %props) = @_; + my $text = extractBodyText($props{body}, 1); + my $node = LookupValue('_LastSeenCMP'); + #$node->appendText($text) if $node; + my $method = $keys ? $keys->getValue('method') : undef; + $doc->openElement("omdoc:method", $method ? (xref => $method) : ()); + $doc->absorb($props{body}) if $props{body}; + $doc->closeElement("omdoc:method"); + return; }); +DefMacro('\premise[]{}', sub { + my ($xref, $text) = ($_[1], $_[2]); + my @res = (T_CS('\premise@content')); + push(@res, T_OTHER('['), $xref->unlist, T_OTHER(']')) if $xref; + push(@res, T_SPACE, $text->unlist) if $text; + @res; }); +DefConstructor('\premise@content[]', + "<omdoc:premise xref='#1'/>"); +DefMacro('\justarg[]{}', sub { (($_[1] ? $_[1]->unlist : ()), +T_SPACE, $_[2]->unlist, T_SPACE); }); +Tag('omdoc:derive', afterClose=>sub { + my ($doc, $node) = @_; + my @children = grep($_->nodeType == XML_ELEMENT_NODE, $node->childNodes); + my $firstCMP = undef; + foreach my $child(@children) { + next unless ($child->localname || '') eq 'CMP'; + if ($child->hasChildNodes()) { + next unless $#{$child->childNodes} == 0; + next unless $child->firstChild->nodeType == XML_TEXT_NODE; } + + if ($firstCMP) { + $firstCMP->appendText($child->textContent); + $node->removeChild($child); + } else { $firstCMP = $child; } + } + });#$ +Tag('omdoc:proof',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:derive',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:method',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:premise',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:derive',afterOpen=>\&numberIt,afterClose=>\&locateIt); +1; diff --git a/Master/texmf-dist/tex/latex/stex/sref/sref.sty b/Master/texmf-dist/tex/latex/stex/sref/sref.sty new file mode 100644 index 00000000000..52f4b1c7d12 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/sref/sref.sty @@ -0,0 +1,91 @@ +%% +%% This is file `sref.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% sref.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{sref}[2010/06/25 v0.9 Semantic Cross-References] +\newif\ifextrefs\extrefsfalse +\DeclareOption{extrefs}{\extrefstrue} +\ProcessOptions +\RequirePackage{omd} +\newcommand{\sref}[2][]{% +\@ifundefined{sref@part}{\sref@hlink[#1]{#2}}{\sref@hlink[#1]{\sref@part @#2}}} +\newcommand{\srefs}[3][]{% +\def\@test{#1}\ifx\@test\@empty\sref{#2} and \sref{#3}\else #1\fi} +\newcommand{\srefl}[3][]{% +\def\@test{#1}\ifx\@test\@empty\sref{#2} to \sref{#3}\else #1\fi} +\newcommand{\spageref}[2][]{% +\@ifundefined{sref@part}{\sref@hlink[#1]{#2}}{\sref@hlink[#1]{\sref@part @#2}}} +\newif\ifhref\hreffalse +\AtBeginDocument{\@ifpackageloaded{hyperref}{\hreftrue}{\hreffalse}} +\def\sref@href@ifh#1#2{\ifhref\href{#1}{#2}\else#2\fi} +\def\sref@hlink@ifh#1#2{\ifhref\hyperlink{#1}{#2}\else#2\fi} +\def\sref@target@ifh#1#2{\ifhref\hypertarget{#1}{#2}\else#2\fi} +\def\sref@target% +{\ifx\sref@id\@empty\else% +\expandafter\sref@target@ifh% +{sref@\@ifundefined{sref@part}{}{\sref@part @}\sref@id @target}{}\fi} +\def\@sref@def#1#2#3{\expandafter\gdef\csname sref@#1@#2\endcsname{#3}} +\ifextrefs\newwrite\refs@file\else\def\refs@file{\@auxout}\fi +\def\sref@def#1#2#3{%\@sref@def{#1}{#2}{#3}% +\protected@write\refs@file{}{\string\@sref@def{#1}{#2}{#3}}} +\omdaddkey{srefaddidkey}{prefix} +\newcommand\srefaddidkey[2][]{\omdsetkeys{srefaddidkey}{#1}% +\@omd@ext@clear@keys{#2}{sref@id}{}% id cannot have a default +\define@key{#2}{id}{\edef\sref@id{\srefaddidkey@prefix ##1}}} +\def\makeextrefs#1{\gdef\sref@part{#1}% +\makeatletter +\IfFileExists{\jobname.refs}{\input{\jobname.refs}}{}% +\immediate\openout\refs@file=\jobname.refs +\makeatother} +\def\sref@label#1#2{% +\sref@def{\@ifundefined{sref@part}{}{\sref@part @}#2}{page}{\thepage} +\sref@def{\@ifundefined{sref@part}{}{\sref@part @}#2}{label}{#1}} +\def\sref@label@id#1{\ifx\sref@id\@empty\else\sref@label{#1}{\sref@id}\fi} +\newcommand{\sref@hlink}[2][]{\def\@test{#1}% +\@ifundefined{sref@#2@label}% +{\protect\G@refundefinedtrue\@latex@warning{reference #2 undefined}??}% +{\sref@hlink@ifh{sref@#2@target}{\ifx\@test\@empty\@nameuse{sref@#2@label}\else #1\fi}}} +\newcommand{\sref@page@label}[1]{p.~{#1}} +\newcommand{\sref@pageref}[1]{\@ifundefined{sref@#1@page}% +{\protect\G@refundefinedtrue\@latex@warning{reference #1 undefined}\sref@page@label{??}}% +{\sref@hlink@ifh{sref@#1@target}{\sref@page@label{\@nameuse{sref@#1@page}}}}} +\newcommand{\sref@href}[3][]{\def\@test{#1}% +\@ifundefined{sref@#2@label}% +{\protect\G@refundefinedtrue\@latex@warning{reference #2 undefined}??}% +{\@ifundefined{sref@#3@URI}% +{\protect\G@refundefinedtrue\@latex@warning{external refs of type #3 undefined}??}% +{\edef\@uri{\@nameuse{sref@#3@URI}.pdf\#sref@#2@target} +\edef\@label{\ifx\@test\@empty\@nameuse{sref@#2@label}\else #1\fi} +\sref@href@ifh\@uri\@label}}} +\ifextrefs +\newcommand{\extref}[3][]{\def\theextref{\sref@href[#1]{#2@#3}{#2}}% +\csname doextref@#2\endcsname} +\else +\newcommand{\extref}[3][]{\sref[#1]{#3}} +\fi +\def\extrefstyle#1#2{\expandafter\gdef\csname doextref@#1\endcsname{#2}} +\newcommand{\inputrefs}[2]{% +\@namedef{sref@#1@URI}{#2} +\makeatletter% +\IfFileExists{#2.refs}{\input{#2.refs}} + {\PackageError{sref}{Reference file #1.refs does not exist} + {Maybe you have to run LaTeX on #2.tex first}} +\makeatother} +\srefaddidkey{sequation} +\def\sref@sequation@heading{equation} +\newenvironment{sequation}[1][]{\omdsetkeys{sequation}{#1}% +\ifx\sref@id\@empty\begin{displaymath}\else% no id, using equation* +\begin{equation}\sref@target\sref@label@id{\sref@sequation@heading~(\theequation)}\fi} +{\ifx\sref@id\@empty\end{displaymath}\else\end{equation}\fi} +\newenvironment{seqnarray}[1][]% +{\omdsetkeys{sequation}{#1}\begin{eqnarray*}\sref@target% +\sref@label@id{\sref@sequation@heading~(\theequation)}} +{\end{eqnarray*}} +\endinput +%% +%% End of file `sref.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml b/Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml new file mode 100644 index 00000000000..2157be90a8a --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml @@ -0,0 +1,33 @@ +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +DeclareOption('extrefs',''); +RequirePackage('omd'); +DefConstructor('\sref[]{}', + "Section <omdoc:ref type='cite' xref='#2'/>"); +DefConstructor('\srefs[]{}', + "Section <omdoc:ref type='cite' xref='#2'/>"); +DefConstructor('\srefl[]{}', + "Section <omdoc:ref type='cite' xref='#2'/>"); +DefConstructor('\spageref[]{}', + "Section <omdoc:ref type='cite' xref='#2'/>"); +DefConstructor('\makeextrefs{}',''); +DefConstructor('\extref[]{}', + "Section <omdoc:ref type='cite' xref='#2'/>"); +DefConstructor('\theextref',''); +DefConstructor('\extrefstyle{}{}',""); +DefConstructor('\inputrefs{}{}',''); +DefEnvironment('{sequation} OptionalKeyVals', + "<ltx:equation " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')' " + . "refnum='#refnum')(xml:id='#id')>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>#body</ltx:XMath>" + . "</ltx:Math>" + . "</ltx:equation>", + mode=>'display_math', + properties=> sub { RefStepCounter('equation') }, + locked=>1); +DefMacro('\seqnarray OptionalKeyVals','\begin{eqnarray*}'); +DefMacro('\endseqnarray','\end{eqnarray*}'); +1; diff --git a/Master/texmf-dist/tex/latex/stex/statements/statements.sty b/Master/texmf-dist/tex/latex/stex/statements/statements.sty new file mode 100644 index 00000000000..e761512a9b3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/statements/statements.sty @@ -0,0 +1,135 @@ +%% +%% This is file `statements.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% statements.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{statements}[2010/06/25 v1.0 Semantic Markup for Statements] +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\ProcessOptions +\RequirePackage{omtext} +\RequirePackage{modules} +\RequirePackage[hyperref]{ntheorem} +\theoremstyle{plain} +\def\STpresent#1{#1} +\def\define@statement@env#1{% +\newenvironment{#1}[1][]{\omdsetkeys{omtext}{##1}\sref@target% +\ifx\omtext@display\st@flow\else% +\ifx\omtext@title\@empty\begin{ST#1Env}\else\begin{ST#1Env}[\omtext@title]\fi% +\ifx\sref@id\@empty\else\label{#1.\sref@id}\fi +\csname st@#1@initialize\endcsname\fi +\ifx\sref@id\@empty\sref@label@id{here}\else% +\sref@label@id{\STpresent{\csname ST#1EnvKeyword\endcsname}~\@currentlabel}\fi} +{\csname st@#1@terminate\endcsname\ifx\omtext@display\st@flow\else\end{ST#1Env}\fi}} +\newenvironment{assertion}[1][]{\omdsetkeys{omtext}{#1}\sref@target% +\ifx\omtext@display\st@flow\else% +\ifx\omtext@title\@empty\begin{ST\omtext@type AssEnv}% +\else\begin{ST\omtext@type AssEnv}[\omtext@title]\fi\fi% +\ifx\omtext@type\@empty\sref@label@id{here}\else% +\sref@label@id{\STpresent{\csname ST\omtext@type AssEnvKeyword\endcsname}~\@currentlabel}\fi} +{\ifx\omtext@display\st@flow\else\end{ST\omtext@type AssEnv}\fi} +\def\st@theorem@kw{Theorem} +\def\st@lemma@kw{Lemma} +\def\st@proposition@kw{Proposition} +\def\st@corollary@kw{Corollary} +\def\st@conjecture@kw{Conjecture} +\def\st@falseconjecture@kw{Conjecture (false)} +\def\st@postulate@kw{Postulate} +\def\st@obligation@kw{Obligation} +\def\st@assumption@kw{Assumption} +\def\st@observation@kw{Observation} +\theorembodyfont{\itshape} +\theoremheaderfont{\normalfont\bfseries} +\newtheorem{STtheoremAssEnv}{\st@theorem@kw} +\newtheorem{STlemmaAssEnv}[STtheoremAssEnv]{\st@lemma@kw} +\newtheorem{STpropositionAssEnv}[STtheoremAssEnv]{\st@proposition@kw} +\newtheorem{STcorollaryAssEnv}[STtheoremAssEnv]{\st@corollary@kw} +\newtheorem{STconjectureAssEnv}[STtheoremAssEnv]{\st@conjecture@kw} +\newtheorem{STfalseconjectureAssEnv}[STtheoremAssEnv]{\st@falseconjecture@kw} +\newtheorem{STpostulateAssEnv}[STtheoremAssEnv]{\st@postulate@kw} +\newtheorem{STobligationAssEnv}[STtheoremAssEnv]{\st@obligation@kw} +\newtheorem{STassumptionAssEnv}[STtheoremAssEnv]{\st@assumption@kw} +\newtheorem{STobservationAssEnv}[STtheoremAssEnv]{\st@observation@kw} +\def\st@example@initialize{}\def\st@example@terminate{} +\define@statement@env{example} +\def\st@example@kw{Example} +\theorembodyfont{\upshape} +\newtheorem{STexampleEnv}[STtheoremAssEnv]{\st@example@kw} +\def\st@axiom@initialize{}\def\st@axiom@terminate{} +\define@statement@env{axiom} +\def\st@axiom@kw{Axiom} +\theorembodyfont{\upshape} +\newtheorem{STaxiomEnv}[STtheoremAssEnv]{\st@axiom@kw} +\srefaddidkey{symboldec} +\omdaddkey{symboldec}{functions} +\omdaddkey{symboldec}{role} +\omdaddkey{symboldec}{title} +\omdaddkey{symboldec}{name} +\omdaddkey{symboldec}{display} +\def\symboldec@type{Symbol} +\newenvironment{symboldec}[1][]{\omdsetkeys{symboldec}{#1}\sref@target +\ifx\symboldec@display\st@flow\else{\stDMemph{\symboldec@type} \symboldec@name:}\fi% +\ifx\symboldec@title\@empty~\else~(\stDMemph{\symboldec@title})\par\fi}{} +\newcommand{\symtype}[2]{Type (#1): #2} +\newif\ifst@indef\st@indeffalse +\newenvironment{definition}[1][]{\omdsetkeys{omtext}{#1}\sref@target\st@indeftrue% +\ifx\omtext@display\st@flow\else% +\ifx\omtext@title\@empty\begin{STdefinitionEnv}\else\begin{STdefinitionEnv}[\omtext@title]\fi\fi% +\ifx\sref@id\@empty\sref@label@id{here}\else% +\sref@label@id{\STpresent{\csname STdefinitionEnvKeyword\endcsname}~\@currentlabel}\fi} +{\ifx\omtext@display\st@flow\else\end{STdefinitionEnv}\fi} +\def\st@definition@kw{Definition} +\theorembodyfont{\upshape} +\newtheorem{STdefinitionEnv}[STtheoremAssEnv]{\st@definition@kw} +\def\notemph#1{{\bf{#1}}} +\def\st@notation@terminate{} +\def\st@notation@initialize{} +\define@statement@env{notation} +\def\st@notation@kw{Notation} +\theorembodyfont{\upshape} +\newtheorem{STnotationEnv}[STtheoremAssEnv]{\st@notation@kw} +\def\st@def@target#1#2{\def\@test{#1}% +\@ifundefined{mod@id}% +{\PackageError{statements}{definiendum in unidentified module}% +{\protect\definiendum, \protect\defin, +\protect\twindef, \protect\atwindef\MessageBreak +may only be called in a module with id key}}% +{\ifst@indef\else\PackageWarning{statements} + {definiendum outside definition context\MessageBreak +\protect\definiendum, \protect\defin, +\protect\twindef, \protect\atwindef\MessageBreak +do not make sense semantically outside a definition.\MessageBreak +Consider wrapping the defining phrase in a \protect\inlinedef}\fi +\ifx\@test\@empty% +\expandafter\sref@target@ifh{sref@#2@\mod@id @target}{}\else% +\expandafter\sref@target@ifh{sref@#1@\mod@id @target}{}\fi}} +\newcommand{\definiendum}[2][]{\st@def@target{#1}{#2}\defemph{#2}} +\newcommand{\notatiendum}[2][]{\notemph{#2}} +\newcommand{\defin}[2][]{\definiendum[#1]{#2}\omdoc@index[#1]{#2}} +\newcommand{\definalt}[3][]{\definiendum[#1]{#2}\omdoc@index[#1]{#3}} +\newcommand{\twindef}[3][]{\st@def@target{#1}{#2-#3}\defemph{#2 #3}\@twin[#1]{#2}{#3}} +\newcommand{\twindefalt}[4][]{\definiendum[#1]{#2}\@twin[#1]{#3}{#4}} +\newcommand{\atwindef}[4][]{\st@def@target{#1}{#2-#3-#4}\defemph{#2 #3 #4}\@atwin[#1]{#2}{#3}{#4}} +\newcommand{\atwindefalt}[5][]{\definiendum[#1]{#2}\@atwin[#1]{#3}{#4}{#5}} +\newcommand{\inlinedef}[2][]{\omdsetkeys{omtext}{#1}\sref@target\sref@label@id{here}\st@indeftrue #2} +\omdaddkey[\mod@id]{termref}{cd} +\omdaddkey{termref}{cdbase} +\omdaddkey{termref}{name} +\omdaddkey{termref}{role} +\def\termref@set#1#2{\def\termref@name{#2}\omdsetkeys{termref}{#1}} +\newcommand{\termref}[2][]{\omdsetkeys{termref}{#1}\st@termref{#2}} +\def\st@termref#1{\ifx\termref@name\@empty\def\termref@name{#1}\fi% +\mod@termref\termref@cd\termref@name{#1}} +\newcommand{\twinref}[3][]{\termref@set{#1}{#2-#3}\st@termref{#2 #3}} +\newcommand{\atwinref}[4][]{\termref@set{#1}{#2-#3-#4}\st@termref{#2 #3 #4}} +\newcommand{\termin}[2][]{\termref[#1]{#2}\index{#2}} +\providecommand{\termemph}[1]{#1} +\providecommand{\defemph}[1]{{\textbf{#1}}} +\providecommand{\stDMemph}[1]{{\textbf{#1}}} +\newcommand{\symref}[2]{\@nameuse{mod@symref@#1}{#2}} +\endinput +%% +%% End of file `statements.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml b/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml new file mode 100644 index 00000000000..709150f1b9d --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml @@ -0,0 +1,322 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('omtext'); +RequirePackage('modules'); +sub lowcase {my ($string) = @_; $string ? return lc(ToString($string)) : return('')}#$ +sub dashed { join('-',map($_->toString,@_));}#$ +sub makeNCName { + my ($name) = @_; + my $ncname=$name; + $ncname=~s/\s/_/g; #Spaces to underscores + $ncname="_$ncname" if $ncname!~/^(\w|_)/; #Ensure start with letter or underscore + ##More to come... + $ncname; +} +sub simple_wrapper { + my @input = @_; + return '' if (!@input); + @input = map(split(/\s*,\s*/,$_->toString),@input); + my $output=join(" ",@input); + $output=~s/(^ )|[{}]//g; #remove leading space and list separator brackets + $output||''; +} +sub hash_wrapper{ + my @input = @_; + return '' if (!@input); + @input = map(split(/\s*,\s*/,$_->toString),@input); + my $output=join(".sym #",@input); + $output=~s/(^\.sym )|[{}]//g; #remove leading space and list separator brackets + "#$output"||''; +} +DefCMPEnvironment('{assertion} OptionalKeyVals:omtext', + "<omdoc:assertion " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "?&KeyVal(#1,'theory')(theory='&KeyVal(#1,'theory')')() " + . "type='&lowcase(&KeyVal(#1,'type'))'>" + . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()" + . "<omdoc:CMP><omdoc:p>#body" + ."</omdoc:assertion>\n"); +DefCMPEnvironment('{example} OptionalKeyVals:omtext', + "<omdoc:example " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "?&KeyVal(#1,'for')(for='&hash_wrapper(&KeyVal(#1,'for'))')()>" + . "<omdoc:CMP><omdoc:p>#body" + . "</omdoc:example>\n"); +DefCMPEnvironment('{axiom} OptionalKeyVals:omtext', + "<omdoc:axiom " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()" + . "<omdoc:CMP><omdoc:p>#body" + . "</omdoc:axiom>\n"); +DefEnvironment('{symboldec} OptionalKeyVals:symboldec', + "<omdoc:symbol " + . " ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')" + . "(xml:id='&makeNCName(&KeyVal(#1,'name')).def.sym')" + . "name='&KeyVal(#1,'name')'>" + . "<dc:description>#body</dc:description>" + ."</omdoc:symbol>\n"); +DefConstructor('\symtype{}{}', + "<omdoc:type system='#1'>#2</omdoc:type>"); +sub definitionBody { + my ($doc, $keyvals, %props) = @_; + my $for = $keyvals->getValue('for') if $keyvals; + my $type = $keyvals->getValue('type') if $keyvals; + my %for_attr=(); + if (ToString($for)) { + $for = ToString($for); + $for =~ s/^{(.+)}$/$1/eg; + foreach (split(/,\s*/,$for)) { + $for_attr{$_}=1; + }} + my @symbols = @{$props{defs} || []}; + foreach my $symb(@symbols) { + next if $for_attr{$symb}; + $for_attr{$symb}=1; + $doc->insertElement('omdoc:symbol', undef, (name=>$symb, "xml:id"=>makeNCName("$symb.def.sym"))); + } + my %attrs = (); + $for = join(" ",(keys %for_attr)); + $attrs{'for'} = $for if $for; + my $id = $keyvals->getValue('id') if $keyvals; + $attrs{'xml:id'} = $id if $id; + $attrs{'type'} = $type if $type; + $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->openElement('omdoc:CMP'); + $doc->openElement('omdoc:p'); + $doc->absorb($props{body}) if $props{body}; + $doc->maybeCloseElement('omdoc:p'); + $doc->maybeCloseElement('omdoc:CMP'); + $doc->closeElement('omdoc:definition'); + return; } +DefCMPEnvironment('{definition} OptionalKeyVals:omtext', sub{definitionBody(@_)}, + afterDigestBegin=>sub { + my ($stomach, $whatsit) = @_; + my @symbols = (); + $whatsit->setProperty(defs=>\@symbols); + AssignValue('defs', \@symbols); return; }, + afterDigest => sub { AssignValue('defs', undef); return; }); +DefCMPEnvironment('{notation} OptionalKeyVals:omtext', + "<omdoc:definition " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').not')()" + . "?&KeyVal(#1,'for')(for='&simple_wrapper(&KeyVal(#1,'for'))')()>" + . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()" + . "<omdoc:CMP><omdoc:p>#body" + . "</omdoc:definition>\n"); +DefConstructor('\notatiendum OptionalKeyVals:notation {}', + "<omdoc:phrase type='notation'>#2</omdoc:phrase>"); +DefConstructor('\definiendum [] {}', + "<omdoc:term role='definiendum' name='#name' cd='#theory'>#2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $whatsit->getArg(2) unless $name; + $whatsit->setProperty(name=>$name->toString); + push(@$addr, $name->toString) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; });#$ +DefConstructor('\defin[]{}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term role='definiendum' name='?#1(#1)(#2)' cd='#theory'>#2</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'><omdoc:idp>#2</omdoc:idp></omdoc:ide>" + ."</omdoc:idx>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $whatsit->getArg(2) unless $name; + push(@$addr, $name->toString) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module'));#$ + return; }, + alias=>'\defin'); +DefConstructor('\definalt[]{}{}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term role='definiendum' name='?#1(#1)(#3)' cd='#theory'>#2</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'><omdoc:idp>#3</omdoc:idp></omdoc:ide>" + ."</omdoc:idx>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $whatsit->getArg(3) unless $name; + push(@$addr, $name->toString) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module'));#$ + return; }, + alias=>'\definalt'); +DefConstructor('\twindef[]{}{}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term role='definiendum' name='?#1(#1)(&dashed(#2,#3))' cd='#theory'>" + . "#2 #3" + . "</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'>" + . "<omdoc:idp>#2</omdoc:idp>" + . "<omdoc:idp>#3</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; +my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $name->toString if $name; + $name = $whatsit->getArg(2)->toString.'-'.$whatsit->getArg(3)->toString unless $name; + push(@$addr, $name) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias=>'\twindef');#$ +DefConstructor('\twindefalt[]{}{}{}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term role='definiendum' name='?#1(#1)(&dashed(#3,#4))' cd='#theory'>" + . "#2" + . "</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'>" + . "<omdoc:idp>#3</omdoc:idp>" + . "<omdoc:idp>#4</omdoc:idp>" + . "</omdoc:ide>" + ."</omdoc:idx>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $name->toString if $name; + $name = $whatsit->getArg(3)->toString.'-'.$whatsit->getArg(4)->toString unless $name; + push(@$addr, $name) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias=>'\twindef');#$ +DefConstructor('\atwindef[]{}{}{}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term role='definiendum' cd='#theory' name='?#1(#1)(&dashed(#2,#3,#4))'>#2 #3 #4</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'>" + . "<omdoc:idp>#2</omdoc:idp>" + . "<omdoc:idp>#3</omdoc:idp>" + . "<omdoc:idp>#4</omdoc:idp>" + . "</omdoc:ide>" + . "</omdoc:idx>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $name->toString if $name; + $name = $whatsit->getArg(2)->toString.'-'.$whatsit->getArg(3)->toString.'-'.$whatsit->getArg(4)->toString unless $name; + push(@$addr, $name) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias=>'\atwindef'); +DefConstructor('\atwindefalt[]{}{}{}{}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term role='definiendum' cd='#theory' name='?#1(#1)(&dashed(#3,#4,#5))'>#2</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'>" + . "<omdoc:idp>#3</omdoc:idp>" + . "<omdoc:idp>#4</omdoc:idp>" + . "<omdoc:idp>#5</omdoc:idp>" + . "</omdoc:ide>" + . "</omdoc:idx>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + my $name = $whatsit->getArg(1); + $name = $name->toString if $name; + $name = $whatsit->getArg(3)->toString.'-'.$whatsit->getArg(4)->toString.'-'.$whatsit->getArg(5)->toString unless $name; + push(@$addr, $name) if ($addr and $name); + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias=>'\atwindef'); +DefConstructor('\inlinedef OptionalKeyVals:omtext {}', sub { + my ($document, $keyvals, $body, %props) = @_; + my $for = $keyvals->getValue('for') if $keyvals; + my %for_attr=(); + if (ToString($for)) { + $for = ToString($for); + $for =~ s/^{(.+)}$/$1/eg; + foreach (split(/,\s*/,$for)) { + $for_attr{$_}=1; + }} + my @symbols = @{$props{defs} || []}; + #Prepare for symbol insertion -insert before the parent of the closest ancestor CMP element + my $original_node = $document->getNode; + my $xc = XML::LibXML::XPathContext->new( $original_node ); + $xc->registerNs('omdoc', 'http://omdoc.org/ns'); + my ($statement_ancestor) = $xc->findnodes('./ancestor::omdoc:CMP/..'); + foreach my $symb(@symbols) { + next if $for_attr{$symb}; + $for_attr{$symb}=1; + my $symbolnode = XML::LibXML::Element->new('symbol'); + $symbolnode->setAttribute(name=>$symb); + $symbolnode->setAttribute("xml:id"=>makeNCName("$symb.def.sym")); + $statement_ancestor->parentNode->insertBefore($symbolnode,$statement_ancestor); + } + #Restore the insertion point + $document->setNode($original_node); + my %attrs = (); + $for = join(" ",(keys %for_attr)); + $attrs{'for'} = $for if $for; + my $id = $keyvals->getValue('id') if $keyvals; + $attrs{'xml:id'} = $id if $id; + $attrs{'type'} = 'inlinedef'; + $document->openElement('omdoc:phrase',%attrs); + $document->absorb($body); + $document->closeElement('omdoc:phrase'); }, + #Prepare 'defs' hooks for \defin and \definiendum symbol names + beforeDigest=>sub { + my @symbols = (); + AssignValue('defs', \@symbols); return; }, + #Adopt collected names as 'defs' property, remove hooks + afterDigest=>sub { + my ($stomach, $whatsit) = @_; + my $defsref = LookupValue('defs'); + my @defs = @$defsref; + $whatsit->setProperty('defs',\@defs); + AssignValue('defs',undef); + return; }); +DefConstructor('\termref OptionalKeyVals:termref {}', + "<omdoc:term cd='&KeyVal(#1,'cd')' name='&KeyVal(#1,'name')'>" + . "#2" + ."</omdoc:term>"); +DefConstructor('\twinref OptionalKeyVals:termref {}{}', + "<omdoc:term cd='&KeyVal(#1,'cd')' name='&KeyVal(#1,'name')'>" + . "#2" + ."</omdoc:term>"); +DefConstructor('\atwinref OptionalKeyVals:termref {}{}{}', + "<omdoc:term cd='&KeyVal(#1,'cd')' name='&KeyVal(#1,'name')'>" + . "#2" + ."</omdoc:term>"); +DefConstructor('\termin OptionalKeyVals:term {}', + "<omdoc:idx>" + . "<omdoc:idt>" + . "<omdoc:term cd='&KeyVal(#1,'cd')' name='&KeyVal(#1,'name')'>#2</omdoc:term>" + . "</omdoc:idt>" + . "<omdoc:ide index='default'><omdoc:idp>#2</omdoc:idp></omdoc:ide>" + . "</omdoc:idx>"); +DefConstructor('\symref{}{}', + "<omdoc:term cd='&LookupValue('symdef.#1.cd')' name='&LookupValue('symdef.#1.name')'>" + . "#2" + ."</omdoc:term>"); +Tag('omdoc:assertion',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:definition',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:example',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:requation',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:axiom',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:symbol',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:type',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:term',afterOpen=>\&numberIt,afterClose=>\&locateIt); +1; |