summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/problem
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-07 20:49:10 +0000
committerKarl Berry <karl@freefriends.org>2016-04-07 20:49:10 +0000
commitddfe3a4eaf95167482e923d4da3de2917a7dbfbb (patch)
tree0acc1bb60b37392451f5e79e00c33c487c19abcf /Master/texmf-dist/source/latex/stex/problem
parenta04ae5a947a6b06bc717719f6ad63e6de5cb5af6 (diff)
stex (7apr16)
git-svn-id: svn://tug.org/texlive/trunk@40320 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/problem')
-rw-r--r--Master/texmf-dist/source/latex/stex/problem/problem.dtx482
-rw-r--r--Master/texmf-dist/source/latex/stex/problem/problem.ins8
2 files changed, 186 insertions, 304 deletions
diff --git a/Master/texmf-dist/source/latex/stex/problem/problem.dtx b/Master/texmf-dist/source/latex/stex/problem/problem.dtx
index b498c90c04e..546ca44273f 100644
--- a/Master/texmf-dist/source/latex/stex/problem/problem.dtx
+++ b/Master/texmf-dist/source/latex/stex/problem/problem.dtx
@@ -1,31 +1,31 @@
% \iffalse meta-comment
% An Infrastructure for Problems
-% $URL: https://svn.kwarc.info/repos/stex/trunk/sty/problem/problem.dtx $
-% $Rev: 1999 $; last modified by $Author: kohlhase $
-% $Date: 2012-01-28 08:32:11 +0100 (Sat, 28 Jan 2012) $
% Copyright (c) 2006-2008 Michael Kohlhase, all rights reserved
% this file is released under the
% LaTeX Project Public License (LPPL)
+% The original of this file is in the public repository at
+% http://github.com/KWARC/sTeX/
% \fi
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<package>\ProvidesPackage{problem}[2012/01/28 v0.9c Semantic Markup for Problems]
+%<package>\ProvidesPackage{problem}[2016/04/07 v1.2 Semantic Markup for Problems]
%
%<*driver>
\documentclass{ltxdoc}
-\usepackage{url,float,latexml}
+\usepackage{url,float,xspace}
\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 1999 2012-01-28 07:32:11Z kohlhase $
-\svnKeyword $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/problem/problem.dtx $
+\addbibresource{kwarcpubs.bib}
+\addbibresource{extpubs.bib}
+\addbibresource{kwarccrossrefs.bib}
+\addbibresource{extcrossrefs.bib}
\usepackage{stex-logo}
-\usepackage{../ctansvn}
+\usepackage{ctangit}
\usepackage{hyperref}
\makeindex
+\def\latexml{\hbox{{\LaTeX}ML}\xspace}
\floatstyle{boxed}
\newfloat{exfig}{thp}{lop}
\floatname{exfig}{Example}
@@ -34,12 +34,14 @@
%</driver>
% \fi
%
-% \CheckSum{396}
+% \CheckSum{318}
%
% \changes{v0.9}{2006/09/18}{First Version with Documentation}
% \changes{v0.9a}{2007/01/02}{Renamed to \texttt{problem.sty}}
-% \changes{v0.9b}{2008/10/01}{added extraction}
% \changes{v0.9c}{2010/01/03}{based on \texttt{omd.sty} now}
+% \changes{v1.0}{2013/10/09}{adding \texttt{\textbackslash start/stopsolution}}
+% \changes{v1.1}{2013/12/12}{adding MathHub support}
+% \changes{v1.2}{2015/11/04}{moving MathHub support out to separate package}
%
% \GetFileInfo{problem.sty}
%
@@ -62,7 +64,7 @@
%
% The |problem| package supplies an infrastructure that allows specify problem. Problems
% are text fragments that come with auxiliary functions: hints, notes, and
-% solutions\footnote{for the momenet multiple choice problems are not supported, but may
+% solutions\footnote{for the moment multiple choice problems are not supported, but may
% well be in a future version}. Furthermore, we can specify how long the solution to a
% given problem is estimated to take and how many points will be awarded for a perfect
% solution.
@@ -83,22 +85,18 @@
%
% 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
+% \DescribeMacro{test}|test| option signifies that we are in a test situation, 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
+% \DescribeEnv{problem} The main environment provided by the |problem| package is
% (surprise surprise) the |problem| environment. It is used to mark up problems and
-% excercises. The environment takes an optional KeyVal argument with the keys
+% exercises. The environment takes an optional KeyVal argument with the keys
% \DescribeMacro{id}|id| as an identifier that can be reference later,
% \DescribeMacro{pts}|pts| for the points to be gained from this exercise in homework or
% quiz situations, \DescribeMacro{min}|min| for the estimated minutes needed to solve the
@@ -112,11 +110,15 @@
% \begin{document}
% \begin{problem}[id=elefants,pts=10,min=2,title=Fitting Elefants]
% How many Elefants can you fit into a Volkswagen beetle?
-% \begin{hint} Think positively, this is simple!\end{hint}
-% \begin{exnote}Justify your answer\end{exnote}
-% \begin{solution}[for=elefants,height=3cm]
-% Four, two in the front seats, and two in the back.
-% \end{solution}
+% \begin{hint}
+% Think positively, this is simple!
+% \end{hint}
+% \begin{exnote}
+% Justify your answer
+% \end{exnote}
+% \begin{solution}[for=elefants,height=3cm]
+% Four, two in the front seats, and two in the back.
+% \end{solution}
% \end{problem}
% \end{document}
% \end{verbatim}
@@ -136,20 +138,32 @@
% \begin{minipage}{.9\linewidth}
% \begin{problem}[id=elefants.prob,title=Fitting Elefants]
% How many Elefants can you fit into a Volkswagen beetle?
-% \begin{hint} Think positively, this is simple!\end{hint}
-% \begin{exnote}Justify your answer\end{exnote}
-% \begin{solution}%[for=elefants.prob,height=3cm]
-% Four, two in the front seats, and two in the back.
-% \end{solution}
+% \begin{hint}
+% Think positively, this is simple!
+% \end{hint}
+% \begin{exnote}
+% Justify your answer
+% \end{exnote}
+% \smallskip\noindent\hrule\textbf{Solution:}
+% Four, two in the front seats, and two in the back.
+% \hrule
% \end{problem}
% \end{minipage}
-% \caption{The Formmatted Problem from Figure~\ref{fig:problem}}\label{fig:result}
+% \caption{The Formatted Problem from Figure~\ref{fig:problem}}\label{fig:result}
% \end{exfig}
%
% \DescribeEnv{hint}\DescribeEnv{note}, the |hint| and |exnote| environments can be used
-% in a |problem| enviroment to give hints and to make notes that elaborate certain aspects
+% in a |problem| environment to give hints and to make notes that elaborate certain aspects
% of the problem.
+%
+% \subsection{Starting and Stopping Solutions}
%
+% Sometimes we would like to locally override the |solutions| option we have given to the
+% package. To turn on solutions we use the
+% \DescribeMacro{\startsolutions}|\startsolutions|, to turn them off,
+% \DescribeMacro{\stopsolutions}|\stopsolutions|. These two can be used at any point in
+% the documents.
+%
% \subsection{Including Problems}\label{sec:user:includeproblem}
%
% The \DescribeMacro{\includeproblem}|\includeproblem| macro can be used to include a
@@ -161,24 +175,12 @@
% (if given) overwrite the ones specified in the |problem| environment in the included
% file.
%
-% Sometimes we want to collect all the included problems into a separate file that can be
-% typeset independently. The main application is to have course notes into which the
-% problems are included (usually in boxed form to distinguish them from the rest of the
-% text and without solutions) and to have the problems with solutions in a separate file
-% (to encourage students to try and solve the problems before looking up solutions). In
-% this situation set the \DescribeMacro{extract}|extract| option on the notes file
-% \meta{notes}|.tex|, which causes a file \meta{notes}|-solutions.tex| to be generated
-% that has the |\includeproblem| statements with the respective numbers from the main
-% document. This can then be imported into a document with the respective front and
-% backmatter. In particular the frontmatter of the importing will ususlly specify the
-% \DescribeMacro{solutions}|solutions| option to generate solutions.
-%
% \subsection{Reporting Metadata}\label{sec:user:reporting}
%
% The sum of the points and estimated minutes (that we specified in the |pts| and |min|
% keys to the |problem| environment or the |\includeproblem| macro) to the log file and
% the screen after each run. This is useful in preparing exams, where we want to make sure
-% that the students can indeed solve the problems in an alotted time period.
+% that the students can indeed solve the problems in an allotted time period.
%
% The |\min| and |\pts| macros allow to specify (i.e. to print to the margin) the
% distribution of time and reward to parts of a problem, if the |pts| and |pts| package
@@ -189,7 +191,7 @@
%
% 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}.
+% the \sTeX GitHub repository~\cite{sTeX:github:on}.
% \begin{compactenum}
% \item none reported yet
% \end{compactenum}
@@ -199,13 +201,6 @@
%
% \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
@@ -214,69 +209,49 @@
%
% \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}
-\newif\ifpts\ptsfalse\DeclareOption{pts}{\ptstrue}
-\newif\ifmin\minfalse\DeclareOption{min}{\mintrue}
-\newif\ifboxed\boxedfalse\DeclareOption{boxed}{\boxedtrue}
-\newif\ifextract\extractfalse\DeclareOption{extract}{\extracttrue}
-\ProcessOptions
-%</package>
-% \end{macrocode}
-%
-% On the {\LaTeXML} side we only make sure that the switches are defined
-% \begin{macrocode}
-%<*ltxml>
-RawTeX('
+\newif\if@problem@mh@\@problem@mh@false
+\DeclareOption{mh}{\@problem@mh@true}
\newif\ifexnotes\exnotesfalse
+\DeclareOption{notes}{\exnotestrue}
\newif\ifhints\hintsfalse
+\DeclareOption{hints}{\hintstrue}
\newif\ifsolutions\solutionsfalse
+\DeclareOption{solutions}{\solutionstrue}
\newif\ifpts\ptsfalse
+\DeclareOption{pts}{\ptstrue}
\newif\ifmin\minfalse
+\DeclareOption{min}{\mintrue}
\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>
-\RequirePackage{keyval}[1997/11/10]
-\RequirePackage{xcomment}
-\RequirePackage{sref}
-%</package>
+\DeclareOption{boxed}{\boxedtrue}
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{omtext}}
+\ProcessOptions
% \end{macrocode}
%
-% Here comes the equivalent header information for {\LaTeXML}, we also initialize the
-% package inclusions. Since {\LaTeXML} currently does not process package options, we have
-% nothing to do.
+% Then we make sure that the necessary packages are loaded (in the right versions).
% \begin{macrocode}
-%<*ltxml>
-# -*- CPERL -*-
-package LaTeXML::Package::Pool;
-use strict;
-use LaTeXML::Package;
-RequirePackage('sref');
-%</ltxml>
+\if@problem@mh@\RequirePackage{problem-mh}\fi
+\RequirePackage{omtext}
+\RequirePackage{comment}
+\RequirePackage{mdframed}
+\RequirePackage[base]{babel}
% \end{macrocode}
%
-% Then we register the namespace of the requirements ontology
+% \begin{macro}{\prob@*@kw}
+% For multilinguality, we define internal macros for keywords that can be specialized in
+% |*.ldf| files.
% \begin{macrocode}
-%<*ltxml>
-RegisterNamespace('prob'=>"http://omdoc.org/ontology/problems#");
-RegisterDocumentNamespace('prob'=>"http://omdoc.org/ontology/problems#");
-%</ltxml>
+\AfterBabelLanguage{ngerman}{\input{problem-ngerman.ldf}}
+\def\prob@problem@kw{Problem}
+\def\prob@solution@kw{Solution}
% \end{macrocode}
-%
+% \end{macro}
+%
% \subsection{Problems and Solutions}\label{sec:impl:probsols}
%
% We now prepare the KeyVal support for problems. The key macros just set appropriate
% internal macros.
%
% \begin{macrocode}
-%<*package>
\srefaddidkey[prefix=prob.]{problem}
\addmetakey{problem}{pts}
\addmetakey{problem}{min}
@@ -284,101 +259,77 @@ RegisterDocumentNamespace('prob'=>"http://omdoc.org/ontology/problems#");
\addmetakey{problem}{refnum}
% \end{macrocode}
%
-% Then we set up a box and a counter for problems
-%
+% Then we set up a counter for problems.
+% \begin{macro}{\numberproblemsin}
% \begin{macrocode}
-\newsavebox{\probbox}
-\newcounter{problem}[section]
+\newcounter{problem}
+\newcommand\numberproblemsin[1]{\@addtoreset{problem}{#1}}
% \end{macrocode}
-%
+% \end{macro}
+%
+% \begin{macro}{\prob@label}
+% We provide the macro |\prob@label| to redefine later to get context involved.
+% \begin{macrocode}
+\newcommand\prob@label[1]{#1}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\prob@number}
% We consolidate the problem number into a reusable internal macro
% \begin{macrocode}
-\def\prob@number{\ifx\inclprob@refnum\@empty
-\ifx\problem@refnum\@empty\thesection.\theproblem\else\problem@refnum\fi
-\inclprob@refnum\fi}
+\def\prob@number{\ifx\inclprob@refnum\@empty%
+\ifx\problem@refnum\@empty\prob@label\theproblem%
+\else\prob@label\problem@refnum\fi%
+\else\prob@label\inclprob@refnum\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\prob@title}
+% We consolidate the problem title into a reusable internal macro as well. |\prob@title|
+% takes three arguments the first is the fallback when no title is given at all, the
+% second and third go around the title, if one is given.
+% \begin{macrocode}
+\newcommand\prob@title[3]{%
+\ifx\inclprob@title\@empty% if there is no outside title
+\ifx\problem@title\@empty{#1}\else{#2\problem@title{#3}}\fi
+\else{#2}\inclprob@title{#3}\fi}% else show the outside title
% \end{macrocode}
% \end{macro}
%
-% We consolidate the problem header line into a separate internal macro that can be reused
-% in various settings.
+% With these the problem header is a one-liner
%
% \begin{macro}{\prob@heading}
% We consolidate the problem header line into a separate internal macro that can be
-% reused in various settings.
+% reused in various settings.
% \begin{macrocode}
-\def\prob@heading{Problem \prob@number%
-\ifx\sref@id\@empty\else{\sref@label@id{Problem \thesection.\theproblem}}\fi%
-\ifx\inclprob@title\@empty% if there is no outside title
-\ifx\problem@title\@empty{:\quad}\else{\quad(\problem@title)\hfill\\}\fi
-\else\quad(\inclprob@title)\hfill\\\fi}% else show the outside title
+\def\prob@heading{\prob@problem@kw~\prob@number\prob@title{ }{ (}{)\strut\\}%
+\sref@label@id{\prob@problem@kw~\prob@number}}
% \end{macrocode}
% \end{macro}
%
% With this in place, we can now define the |problem| environment. It comes in two shapes,
% depending on whether we are in boxed mode or not. In both cases we increment the problem
-% number and output the points and minutes (depending) on whehter the respective options
+% number and output the points and minutes (depending) on whether the respective options
% are set.
% \begin{environment}{problem}
% \begin{macrocode}
-\ifboxed
-\newenvironment{problem}[1][]{\metasetkeys{problem}{#1}\sref@target%
-\stepcounter{problem}\show@pts\show@min\record@problem%
-\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][]{\metasetkeys{problem}{#1}\sref@target%
-\stepcounter{problem}\show@pts\show@min\record@problem%
-\par\noindent\textbf\prob@heading\rm\ignorespaces}
+\@in@omtexttrue% we are in a statement (for inline definitions)
+\stepcounter{problem}\record@problem%
+\def\current@section@level{\prob@problem@kw}%
+\par\noindent\textbf\prob@heading\show@pts\show@min\rm\noindent\ignorespaces}
{\smallskip}
-\fi%boxed
-%</package>
+\ifboxed\surroundwithmdframed{problem}\fi
% \end{macrocode}
% \end{environment}
%
-% Note that we allow hints and solutions in the body of a |problem| environment so we have
-% to allow the |omdoc:CMP| and |ltx:p| elements to autoclose.
-%
-% \begin{macrocode}
-%<*ltxml>
-DefEnvironment('{problem} OptionalKeyVals:problem',
- "<omdoc:exercise ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>"
- . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()"
- . "?&KeyVal(#1,'min')("
- . "<omdoc:meta property='prob:solvedinminutes' prob:dummy='for the namespace'>"
- . "&KeyVal(#1,'min')"
- . "</omdoc:meta>)()"
- . "?&KeyVal(#1,'pts')("
- . "<omdoc:meta property='prob:points' prob:dummy='for the namespace'>"
- . "&KeyVal(#1,'pts')"
- . "</omdoc:meta>)()"
- . "<omdoc:CMP><omdoc:p>#body"
- ."</omdoc:exercise>",
- 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;});#$
-%</ltxml>
-% \end{macrocode}
-%
% \begin{macro}{\record@problem}
% This macro records information about the problems in the |*.aux| file.
% \begin{macrocode}
-%<*package>
\def\record@problem{\protected@write\@auxout{}%
{\string\@problem{\prob@number}%
{\ifx\inclprob@pts\@empty\problem@pts\else\inclprob@pts\fi}%
{\ifx\inclprob@min\@empty\problem@min\else\inclprob@min\fi}}}
-%</package>
% \end{macrocode}
% \end{macro}
%
@@ -387,159 +338,103 @@ DefEnvironment('{problem} OptionalKeyVals:problem',
% functionality here, but can be redefined elsewhere (e.g. in the |assignment|
% package).
% \begin{macrocode}
-%<*package>
\def\@problem#1#2#3{}
-%</package>
% \end{macrocode}
% \end{macro}
%
-% The |solution| environment is similar to the |problem| environment, only that it is
-% independent of the boxed mode. It also has it's own keys that we need to define first.
+% The \DescribeEnv{solution}|solution| environment is similar to the |problem|
+% environment, only that it is independent of the boxed mode. It also has it's own keys
+% that we need to define first.
%
% \begin{macrocode}
-%<*package>
-\define@key{soln}{id}{\def\soln@id{#1}}
-\define@key{soln}{for}{\def\soln@for{#1}}
-\define@key{soln}{height}{\def\soln@height{#1}}
-\ifsolutions
-\newenvironment{solution}[1][]%
-{\hrule\smallskip{\bf Solution: }\begin{small}}%
-{\hrule\end{small}}
-\else\newxcomment[]{solution}\fi
-% \newsavebox{\solution@box}
-% \newlength{\solution@width}
-% \setlength{\solution@width}{14cm}
-% \newenvironment{solution}[1][]%
-% {\begin{lrbox}{\solution@box}\begin{minipage}{\solution@width}
-% \hrule\smallskip{\bf Solution: }\small}
-% {\smallskip\hrule\end{minipage}\end{lrbox}
-% \ifsolutions\begin{center}\usebox{\solution@box}\end{center}\fi}
-%</package>
-%<*ltxml>
-DefKeyVal('soln','id','Semiverbatim');
-DefKeyVal('soln','height','Semiverbatim');
-DefKeyVal('soln','for','Semiverbatim');
-DefEnvironment('{solution} OptionalKeyVals:soln',
- "<omdoc:solution ?&KeyVals(#1,'for')(for='&KeyVal(#1,'for')')()>"
- . "#body"
- . "</omdoc:solution>");
-%</ltxml>
+\srefaddidkey{soln}
+\addmetakey{soln}{for}
+\addmetakey{soln}{height}
+\addmetakey{soln}{creators}
+\addmetakey{soln}{contributors}
+\addmetakey{soln}{srccite}
+% \begin{macrocode}
+% the next step is to define a helper macro that does what is needed to start a solution.
+% \begin{macrocode}
+\newcommand\@startsolution[1][]{\metasetkeys{soln}{#1}%
+\@in@omtexttrue% we are in a statement.
+\ifboxed\else\hrule\fi\smallskip\noindent{\textbf\prob@solution@kw: }\begin{small}%
+\def\current@section@level{\prob@solution@kw}%
+\ignorespaces}
+% \end{macrocode}
+%
+% \begin{macro}{\startsolutions}
+% for the |\startsolutions| macro we use the |\specialcomment| macro from the |comment|
+% package. Note that we use the |\@startsolution| macro in the start codes, that parses
+% the optional argument.
+% \begin{macrocode}
+\newcommand\startsolutions{\specialcomment{solution}{\@startsolution}%
+{\ifboxed\else\hrule\medskip\fi\end{small}}%
+\ifboxed\surroundwithmdframed{solution}\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\stopsolutions}
+% \begin{macrocode}
+\newcommand\stopsolutions{\excludecomment{solution}}
+% \end{macrocode}
+% \end{macro}
+%
+% so it only remains to start/stop solutions depending on what option was specified.
+%
+% \begin{macrocode}
+\ifsolutions\startsolutions\else\stopsolutions\fi
% \end{macrocode}
%
% \begin{macrocode}
-%<*package>
\ifexnotes
\newenvironment{exnote}[1][]%
-{\par\noindent\hrule\smallskip{\bf Note: }\small}
+{\par\smallskip\hrule\smallskip\noindent\textbf{Note: }\small}
{\smallskip\hrule}
\else%ifexnotes
-\newxcomment[]{exnote}
+\excludecomment{exnote}
\fi%ifexnotes
\ifhints
\newenvironment{hint}[1][]%
-{\par\noindent\hrule\smallskip{\bf Hint: }\small}
+{\par\smallskip\hrule\smallskip\noindent\textbf{Hint: }\small}
+{\smallskip\hrule}
+\newenvironment{exhint}[1][]%
+{\par\smallskip\hrule\smallskip\noindent\textbf{Hint: }\small}
{\smallskip\hrule}
\else%ifhints
-\newxcomment[]{hint}
+\excludecomment{hint}
+\excludecomment{exhint}
\fi%ifhints
-%</package>
-%<*ltxml>
-DefEnvironment('{exnote}',"<omdoc:hint><omdoc:CMP><omdoc:p>#body</omdoc:hint>");
-DefEnvironment('{hint}',"<omdoc:hint><omdoc:CMP><omdoc:p>#body</omdoc:hint>");
-DefConstructor('\pts{}',"");
-DefConstructor('\min{}',"");
-%</ltxml>
% \end{macrocode}
%
% \subsection{Including Problems}\label{sec:impl:includeproblem}
%
-% The first action is to make a \meta{jobname}|-problems.tex| file, if the |extract|
-% option is set.
-%
-% \begin{macrocode}
-%<*package>
-\ifextract
-\newwrite\problem@file
-\immediate\openout\problem@file=\jobname-problems.tex
-\AtEndDocument{\closeout\problem@file}
-\fi
-%</package>
-% \end{macrocode}
-%
% \begin{macro}{\includeproblem}
% The |\includeproblem| command is essentially a glorified |\input| statement, it sets
-% some internal macros first that overwrite the local points. After that (so that the
-% included problem had time to step the problem number) it writes the |\includeproblem|
-% statement to the problems file, if the |extract| option is set. Here we add a key
-% |refnum=\prob@num| to the inlcudeproblem, so that we can remember the number from the
-% main document.\ednote{do something about the overwriting of problem metadata in the
-% {\LaTeXML} binding.}
-%
+% some internal macros first that overwrite the local points. Importantly, it resets the
+% |inclprob| keys after the input.
% \begin{macrocode}
-%<*package>
\addmetakey{inclprob}{pts}
\addmetakey{inclprob}{min}
\addmetakey*{inclprob}{title}
\addmetakey{inclprob}{refnum}
-\clear@inclprob@keys
-\newcommand{\includeproblem}[2][]{%
-\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}
-\protected@write\problem@file{}{\string\includeproblem[\inclprob@keys]{#2}}
-\fi}
-%</package>
-%<*ltxml>
-DefKeyVal('prob','pts','Semiverbatim');
-DefKeyVal('prob','min','Semiverbatim');
-DefKeyVal('prob','title','Semiverbatim');
-DefConstructor('\includeproblem OptionalKeyVals:prob Semiverbatim',
- "<omdoc:ref type='cite' xref='#2'>"
- . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()"
- . "?&KeyVal(#1,'min')("
- . "<omdoc:meta property='prob:solvedinminutes' prob:dummy='for the namespace'>"
- . "&KeyVal(#1,'min')"
- . "</omdoc:meta>)()"
- . "?&KeyVal(#1,'pts')("
- . "<omdoc:meta property='prob:points' prob:dummy='for the namespace'>"
- . "&KeyVal(#1,'pts')"
- . "</omdoc:meta>)()"
- ."</omdoc:ref>",
- afterDigest => sub{
- my ($stomach,$kv) = @_;
- AssignValue('inclprob',$kv) if $kv;
- });
-%</ltxml>
+\addmetakey{inclprob}{mhrepos}
+\clear@inclprob@keys%initially
+\newcommand\includeproblem[2][]{\metasetkeys{inclprob}{#1}%
+\input{#2}\clear@inclprob@keys}
% \end{macrocode}
% \end{macro}
%
-% \begin{macrocode}
-%<*ltxml>
-Tag('omdoc:exercise',afterOpen=>\&numberIt);
-Tag('omdoc:solution',afterOpen=>\&numberIt);
-Tag('omdoc:hint',afterOpen=>\&numberIt);
-%</ltxml>
-% \end{macrocode}
-%
% \subsection{Reporting Metadata}
%
% \begin{macrocode}
-%<*package>
\def\pts#1{\ifpts\marginpar{#1 pt}\fi}
\def\min#1{\ifmin\marginpar{#1 min}\fi}
-%</package>
-%<*ltxml>
-%</ltxml>
% \end{macrocode}
%
% \begin{macrocode}
-%<*package>
\AtEndDocument{\ifpts\message{Total: \arabic{pts} points}\fi
\ifmin\message{Total: \arabic{min} minutes}\fi}
-%</package>
-%<*ltxml>
-%</ltxml>
% \end{macrocode}
%
% \begin{macro}{\show@pts}
@@ -547,12 +442,11 @@ Tag('omdoc:hint',afterOpen=>\&numberIt);
% points are given locally do nothing, else show and add. If there are outside points
% then we show them in the margin.
% \begin{macrocode}
-%<*package>
\newcounter{pts}
-\def\show@pts{\ifx\inclprob@pts\@empty%
+\def\show@pts{\ifx\inclprob@pts\@empty%
\ifx\problem@pts\@empty\else%
\ifpts\marginpar{\problem@pts pt\smallskip}\addtocounter{pts}{\problem@pts}\fi%
-\fi\else%
+\fi\else% inclprob@pts nonempty
\ifpts\marginpar{\inclprob@pts pt\smallskip}\addtocounter{pts}{\inclprob@pts}\fi%
\fi}
% \end{macrocode}
@@ -570,34 +464,30 @@ Tag('omdoc:hint',afterOpen=>\&numberIt);
%</package>
% \end{macrocode}
% \end{macro}
-%
-% \subsection{Providing IDs Elements}\label{sec:impl:ids}
-%
-% To provide default identifiers, we tag all elements that allow |xml:id| attributes by
-% executing the |numberIt| procedure from |omdoc.sty.ltxml|.
-%
-% \begin{macrocode}
-%<*ltxml>
-Tag('omdoc:exercise',afterOpen=>\&numberIt,afterClose=>\&locateIt);
-Tag('omdoc:solution',afterOpen=>\&numberIt,afterClose=>\&locateIt);
-Tag('omdoc:hint',afterOpen=>\&numberIt,afterClose=>\&locateIt);
-%</ltxml>
-% \end{macrocode}
-%
-% \subsection{Finale}
-% Finally, we need to terminate the file with a success mark for perl.
-% \begin{macrocode}
-%<ltxml>1;
-% \end{macrocode}
% \Finale
\endinput
-
% \iffalse
-% LocalWords: GPL structuresharing STR dtx pts keyval xcomment CPERL DefKeyVal
+% LocalWords: GPL structuresharing STR dtx pts keyval xcomment CPERL DefKeyVal iffalse
%%% Local Variables:
%%% mode: doctex
%%% TeX-master: t
%%% End:
% \fi
-% LocalWords: RequirePackage Semiverbatim DefEnvironment OptionalKeyVals soln
-% LocalWords: exnote DefConstructor inclprob
+% LocalWords: RequirePackage Semiverbatim DefEnvironment OptionalKeyVals soln texttt baz
+% LocalWords: exnote DefConstructor inclprob NeedsTeXFormat omd.sty textbackslash exfig
+% LocalWords: stopsolution fileversion filedate maketitle setcounter tocdepth newpage
+% LocalWords: tableofcontents showmeta showmeta solutionstrue usepackage minipage hrule
+% LocalWords: linewidth elefants.prob Elefants smallskip noindent textbf startsolutions
+% LocalWords: startsolutions stopsolutions stopsolutions includeproblem includeproblem
+% LocalWords: textsf HorIacJuc cscpnrr11 includemhproblem includemhproblem importmodule
+% LocalWords: importmhmodule foobar ldots latexml mhcurrentrepos mh-variants mh-variant
+% LocalWords: compactenum langle rangle langle rangle ltxml metakeys newif ifexnotes rm
+% LocalWords: exnotesfalse exnotestrue ifhints hintsfalse hintstrue ifsolutions ifpts
+% LocalWords: solutionsfalse ptsfalse ptstrue ifmin minfalse mintrue ifboxed boxedfalse
+% LocalWords: boxedtrue sref mdframed marginpar prob srefaddidkey addmetakey refnum kv
+% LocalWords: newcounter ifx thesection theproblem hfill newenvironment metasetkeys ltx
+% LocalWords: stepcounter currentsectionlevel xspace ignorespaces surroundwithmdframed
+% LocalWords: omdoc autoopen autoclose solvedinminutes kvi qw vals newcommand exhint
+% LocalWords: specialcomment excludecomment mhrepos xref marginpar addtocounter doctex
+% LocalWords: mh@currentrepos endinput
+
diff --git a/Master/texmf-dist/source/latex/stex/problem/problem.ins b/Master/texmf-dist/source/latex/stex/problem/problem.ins
index 1ed30cedb91..5254c98da65 100644
--- a/Master/texmf-dist/source/latex/stex/problem/problem.ins
+++ b/Master/texmf-dist/source/latex/stex/problem/problem.ins
@@ -29,12 +29,4 @@
\Msg{* And don't forget to refresh your filename database}
\Msg{* if your TeX distribution uses such a database.}
\Msg{*}
-
-\nopreamble\nopostamble
-\generate{\file{problem.sty.ltxml}{\from{problem.dtx}{ltxml}}}
-
-\Msg{*}
-\Msg{* You probably need to move the generated file problem.sty.ltxml into a directory searched by LaTeXML.}
-\Msg{*}
-
\endbatchfile