package LaTeXML::Package::Pool; use strict; use LaTeXML::Package; DeclareOption('extrefs',''); RequirePackage('metakeys'); sub withhash {'#';} DefConstructor('\sref[]{}', ""); DefConstructor('\srefs[]{}', ""); DefConstructor('\srefl[]{}', ""); DefConstructor('\spageref{}', ""); DefConstructor('\makeextrefs{}',''); DefConstructor('\extref[]{}{}', ""); DefConstructor('\theextref',''); DefConstructor('\extpageref[]{}{}', ""); DefConstructor('\theextref',''); DefConstructor('\extrefstyle{}{}',""); DefConstructor('\extrefstyle{}{}',""); DefConstructor('\inputrefs{}{}',''); DefEnvironment('{sequation} OptionalKeyVals', "" . "" . "#body" . "" . "", 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'," ", 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}{}', "#body"); 1;