diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/problem/problem.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/stex/problem/problem.dtx | 130 |
1 files changed, 84 insertions, 46 deletions
diff --git a/Master/texmf-dist/source/latex/stex/problem/problem.dtx b/Master/texmf-dist/source/latex/stex/problem/problem.dtx index 97346c6c729..7661efe7906 100644 --- a/Master/texmf-dist/source/latex/stex/problem/problem.dtx +++ b/Master/texmf-dist/source/latex/stex/problem/problem.dtx @@ -1,8 +1,8 @@ % \iffalse meta-comment % An Infrastructure for Problems -% $URL: https://svn.kwarc.info/repos/stex-content/sty/problem/problem.dtx $ -% $Rev: 2674 $; last modified by $Author: deyan $ -% $Date: 2010-03-24 04:09:39 +0100 (Wed, 24 Mar 2010) $ +% $URL: https://svn.kwarc.info/repos/stex/trunk/sty/problem/problem.dtx $ +% $Rev: 1671 $; last modified by $Author: kohlhase $ +% $Date: 2010-11-06 08:05:15 +0100 (Sat, 06 Nov 2010) $ % Copyright (c) 2006-2008 Michael Kohlhase, all rights reserved % this file is released under the % LaTeX Project Public License (LPPL) @@ -14,20 +14,27 @@ % %<*driver> \documentclass{ltxdoc} -\usepackage{url,float} -\usepackage[show]{ed} -\usepackage{latexml} +\usepackage{url,float,latexml} \usepackage[solutions,hints,notes]{problem} +\usepackage[show]{ed} +\usepackage[hyperref=auto,style=alphabetic]{biblatex} +\bibliography{kwarc} +\usepackage[eso-foot,today]{svninfo} +\svnInfo $Id: problem.dtx 1671 2010-11-06 07:05:15Z kohlhase $ +\svnKeyword $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/problem/problem.dtx $ +\usepackage{stex-logo} +\usepackage{../ctansvn} \usepackage{hyperref} \makeindex \floatstyle{boxed} \newfloat{exfig}{thp}{lop} \floatname{exfig}{Example} +\def\tracissue#1{\cite{sTeX:online}, \hyperlink{http://trac.kwarc.info/sTeX/ticket/#1}{issue #1}} \begin{document}\DocInput{problem.dtx}\end{document} %</driver> % \fi % -% \CheckSum{365} +% \iffalse\CheckSum{365}\fi % % \changes{v0.9}{2006/09/18}{First Version with Documentation} % \changes{v0.9a}{2007/01/02}{Renamed to \texttt{problem.sty}} @@ -38,7 +45,7 @@ % % \MakeShortVerb{\|} % -% \title{An Infrastructure for formatting Problems\thanks{Version {\fileversion} (last revised +% \title{\texttt{problem.sty}: An Infrastructure for formatting Problems\thanks{Version {\fileversion} (last revised % {\filedate})}} % \author{Michael Kohlhase\\ % Jacobs University, Bremen\\ @@ -74,15 +81,19 @@ % theses are specified, then the corresponding auxiliary parts of the problems are output, % otherwise, they remain invisible. % -% The \DescribeMacro{boxed} option specifies that problems should be formatted in framed -% boxes so that they are more visible in the text. Finally, the \DescribeMacro{test}|test| -% option signifies that we are in a test sitution, so this option does not show the -% solutions (of course), but leaves space for the students to solve them. +% The \DescribeMacro{boxed}|boxed| option specifies that problems should be formatted in +% framed boxes so that they are more visible in the text. Finally, the +% \DescribeMacro{test}|test| option signifies that we are in a test sitution, so this +% option does not show the solutions (of course), but leaves space for the students to +% solve them. % % The \DescribeMacro{extract}|extract| option can be set if we want to extract a problems % file, e.g. to display the solutions, see Section~\ref{sec:user:includeproblem} for a % discussion. % +% Finally, if the \DescribeMacro{showmeta}|showmeta| is set, then the metadata keys are +% shown (see~\cite{Kohlhase:metakeys:ctan} for details and customization options). +% % \subsection{Problems and Solutions}\label{sec:user:probsols} % % \DescribeEnv{problem} The main enviornment provided by the |problem| package is @@ -174,11 +185,27 @@ % options are set. This allows to give students hints about the estimated time and the % points to be awarded. % +% \section{Limitations}\label{sec:limitations} +% +% In this section we document known limitations. If you want to help alleviate them, +% please feel free to contact the package author. Some of them are currently discussed in +% the \sTeX TRAC~\cite{sTeX:online}. +% \begin{compactenum} +% \item none reported yet +% \end{compactenum} +% % \StopEventually{\newpage\PrintChanges} % \newpage % % \section{The Implementation}\label{sec:implementation} % +% The |problem| package generates two files: the {\LaTeX} package (all the code between +% {\textsf{$\langle$*package$\rangle$}} and {\textsf{$\langle$/package$\rangle$}}) and the +% {\LaTeXML} bindings (between {\textsf{$\langle$*ltxml$\rangle$ and +% $\langle$/ltxml$\rangle$}}). We keep the corresponding code fragments together, +% since the documentation applies to both of them and to prevent them from getting out of +% sync. +% % \subsection{Package Options}\label{sec:impl:options} % % The first step is to declare (a few) package options that handle whether certain @@ -187,6 +214,7 @@ % % \begin{macrocode} %<*package> +\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} \newif\ifexnotes\exnotesfalse\DeclareOption{notes}{\exnotestrue} \newif\ifhints\hintsfalse\DeclareOption{hints}{\hintstrue} \newif\ifsolutions\solutionsfalse\DeclareOption{solutions}{\solutionstrue} @@ -198,6 +226,20 @@ %</package> % \end{macrocode} % +% On the {\LaTeXML} side we only make sure that the switches are defined +% \begin{macrocode} +%<*ltxml> +RawTeX(' +\newif\ifexnotes\exnotesfalse +\newif\ifhints\hintsfalse +\newif\ifsolutions\solutionsfalse +\newif\ifpts\ptsfalse +\newif\ifmin\minfalse +\newif\ifboxed\boxedfalse +\newif\ifextract\extractfalse +'); +%</ltxml> +% \end{macrocode} % Then we make sure that the necessary packages are loaded (in the right versions). % \begin{macrocode} %<*package> @@ -236,10 +278,10 @@ RegisterDocumentNamespace('prob'=>"http://omdoc.org/ontology/problems#"); % \begin{macrocode} %<*package> \srefaddidkey[prefix=prob.]{problem} -\omdaddkey{problem}{pts} -\omdaddkey{problem}{min} -\omdaddkey{problem}{title} -\omdaddkey{problem}{refnum} +\addmetakey{problem}{pts} +\addmetakey{problem}{min} +\addmetakey*{problem}{title} +\addmetakey{problem}{refnum} % \end{macrocode} % % Then we set up a box and a counter for problems @@ -280,18 +322,18 @@ RegisterDocumentNamespace('prob'=>"http://omdoc.org/ontology/problems#"); % \begin{environment}{problem} % \begin{macrocode} \ifboxed -\newenvironment{problem}[1][]{\omdsetkeys{problem}{#1}\sref@target% +\newenvironment{problem}[1][]{\metasetkeys{problem}{#1}\sref@target% \stepcounter{problem}\show@pts\show@min\record@problem% -\begin{lrbox}{\probbox}\begin{minipage}{.9\textwidth}} +\begin{lrbox}{\probbox}\begin{minipage}{.9\textwidth}\ignorespaces} {\end{minipage}\end{lrbox} \setbox0=\hbox{\begin{minipage}{.9\textwidth}% \noindent\textbf\prob@heading\rm% \end{minipage}} \smallskip\noindent\fbox{\vbox{\box0\vspace*{.2em}\usebox\probbox}}\smallskip} \else -\newenvironment{problem}[1][]{\omdsetkeys{problem}{#1}\sref@target% +\newenvironment{problem}[1][]{\metasetkeys{problem}{#1}\sref@target% \stepcounter{problem}\show@pts\show@min\record@problem% -\par\noindent\textbf\prob@heading\rm} +\par\noindent\textbf\prob@heading\rm\ignorespaces} {\smallskip} \fi%boxed %</package> @@ -305,15 +347,14 @@ RegisterDocumentNamespace('prob'=>"http://omdoc.org/ontology/problems#"); %<*ltxml> DefCMPEnvironment('{problem} OptionalKeyVals:problem', "<omdoc:exercise ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()" - . "prob:dummy='for the namespace'" - . "?#locator(stex:srcref='#locator')()>" - . "?&KeyVal(#1,'title')(<dc:title ?#locator(stex:srcref='#locator')()>&KeyVal(#1,'title')</dc:title>)()" - . "?&KeyVal(#1,'min')(<omdoc:meta property='prob:solvedinminutes' " - . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'min')</omdoc:meta>)()" - . "?&KeyVal(#1,'pts')(<omdoc:meta property='prob:points' " - . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'pts')</omdoc:meta>)()" - . "<omdoc:CMP ?#locator(stex:srcref='#locator')()><omdoc:p>#body" - ."</omdoc:exercise>\n"); + . "?#locator(stex:srcref='#locator')()>" + . "?&KeyVal(#1,'title')(<dc:title ?#locator(stex:srcref='#locator')()>&KeyVal(#1,'title')</dc:title>)()" + . "?&KeyVal(#1,'min')(<omdoc:meta property='prob:solvedinminutes' prob:dummy='for the namespace' " + . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'min')</omdoc:meta>)()" + . "?&KeyVal(#1,'pts')(<omdoc:meta property='prob:points' prob:dummy='for the namespace' " + . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'pts')</omdoc:meta>)()" + . "<omdoc:CMP ?#locator(stex:srcref='#locator')()><omdoc:p>#body" + ."</omdoc:exercise>\n"); %</ltxml> % \end{macrocode} % @@ -394,14 +435,12 @@ DefCMPEnvironment('{solution} OptionalKeyVals:soln', DefCMPEnvironment('{exnote}', "<omdoc:hint ?#locator(stex:srcref='#locator')()>" . "<omdoc:CMP ?#locator(stex:srcref='#locator')()>" - . "<omdoc:p>#body<omdoc:p>" - . "</omdoc:CMP>" + . "<omdoc:p>#body" ."</omdoc:hint>"); DefCMPEnvironment('{hint}', "<omdoc:hint ?#locator(stex:srcref='#locator')()>" . "<omdoc:CMP ?#locator(stex:srcref='#locator')()>" - . "<omdoc:p>#body</omdoc:p>" - . "</omdoc:CMP>" + . "<omdoc:p>#body" ."</omdoc:hint>"); DefConstructor('\pts{}',""); DefConstructor('\min{}',""); @@ -434,13 +473,13 @@ DefConstructor('\min{}',""); % % \begin{macrocode} %<*package> -\omdaddkey{inclprob}{pts} -\omdaddkey{inclprob}{min} -\omdaddkey{inclprob}{title} -\omdaddkey{inclprob}{refnum} +\addmetakey{inclprob}{pts} +\addmetakey{inclprob}{min} +\addmetakey*{inclprob}{title} +\addmetakey{inclprob}{refnum} \clear@inclprob@keys \newcommand{\includeproblem}[2][]{% -\bgroup\omdsetkeys{inclprob}{#1}\input{#2}\ifsolutions\newpage\fi\egroup +\bgroup\metasetkeys{inclprob}{#1}\input{#2}\ifsolutions\newpage\fi\egroup \ifextract\def\@test{#1} \def\prob@num{\ifx\inclprob@refnum\@empty\thesection.\theproblem\else\inclprob@refnum\fi} \def\inclprob@keys{#1\ifx\@test\@empty\else,\fi refnum=\prob@num} @@ -452,14 +491,13 @@ DefKeyVal('prob','pts','Semiverbatim'); DefKeyVal('prob','min','Semiverbatim'); DefKeyVal('prob','title','Semiverbatim'); DefConstructor('\includeproblem OptionalKeyVals:prob Semiverbatim', - "<omdoc:ref xref='#2' ?#locator(stex:srcref='#locator')() " - . "prob:dummy='for the namespace'>" - . "?&KeyVal(#1,'title')(<dc:title ?#locator(stex:srcref='#locator')()>&KeyVal(#1,'title')</dc:title>)()" - . "?&KeyVal(#1,'min')(<omdoc:meta property='prob:solvedinminutes' " - . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'min')</omdoc:meta>)()" - . "?&KeyVal(#1,'pts')(<omdoc:meta property='prob:points' " - . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'pts')</omdoc:meta>)()" - ."</omdoc:ref>"); + "<omdoc:ref type='cite' xref='#2' ?#locator(stex:srcref='#locator')()>" + . "?&KeyVal(#1,'title')(<dc:title ?#locator(stex:srcref='#locator')()>&KeyVal(#1,'title')</dc:title>)()" + . "?&KeyVal(#1,'min')(<omdoc:meta property='prob:solvedinminutes' prob:dummy='for the namespace' " + . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'min')</omdoc:meta>)()" + . "?&KeyVal(#1,'pts')(<omdoc:meta property='prob:points' prob:dummy='for the namespace' " + . "?#locator(stex:srcref='#locator')()>&KeyVal(#1,'pts')</omdoc:meta>)()" + ."</omdoc:ref>"); %</ltxml> % \end{macrocode} % \end{macro} |