summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/problem/problem.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/problem/problem.sty')
-rw-r--r--Master/texmf-dist/tex/latex/stex/problem/problem.sty116
1 files changed, 116 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/problem/problem.sty b/Master/texmf-dist/tex/latex/stex/problem/problem.sty
new file mode 100644
index 00000000000..aec05910e0e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/problem/problem.sty
@@ -0,0 +1,116 @@
+%%
+%% This is file `problem.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% problem.dtx (with options: `package')
+%%
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{problem}[2010/06/25 v0.9c Semantic Markup for Problems]
+\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
+\RequirePackage{keyval}[1997/11/10]
+\RequirePackage{xcomment}
+\RequirePackage{sref}
+\srefaddidkey[prefix=prob.]{problem}
+\omdaddkey{problem}{pts}
+\omdaddkey{problem}{min}
+\omdaddkey{problem}{title}
+\omdaddkey{problem}{refnum}
+\newsavebox{\probbox}
+\newcounter{problem}[section]
+\def\prob@number{\ifx\inclprob@refnum\@empty
+\ifx\problem@refnum\@empty\thesection.\theproblem\else\problem@refnum\fi
+\inclprob@refnum\fi}
+\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
+\ifboxed
+\newenvironment{problem}[1][]{\omdsetkeys{problem}{#1}\sref@target%
+\stepcounter{problem}\show@pts\show@min\record@problem%
+\begin{lrbox}{\probbox}\begin{minipage}{.9\textwidth}}
+{\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%
+\stepcounter{problem}\show@pts\show@min\record@problem%
+\par\noindent\textbf\prob@heading\rm}
+{\smallskip}
+\fi%boxed
+\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}}}
+\def\@problem#1#2#3{}
+\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
+\ifexnotes
+\newenvironment{exnote}[1][]%
+{\par\noindent\hrule\smallskip{\bf Note: }\small}
+{\smallskip\hrule}
+\else%ifexnotes
+\newxcomment[]{exnote}
+\fi%ifexnotes
+\ifhints
+\newenvironment{hint}[1][]%
+{\par\noindent\hrule\smallskip{\bf Hint: }\small}
+{\smallskip\hrule}
+\else%ifhints
+\newxcomment[]{hint}
+\fi%ifhints
+\ifextract
+\newwrite\problem@file
+\immediate\openout\problem@file=\jobname-problems.tex
+\AtEndDocument{\closeout\problem@file}
+\fi
+\omdaddkey{inclprob}{pts}
+\omdaddkey{inclprob}{min}
+\omdaddkey{inclprob}{title}
+\omdaddkey{inclprob}{refnum}
+\clear@inclprob@keys
+\newcommand{\includeproblem}[2][]{%
+\bgroup\omdsetkeys{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}
+\def\pts#1{\ifpts\marginpar{#1 pt}\fi}
+\def\min#1{\ifmin\marginpar{#1 min}\fi}
+\AtEndDocument{\ifpts\message{Total: \arabic{pts} points}\fi
+\ifmin\message{Total: \arabic{min} minutes}\fi}
+\newcounter{pts}
+\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%
+\ifpts\marginpar{\inclprob@pts pt\smallskip}\addtocounter{pts}{\inclprob@pts}\fi%
+\fi}
+\newcounter{min}
+\def\show@min{\ifx\inclprob@min\@empty%
+\ifx\problem@min\@empty\else%
+\ifmin\marginpar{\problem@min min}\addtocounter{min}{\problem@min}\fi%
+\fi\else%
+\ifmin\marginpar{\inclprob@min min}\addtocounter{min}{\inclprob@min}\fi
+\fi}
+\endinput
+%%
+%% End of file `problem.sty'.