% problempack.sty, a package for generating problem/solution sets.
-% Version 0.3
%
+% 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
+% the Free Software Foundation; either version 2 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License along
+% with this program; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
% see clsguide.pdf for a LaTeX package tutorial
% see xkeyval.pdf for a 72 page spiel on xkeyval
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{problempack}[2008/04/02]
+\ProvidesPackage{problempack}[2010/10/14 0.4 problempack]
\RequirePackage{comment}% show/hide the solution sections
\RequirePackage[pdftex]{hyperref} % pdf niceties & active links
}
% 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%
}
\hypersetup{pdfstartview=FitH} % zooming to fit the page width.
\hypersetup{colorlinks} % don't do the ugly boxes around links
-% You can safely delete/override of the following code without effecting the
-% core problem/solution environment behavior.
-
+% setup a simple title
\renewcommand{\maketitle}{%
\begin{center}
{\Large \Pr@blemClasstitle} \\
\Pr@blemSubheading
\end{center}
}
-
-%% include some useful goodies
-\RequirePackage[pdftex]{graphicx} % to include images
-%\DeclareGraphicsRule{*}{mps}{*}{}
-%\RequirePackage{emp} % embed MetaPost pictures in LaTeX
-% you need to add \begin{emp*}\end{emp*} by hand, because emp parser
-% doesn't realize \end{EMP} might expand to \end{emp} or \end{empfile}.
-%\newenvironment{EMP}[1]%
-% {\begin{center}\begin{empfile}[problem#1]\begin{emp}(0,0)}%
-% {\end{emp}\end{empfile}\end{center}}
-
-
-%% define a few physics shortcuts
-%\newcommand{\U}[1]{\text{ #1}} % units shortcut
-%\newcommand{\E}[1]{\ensuremath{\cdot 10 ^{#1}}} % exponent shortcut
-%\newcommand{\dg}{\ensuremath{^{\circ}}} % degree symbol ^o
-%\newcommand{\vect}[1]{\ensuremath{\mathbf{#1}}} % make vectors bold
-%\newcommand{\p}[3]{\left#1 #2 \right#3} % parenthesis, e.g. \p({complicated expr})
-%
-%\newcommand{\ihat}{\vect{\hat{i}}}
-%\newcommand{\jhat}{\vect{\hat{j}}}
-%\newcommand{\khat}{\vect{\hat{k}}}
-%\newcommand{\rhat}{\vect{\hat{r}}}
-
-
-%% finally, set up some simple formatting.
-
-% fill the page
-\topmargin -0.5in
-\headheight 0.0in
-\headsep 0.0in
-\textheight 10in
-\oddsidemargin -0.5in
-\textwidth 7.5in
-\pagestyle{empty} % no room for page numbers
-
-% struts for table spacing
-%\newcommand{\Tstrut}{\rule{0pt}{2.6ex}}
-%\newcommand{\Bstrut}{\rule[-1.2ex]{0pt}{0pt}}