projects
/
problempack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c6af47f
)
Rework problempack numbering to allow repeated X in `\problem*{X}`.
author
W. Trevor King
<wking@drexel.edu>
Fri, 27 May 2011 20:51:58 +0000
(16:51 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Fri, 27 May 2011 20:51:58 +0000
(16:51 -0400)
problempack.sty
patch
|
blob
|
history
diff --git
a/problempack.sty
b/problempack.sty
index d9d374b30226f677c6c43e37919397d23d3f35a8..c7327837c5e1c24cd5d702cbc549512c38f64359 100644
(file)
--- a/
problempack.sty
+++ b/
problempack.sty
@@
-70,12
+70,13
@@
}
% define theorem environments
}
% define theorem environments
-\newtheorem{Pr@blem}{Problem}
+\newcounter{Pr@blem}
+\newtheorem{Pr@blem}[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
\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}{s
ubs
ection}{Problem \arabic{Pr@blem}}%
\addtocounter{Pr@blem}{-1}% <- restore to its initial value
\begin{Pr@blem}% <- the Pr@blem counter actually gets implemented here
}{%
\addtocounter{Pr@blem}{-1}% <- restore to its initial value
\begin{Pr@blem}% <- the Pr@blem counter actually gets implemented here
}{%
@@
-87,15
+88,15
@@
% 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}
% 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}
-\newco
mmand{\Pr@blemCounter}{
}
+\newco
unter{XPr@blem
}
\newenvironment{problem*}[1]{%
\newenvironment{problem*}[1]{%
- \renewcommand{\Pr@blemCounter}{#1}%
\phantomsection%
\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}}%
}{%
}{%
- \e
nd{Pr@blem\Pr@blemCounter
}%
+ \e
xpandafter\end{XPr@blem\arabic{XPr@blem}
}%
\vspace\Pr@blemSkip%
}
\vspace\Pr@blemSkip%
}