summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-03-30 23:23:02 +0000
committerKarl Berry <karl@freefriends.org>2012-03-30 23:23:02 +0000
commit849996eca72af498b48b10fbea7f14c4b9d21b8f (patch)
tree2d40d42dfc9fc0b0622212cc220868f98345305f /Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml
parentd82e1c23973fd0271f93686f487bd1cee8dcd947 (diff)
restore stex (ca. 28jan12)
git-svn-id: svn://tug.org/texlive/trunk@25792 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml')
-rw-r--r--Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml56
1 files changed, 56 insertions, 0 deletions
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..5d888c6715a
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/sref/sref.sty.ltxml
@@ -0,0 +1,56 @@
+package LaTeXML::Package::Pool;
+use strict;
+use LaTeXML::Package;
+DeclareOption('extrefs','');
+RequirePackage('metakeys');
+sub withhash {'#';}
+DefConstructor('\sref[]{}',
+ "<omdoc:oref href='&withhash()#2'/>");
+DefConstructor('\srefs[]{}',
+ "<omdoc:oref href='&withhash()#2'/>");
+DefConstructor('\srefl[]{}',
+ "<omdoc:oref href='&withhash()#2'/>");
+DefConstructor('\spageref{}',
+ "<omdoc:oref href='&withhash()#1'/>");
+DefConstructor('\makeextrefs{}','');
+DefConstructor('\extref[]{}{}',
+ "<omdoc:oref href='#2@#3'/>");
+DefConstructor('\theextref','');
+DefConstructor('\extpageref[]{}{}',
+ "<omdoc:oref href='#2@#3'/>");
+DefConstructor('\theextref','');
+DefConstructor('\extrefstyle{}{}',"");
+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*}');
+DefMacro('\withcite{}{}','\begin{withcitation}{#1}#2\citeit\end{withcitation}');
+DefConstructor('\citeit',"<omdoc:citation/> ",
+afterConstruct => sub {
+ my ($document,$whatsit) = @_;
+ # LibXML acrobatics, since we can't talk about the xml:id prior to construction's end
+ # (and please do correct me if this is inaccurate)
+ my $node = $document->getNode;
+ my ($citenode) = $document->findnodes('preceding-sibling::omdoc:citation',$node);
+ my ($phrase_parent) = $document->findnodes('ancestor::ltx:text[@xml:id]',$node);
+ return unless (defined $phrase_parent) && (defined $citenode);
+ my $id = $phrase_parent->getAttribute('xml:id');
+ my $refs = $phrase_parent->getAttribute('citeit-refs');
+ $phrase_parent->removeAttribute('citeit-refs');
+ $citenode->setAttribute('for',$id);
+ $citenode->setAttribute('refs',$refs);
+});#$
+DefEnvironment('{withcitation}{}',
+ "<ltx:text citeit-refs='#1'>#body</ltx:text>");
+1;