-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathps-macros.tex
136 lines (119 loc) · 3.4 KB
/
ps-macros.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
\usepackage{hypcap}
\renewcommand{\E}{{\mathbb E}}
\usepackage{todonotes}
\newcounter{todocounter}
\newcommand{\todonum}[2][]{\stepcounter{todocounter}\todo[#1]{\thetodocounter: #2}}
\newcommand{\jsay}[1]{\todonum[inline,color=red!20]{\small Jayalal says: Todo - #1}}
% modified exercise enviornment to use with collect package
\usepackage{enumerate}
\newcounter{excount}
\setcounter{excount}{0}
\theoremstyle{definition}
\newtheorem{ex}[section]{Exercise}
\newtheorem{curious}[theorem]{Curiosity}
% for exercises which are problem set questions
\newtheorem{exercise-prob}[section]{Exercise}
\theoremstyle{plain}
%%%%%%%%%%%%%%%%%%%% Exercise and pset macros (start) %%%%%%%%%%%%%%%%%%%%%%%5
% For problem set back reference.
\def\psetbackref{1}
% For Curiosity Drive
\definecollection{curious.tmp}
\makeatletter
\newenvironment{curiousity}
{\@nameuse{collect*}{curious.tmp}
{\begin{curious}}
{\end{curious}}{}{}
}{\@nameuse{endcollect*}}
\makeatother
% For exercise
\definecollection{ex.tmp}
\makeatletter
\newenvironment{exercise}
{\@nameuse{collect*}{ex.tmp}
{\begin{ex}}
{\end{ex}}{}{}
}{\@nameuse{endcollect*}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% To create a a new pset with pset number n, copy paste the following code
% with XX replaced by n.
%
% \definecollection{psXX.tmp}
% \makeatletter
% \newenvironment{show-psXX}[1]
% {\@nameuse{collect*}{psXX.tmp}
% {\ifthenelse{ \equal{\psetbackref}{1} }{\label{prob:#1}}{}} {}
% {\item \label{#1} (See Exercise~\ref{prob:#1})} {}
% }{\@nameuse{endcollect*}}
% \makeatother
%
% \makeatletter
% \newenvironment{psXX}
% {\@nameuse{collect}{psXX.tmp}
% {\item}{}
% }{\@nameuse{endcollect}}
% \makeatother
%
%
%%% For ps1
\definecollection{ps1.tmp}
\makeatletter
\newenvironment{show-ps1}[1]
{\@nameuse{collect*}{ps1.tmp}
{\ifthenelse{ \equal{\psetbackref}{1} } {\label{prob:#1}}{}} {}
{\item \label{#1} (See Exercise~\ref{prob:#1})} {}
}{\@nameuse{endcollect*}}
\makeatother
\makeatletter
\newenvironment{ps1}
{\@nameuse{collect}{ps1.tmp}
{\item }{}
}{\@nameuse{endcollect}}
\makeatother
%%% For ps2
\definecollection{ps2.tmp}
\makeatletter
\newenvironment{show-ps2}[1]
{\@nameuse{collect*}{ps2.tmp}
{\ifthenelse{ \equal{\psetbackref}{1} }{\label{prob:#1}}{}} {}
{\item \label{#1} (See Exercise~\ref{prob:#1})} {}
}{\@nameuse{endcollect*}}
\makeatother
\makeatletter
\newenvironment{ps2}
{\@nameuse{collect}{ps2.tmp}
{\item}{}
}{\@nameuse{endcollect}}
\makeatother
%%% For ps3
\definecollection{ps3.tmp}
\makeatletter
\newenvironment{show-ps3}[1]
{\@nameuse{collect*}{ps3.tmp}
{\ifthenelse{ \equal{\psetbackref}{1} }{\label{prob:#1}}{}} {}
{\item \label{#1} (See Exercise~\ref{prob:#1})} {}
}{\@nameuse{endcollect*}}
\makeatother
\makeatletter
\newenvironment{ps3}
{\@nameuse{collect}{ps3.tmp}
{\item}{}
}{\@nameuse{endcollect}}
\makeatother
%%% For ps3
\definecollection{ps4.tmp}
\makeatletter
\newenvironment{show-ps4}[1]
{\@nameuse{collect*}{ps4.tmp}
{\ifthenelse{ \equal{\psetbackref}{1} }{\label{prob:#1}}{}} {}
{\item \label{#1} (See Exercise~\ref{prob:#1})} {}
}{\@nameuse{endcollect*}}
\makeatother
\makeatletter
\newenvironment{ps4}
{\@nameuse{collect}{ps4.tmp}
{\item}{}
}{\@nameuse{endcollect}}
\makeatother
%%%%% Exercise and pset macros (end) %%%%%