RawTeX('
\newif\ifexnotes\exnotesfalse
\newif\ifhints\hintsfalse
\newif\ifsolutions\solutionsfalse
\newif\ifpts\ptsfalse
\newif\ifmin\minfalse
\newif\ifboxed\boxedfalse
\newif\ifextract\extractfalse
');
# -*- CPERL -*-
package LaTeXML::Package::Pool;
use strict;
use LaTeXML::Package;
RequirePackage('sref');
RegisterNamespace('prob'=>"http://omdoc.org/ontology/problems#");
RegisterDocumentNamespace('prob'=>"http://omdoc.org/ontology/problems#");
DefEnvironment('{problem} OptionalKeyVals:problem',
""
. "?&KeyVal(#1,'title')(&KeyVal(#1,'title'))()"
. "?&KeyVal(#1,'min')("
. ""
. "&KeyVal(#1,'min')"
. ")()"
. "?&KeyVal(#1,'pts')("
. ""
. "&KeyVal(#1,'pts')"
. ")()"
. "#body"
."",
afterDigest => sub {
my ($stomach,$kv)=@_;
my $kvi = LookupValue('inclprob');
my @keys = qw(id title min pts);
my @vals = $kvi && map($kvi->getValue($_), @keys);
foreach my $i(0..$#vals) {
$kv->setValue($keys[$i],$vals[$i]) if $vals[$i];
}
return;});#$
DefKeyVal('soln','id','Semiverbatim');
DefKeyVal('soln','height','Semiverbatim');
DefKeyVal('soln','for','Semiverbatim');
DefEnvironment('{solution} OptionalKeyVals:soln',
""
. "#body"
. "");
DefEnvironment('{exnote}',"#body");
DefEnvironment('{hint}',"#body");
DefConstructor('\pts{}',"");
DefConstructor('\min{}',"");
DefKeyVal('prob','pts','Semiverbatim');
DefKeyVal('prob','min','Semiverbatim');
DefKeyVal('prob','title','Semiverbatim');
DefConstructor('\includeproblem OptionalKeyVals:prob Semiverbatim',
""
. "?&KeyVal(#1,'title')(&KeyVal(#1,'title'))()"
. "?&KeyVal(#1,'min')("
. ""
. "&KeyVal(#1,'min')"
. ")()"
. "?&KeyVal(#1,'pts')("
. ""
. "&KeyVal(#1,'pts')"
. ")()"
."",
afterDigest => sub{
my ($stomach,$kv) = @_;
AssignValue('inclprob',$kv) if $kv;
});
Tag('omdoc:exercise',afterOpen=>\&numberIt);
Tag('omdoc:solution',afterOpen=>\&numberIt);
Tag('omdoc:hint',afterOpen=>\&numberIt);
Tag('omdoc:exercise',afterOpen=>\&numberIt,afterClose=>\&locateIt);
Tag('omdoc:solution',afterOpen=>\&numberIt,afterClose=>\&locateIt);
Tag('omdoc:hint',afterOpen=>\&numberIt,afterClose=>\&locateIt);
1;