Change my email address from drexel.edu to tremily.us.
[problempack.git] / problempack.sty
index d9d374b30226f677c6c43e37919397d23d3f35a8..e174c38dda2ff1df92f786a3ba57fc6d6a450767 100644 (file)
@@ -1,6 +1,6 @@
 % problempack.sty, a package for generating problem/solution sets.
 %
-% Copyright (C) 2008-2010 W. Trevor King <wking@drexel.edu>
+% Copyright (C) 2008-2010 W. Trevor King <wking@tremily.us>
 %
 % This program is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
 }
 
 % define theorem environments
+%\newcounter{Pr@blem}
+%\newtheorem{Pr@blem}[Pr@blem]{Problem}
 \newtheorem{Pr@blem}{Problem}
 \newcommand{\Pr@blemSkip}{0pt} % set to 2\baselineskip when nosolutions, to give breathing room between problems
 \newenvironment{problem}{%
   \phantomsection%
   \addtocounter{Pr@blem}{1}% <- temporarily increment Pr@blem
-  \addcontentsline{toc}{section}{Problem \arabic{Pr@blem}}%
+  \addcontentsline{toc}{subsection}{Problem \arabic{Pr@blem}}%
   \addtocounter{Pr@blem}{-1}% <- restore to its initial value
   \begin{Pr@blem}% <- the Pr@blem counter actually gets implemented here
 }{%
 % not that you should ever need to as far as I can imagine.
 % Note: using a constant theorem name like ProblemSTAR fails on redefine attempt
 % Note: you also get matching errors with \begin{Pr@blem#1}\end{Pr@blem\Pr@blemCounter}
-\newcommand{\Pr@blemCounter}{}
+\newcounter{XPr@blem}
 \newenvironment{problem*}[1]{%
-  \renewcommand{\Pr@blemCounter}{#1}%
   \phantomsection%
-  \addcontentsline{toc}{section}{Problem #1}%
-  \newtheorem*{Pr@blem\Pr@blemCounter}{Problem #1}%
-  \begin{Pr@blem\Pr@blemCounter}%
+  \addcontentsline{toc}{subsection}{Problem #1}%
+  \addtocounter{XPr@blem}{1}% <- increment XPr@blem  
+  \expandafter\newtheorem*{XPr@blem\arabic{XPr@blem}}{Problem #1}%
+  \expandafter\begin{XPr@blem\arabic{XPr@blem}}%
 }{%
-  \end{Pr@blem\Pr@blemCounter}%
+  \expandafter\end{XPr@blem\arabic{XPr@blem}}%
   \vspace\Pr@blemSkip%
 }