diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-07 20:49:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-07 20:49:10 +0000 |
commit | ddfe3a4eaf95167482e923d4da3de2917a7dbfbb (patch) | |
tree | 0acc1bb60b37392451f5e79e00c33c487c19abcf /Master/texmf-dist/tex/latex/stex/hwexam | |
parent | a04ae5a947a6b06bc717719f6ad63e6de5cb5af6 (diff) |
stex (7apr16)
git-svn-id: svn://tug.org/texlive/trunk@40320 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/hwexam')
4 files changed, 132 insertions, 131 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls b/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls index 1408b9918f6..44aa7616d1b 100644 --- a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls +++ b/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls @@ -7,28 +7,26 @@ %% hwexam.dtx (with options: `cls') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesClass{hwexam}[2012/01/28 v0.9b assignment and exam documents] -\DeclareOption{test}{\PassOptionsToPackage{\CurrentOption}{hwexam}} -\DeclareOption{multiple}{\PassOptionsToPackage{\CurrentOption}{hwexam}} -\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} -\DeclareOption{extrefs}{\PassOptionsToPackage{\CurrentOption}{sref}} -\DeclareOption{notes}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption{hints}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption{solutions}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption{pts}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption{min}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption{boxed}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption{extract}{\PassOptionsToPackage{\CurrentOption}{problem}} -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{omdoc}} +\ProvidesClass{hwexam}[2016/04/06 v1.1 assignment and exam documents] +\DeclareOption*{ + \PassOptionsToClass{\CurrentOption}{omdoc} + \PassOptionsToPackage{\CurrentOption}{stex} + \PassOptionsToPackage{\CurrentOption}{hwexam} + \PassOptionsToPackage{\CurrentOption}{tikzinput} +} \ProcessOptions \LoadClass{omdoc} \RequirePackage{stex} \RequirePackage{hwexam} +\RequirePackage{tikzinput} \RequirePackage{graphicx} \RequirePackage{a4wide} \RequirePackage{amssymb} \RequirePackage{amstext} \RequirePackage{amsmath} +\newcommand\assig@default@type{\hwexam@assignment@kw} +\addmetakey[\assig@default@type]{document}{hwexamtype} +\def\document@hwexamtype{\assig@default@type} \endinput %% %% End of file `hwexam.cls'. diff --git a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls.ltxml b/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls.ltxml deleted file mode 100644 index 885ada472b4..00000000000 --- a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.cls.ltxml +++ /dev/null @@ -1,26 +0,0 @@ -# -*- CPERL -*- -package LaTeXML::Package::Pool; -use strict; -use LaTeXML::Package; -use LaTeXML::Util::Pathname; -use Cwd qw(cwd abs_path); -DeclareOption('test',,sub {PassOptions('hwexam','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('multiple',sub {PassOptions('hwexam','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('showmeta',sub {PassOptions('metakeys','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('extrefs',sub {PassOptions('sref','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('notes',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('hints',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('solutions',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('pts',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('min',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('boxed',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption('extract',sub {PassOptions('problem','sty',ToString(Digest(T_CS('\CurrentOption')))); }); -DeclareOption(undef,sub {PassOptions('omdoc','cls',ToString(Digest(T_CS('\CurrentOption')))); }); -ProcessOptions(); -LoadClass('omdoc'); -RequirePackage('stex'); -RequirePackage('hwexam'); -RequirePackage('graphicx'); -RequirePackage('amssymb'); -RequirePackage('amstext'); -RequirePackage('amsmath'); diff --git a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty b/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty index db290659ffe..2d2d29157a6 100644 --- a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty +++ b/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty @@ -7,65 +7,134 @@ %% hwexam.dtx (with options: `package') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{hwexam}[2012/01/28 v0.9b homework assignments and exams] -\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} +\ProvidesPackage{hwexam}[2016/04/06 v1.1 homework assignments and exams] +\newif\if@hwexam@mh@\@hwexam@mh@false +\DeclareOption{mh}{\@hwexam@mh@true} \newif\iftest\testfalse -\newif\ifsolutions\solutionsfalse -\DeclareOption{test}{\testtrue\solutionsfalse} +\DeclareOption{test}{\testtrue} \newif\ifmultiple\multiplefalse \DeclareOption{multiple}{\multipletrue} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{problem}} \ProcessOptions \RequirePackage{keyval}[1997/11/10] +\if@hwexam@mh@\RequirePackage{hwexam-mh}\fi \RequirePackage{problem} +\AfterBabelLanguage{ngerman}{\input{hwexam-ngerman.ldf}} +\newcommand\hwexam@assignment@kw{Assignment} +\newcommand\hwexam@given@kw{Given} +\newcommand\hwexam@due@kw{Due} +\newcounter{assignment} +\numberproblemsin{assignment} +\renewcommand\prob@label[1]{\arabic{assignment}.#1} +\srefaddidkey{assig} \addmetakey{assig}{number} \addmetakey*{assig}{title} \addmetakey{assig}{type} \addmetakey{assig}{given} \addmetakey{assig}{due} -\def\given@due#1#2{% -\ifx\assig@given\@empty\else\ifx\assig@due\@empty\else{#1}\fi\fi% -\ifx\assig@given\@empty\else{Given {\assig@given}}\fi% -\ifx\assig@given\@empty\else\ifx\assig@due\@empty\else{, }\fi\fi% -\ifx\assig@due\@empty\else{Due {\assig@due}}\fi% -\ifx\assig@given\@empty\else{\ifx\assig@due\@empty\else{#2}\fi}\fi} +\addmetakey[false]{assig}{loadmodules}[true] +\newcommand\given@due[2]{% +\ifx \inclassig@given\@empty +\ifx \assig@given\@empty +\ifx \inclassig@due\@empty +\ifx \assig@due\@empty% all empty do nothing +\else #1% +\fi +\else #1% +\fi +\else #1% +\fi +\else #1% +\fi +\ifx\inclassig@given\@empty +\ifx\assig@given\@empty% do nothing +\else \hwexam@given@kw\xspace \assig@given% +\fi +\else \hwexam@given@kw\xspace \inclassig@given% +\fi +\ifx \inclassig@due\@empty +\ifx \assig@due\@empty% do nothing +\else +\ifx \inclassig@given\@empty +\ifx \assig@given\@empty% do nothing +\else ,~% +\fi +\else ,~% +\fi +\fi +\else +\ifx \inclassig@given\@empty +\ifx \assig@given\@empty% do nothing +\else ,~% +\fi +\else ,~% +\fi +\fi +\ifx \inclassig@due\@empty +\ifx \assig@due\@empty% do nothing +\else \hwexam@due@kw\xspace \assig@due% +\fi +\else \hwexam@due@kw\xspace \inclassig@due% +\fi +\ifx \inclassig@given\@empty +\ifx \assig@given\@empty +\ifx \inclassig@due\@empty +\ifx \assig@due\@empty% all empty do nothing +\else #2% +\fi +\else #2% +\fi +\else #2% +\fi +\else #2% +\fi +} +\newcommand\assignment@title[3] +{\ifx\inclassig@title\@empty% if there is no outside title +\ifx\assig@title\@empty{#1}\else{#2\assig@title{#3}}\fi +\else{#2}\inclassig@title{#3}\fi}% else show the outside title +\newcommand\assignment@number% +{\ifx\inclassig@number\@empty% if there is no outside number +\ifx\assig@number\@empty\else\assig@number\fi +\else\inclassig@number\fi}% else show the outside number +\newenvironment{assignment}[1][]{\metasetkeys{assig}{#1}\sref@target% +\edef\@@num{\assignment@number}% +\ifx\@@num\@empty\stepcounter{assignment}\else\setcounter{assignment}{\@@num}\fi% +\setcounter{problem}{0}% +\def\current@section@level{\document@hwexamtype}% +\sref@label@id{\document@hwexamtype \thesection}% +\begin{@assignment}} +{\end{@assignment}} +\def\@@asstitle{\protect\document@hwexamtype~\arabic{assignment}% +\assignment@title{}{\;(}{)\;} -- \given@due{}{}} \ifmultiple -\def\assignment@titleblock{% -\@ifundefined{assig@number}{\stepcounter{section}}{\setcounter{section}{\assig@number}}% -\section*{\protect\document@hwexamtype~\arabic{section}:~\assig@title\given@due{\\(})}% -\addcontentsline{toc}{section}{\document@hwexamtype~{\arabic{section}}:~\assig@title}% -\setcounter{problem}{0}} +\newenvironment{@assignment}% +{\ifx\assig@loadmodules\@true +\begin{omgroup}[loadmodules]{\@@asstitle} \else -\def\assignment@titleblock{% -\setcounter{section}{\assig@number} -\begin{center}\bf -\Large\@title\\ -\document@hwexamtype~\assig@number:~\assig@title\strut\\ -\large{\given@due()} +\begin{omgroup}{\@@asstitle} +\fi} +{\end{omgroup}} +\else +\newenvironment{@assignment} +{\begin{center}\bf +\Large\@title\strut\\ +\document@hwexamtype~\arabic{assignment}\assignment@title{\;}{:\;}{\\}% +\large\given@due{--\;}{\;--} \end{center}} -\fi -\def\assignment@process@keys#1{\metasetkeys{assig}{#1} -\ifx\inclassig@title\@empty\else\def\assig@title{\inclassig@title}\fi -\ifx\inclassig@type\@empty\else\def\assig@type{\inclassig@type}\fi -\ifx\inclassig@number\@empty\else\def\assig@number{\inclassig@number}\fi -\ifx\inclassig@due\@empty\else\def\assig@due{\inclassig@due}\fi -\ifx\inclassig@given\@empty\else\def\assig@given{\inclassig@given}\fi} -\def\inclassig@title{} -\def\inclassig@type{} -\def\inclassig@number{} -\def\inclassig@due{} -\def\inclassig@given{} -\newenvironment{assignment}[1][]{\assignment@process@keys{#1}% -\assignment@titleblock}{} -\def\assig@default@type{Assignment} -\addmetakey[\assig@default@type]{document}{hwexamtype} +{} +\fi% multiple \addmetakey{inclassig}{number} -\addmetakey{inclassig}{title} +\addmetakey*{inclassig}{title} \addmetakey{inclassig}{type} \addmetakey{inclassig}{given} \addmetakey{inclassig}{due} -\newcommand{\includeassignment}[2][]{\metasetkeys{inclassig}{#1}\include{#2}} -\newcommand{\inputassignment}[2][]{\metasetkeys{inclassig}{#1}\input{#2}} +\addmetakey{inclassig}{mhrepos} +\clear@inclassig@keys%initially +\newcommand\includeassignment[2][]{\metasetkeys{inclassig}{#1}% +\include{#2}\clear@inclassig@keys} +\newcommand\inputassignment[2][]{\metasetkeys{inclassig}{#1}% +\input{#2}\clear@inclassig@keys} \addmetakey{quizheading}{tas} \newcommand\quizheading[1]{\def\@tas{#1}% \large\noindent NAME: \hspace{8cm} MAILBOX:\\[2ex]% @@ -97,28 +166,28 @@ bonus points. \vfill one problem.}\vfill\par\correction@table \\[3ex] \end{center}} {\newpage} -\def\testspace#1{\iftest\vspace*{#1}\fi} -\def\testnewpage{\iftest\newpage\fi} -\def\testemptypage{\iftest\begin{center}This page was intentionally left +\newcommand\testspace[1]{\iftest\vspace*{#1}\fi} +\newcommand\testnewpage{\iftest\newpage\fi} +\newcommand\testemptypage[1][]{\iftest\begin{center}This page was intentionally left blank for extra space\end{center}\vfill\eject\else\fi} -\def\@problem#1#2#3{\stepcounter{assignment@probs} -\def\@test{#2}\ifx\@test\@empty\else\addtocounter{assignment@totalpts}{#2}\fi -\def\@test{#3}\ifx\@test\@empty\else\addtocounter{assignment@totalmin}{#3}\fi +\renewcommand\@problem[3]{\stepcounter{assignment@probs} +\def\@@pts{#2}\ifx\@@pts\@empty\else\addtocounter{assignment@totalpts}{#2}\fi +\def\@@min{#3}\ifx\@@min\@empty\else\addtocounter{assignment@totalmin}{#3}\fi \xdef\correction@probs{\correction@probs & #1}% \xdef\correction@pts{\correction@pts & #2} \xdef\correction@reached{\correction@reached &}} \newcounter{assignment@probs} \newcounter{assignment@totalpts} \newcounter{assignment@totalmin} -\def\correction@probs{prob.}% -\def\correction@pts{total}% -\def\correction@reached{reached}% +\newcommand\correction@probs{prob.}% +\newcommand\correction@pts{total}% +\newcommand\correction@reached{reached}% \stepcounter{assignment@probs} -\def\correction@table{\begin{tabular}{|l|*{\theassignment@probs}{c|}|p{3cm}|}\hline% -&\multicolumn{\theassignment@probs}{c||}% +\newcommand\correction@table{\begin{tabular}{|l|*{\theassignment@probs}{c|}|l|}\hline% +&\multicolumn{\theassignment@probs}{c||}%| {\footnotesize To be used for grading, do not write here} &\\\hline \correction@probs & Sum & grade\\\hline -\correction@pts &\theassignment@totalpts & \strut\hspace{3cm}\strut\\\hline +\correction@pts &\theassignment@totalpts & \\\hline \correction@reached & & \\[.7cm]\hline \end{tabular}} \endinput diff --git a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty.ltxml b/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty.ltxml deleted file mode 100644 index 4532b9f2fb1..00000000000 --- a/Master/texmf-dist/tex/latex/stex/hwexam/hwexam.sty.ltxml +++ /dev/null @@ -1,40 +0,0 @@ -# -*- CPERL -*- -package LaTeXML::Package::Pool; -use strict; -use LaTeXML::Package; -RequirePackage('problem'); -RegisterNamespace('assig'=>"http://omdoc.org/ontology/assignments#"); -RegisterDocumentNamespace('assig'=>"http://omdoc.org/ontology/assignments#"); -DefEnvironment('{assignment} OptionalKeyVals:assig', - "<omdoc:omgroup ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " - . "assig:dummy='for the namespace'>" - . "<omdoc:metadata>" - . "<dc:title>" - . "Assignment ?&KeyVal(#1,'num')(&KeyVal(#1,'num').)()" - . "?&KeyVal(#1,'title')((&KeyVal(#1,'title')))" - . "</dc:title>" - . "?&KeyVal(#1,'given')(<omdoc:meta property='assig:given'>&KeyVal(#1,'given')</omdoc:meta>)()" - . "?&KeyVal(#1,'due')(<omdoc:meta property='assig:due'>&KeyVal(#1,'due')</omdoc:meta>)()" - . "?&KeyVal(#1,'pts')(<omdoc:meta property='assig:pts'>&KeyVal(#1,'pts')</omdoc:meta>)()" - . "</omdoc:metadata>" - . "#body" - ."</omdoc:omgroup>\n", - afterDigest=> sub { - my ($stomach, $kv) = @_; - my $kvi = LookupValue('inclassig'); - my @keys = qw(id num title pts given due); - my @vals = $kvi && map($kvi->getValue($_), @keys); - foreach my $i(0..$#vals) { - $kv->setValue($keys[$i],$vals[$i]) if $vals[$i]; - }});#$ -DefMacro('\includeassignment [] {}', sub { - my ($stomach, $arg1, $arg2) = @_; - AssignValue('inclassig',$arg1) if $arg1; - (Invocation(T_CS('\input'),$arg2)->unlist); -}); -DefMacro('\inputassignment [] {}','\input{#2}'); -DefEnvironment('{testheading}OptionalKeyVals:omdoc',''); -DefConstructor('\testspace{}',''); -DefConstructor('\testnewpage',''); -DefConstructor('\testemptypage',''); -1; |