-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcspogil.sty
More file actions
398 lines (347 loc) · 11.2 KB
/
cspogil.sty
File metadata and controls
398 lines (347 loc) · 11.2 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
%\ProvidesPackage{cspogil}
% metadata
\makeatletter
\newcommand{\thetitle}{\@title}
\newcommand{\theauthor}{\@author}
\newcommand{\thedate}{\@date}
\makeatother
% fonts
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
% spacing
\usepackage[margin=2cm]{geometry}
\renewcommand{\arraystretch}{1.4}
\setlength{\parindent}{0pt}
% orphans and widows
\clubpenalty=10000
\widowpenalty=10000
\pagestyle{empty}
% figures and tables
\usepackage{graphicx}
\graphicspath{{fig/}{../Meta/}}
\usepackage{ifthen}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tabularx}
% fixed-width columns
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% syntax colors (based on IDLE)
\usepackage[svgnames,table]{xcolor}
\definecolor{bgcolor}{HTML}{FAFAFA}
\definecolor{builtin}{HTML}{900090}
\definecolor{comment}{HTML}{DD0000}
\definecolor{keyword}{HTML}{FF7700}
\definecolor{strings}{HTML}{00AA00}
\definecolor{answers}{HTML}{A9A9A9}
% text highlighting
\usepackage{soul}
\sethlcolor{Yellow}
% table backgrounds
\newcommand{\tr}{\bf\cellcolor{Orange!10}}
\newcommand{\tg}{\bf\cellcolor{Gray!10}}
% special characters
\usepackage{textcomp}
\newcommand{\fs}{\footnotesize}
\newcommand{\bs}{\textbackslash}
\newcommand{\n}{\textbackslash n}
\newcommand{\qs}{\textquotesingle}
\newcommand{\chr}[1]{\texttt{\qs{#1}\qs}}
\newcommand{\str}[1]{\texttt{"{#1}"}}
% syntax highlighting
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
backgroundcolor=\color{bgcolor},
numberstyle=\scriptsize\color{answers},
commentstyle=\color{comment},
keywordstyle=\color{keyword},
stringstyle=\color{strings},
columns=fullflexible,
keepspaces=true,
showlines=true,
showstringspaces=false,
tabsize=4,
upquote=true
}
\lstdefinestyle{morecpp}{
language=c++
}
\lstdefinestyle{morejava}{
language=java,
morekeywords={enum}
}
\lstdefinestyle{morepython}{
language=python,
morekeywords={False,True},
deletekeywords={print},
morekeywords=[2]{print},
keywordstyle=[2]{\color{builtin}}
}
\lstdefinestyle{lstanswers}{
backgroundcolor=,
commentstyle=\color{answers},
keywordstyle=\color{answers},
keywordstyle=[2]{\color{answers}},
stringstyle=\color{answers}
}
% C++ environments
\newcommand{\cpp}[1]{\lstinline[style=morecpp]{#1}}%[
\newcommand{\cans}[1]{\lstinline[style=morecpp,style=lstanswers]{#1}}%[
\lstnewenvironment{cppans}{\lstset{style=morecpp,style=lstanswers}\vspace{-1ex}}{}
\lstnewenvironment{cpplst}{\lstset{style=morecpp,backgroundcolor=,numbers=left,xleftmargin=20pt,numbersep=10pt}}{}
\lstnewenvironment{cppnum}{\lstset{style=morecpp,backgroundcolor=,numbers=left}}{}
\lstnewenvironment{cppbox}{\lstset{style=morecpp,frame=single,numbers=left}\quote}{\endquote}
\newcommand{\cpfile}[1]{\lstinputlisting[style=morecpp,backgroundcolor=,numbers=left]{src/#1}}
% Java environments
\newcommand{\java}[1]{\lstinline[style=morejava]{#1}}%[
\newcommand{\jans}[1]{\lstinline[style=morejava,style=lstanswers]{#1}}%[
\lstnewenvironment{javaans}{\lstset{style=morejava,style=lstanswers}\vspace{-1ex}}{}
\lstnewenvironment{javalst}{\lstset{style=morejava,backgroundcolor=,numbers=left,xleftmargin=20pt,numbersep=10pt}}{}
\lstnewenvironment{javanum}{\lstset{style=morejava,backgroundcolor=,numbers=left}}{}
\lstnewenvironment{javabox}{\lstset{style=morejava,frame=single,numbers=left}\quote}{\endquote}
\newcommand{\jafile}[1]{\lstinputlisting[style=morejava,backgroundcolor=,numbers=left]{src/#1}}
% Python environments
\newcommand{\pyth}[1]{\lstinline[style=morepython]{#1}}%[
\newcommand{\pans}[1]{\lstinline[style=morepython,style=lstanswers]{#1}}%[
\lstnewenvironment{pythans}{\lstset{style=morepython,style=lstanswers}\vspace{-1ex}}{}
\lstnewenvironment{pythlst}{\lstset{style=morepython,backgroundcolor=,numbers=left,xleftmargin=20pt,numbersep=10pt}}{}
\lstnewenvironment{pythnum}{\lstset{style=morepython,backgroundcolor=,numbers=left}}{}
\lstnewenvironment{pythbox}{\lstset{style=morepython,frame=single,numbers=left}\quote}{\endquote}
\newcommand{\pyfile}[1]{\lstinputlisting[style=morepython,backgroundcolor=,numbers=left]{src/#1}}
% PDF properties
\usepackage[pdftex]{hyperref}
\urlstyle{same}
\makeatletter
\hypersetup{
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\@date},
pdfkeywords={},
bookmarksopen=false,
colorlinks=true,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=blue
}
\makeatother
%------------------------------------------------------------------------------%
%% headers and footers
%\usepackage{fancyhdr}
%\usepackage{lastpage}
%\pagestyle{fancy}
%\renewcommand{\headrulewidth}{0pt}
%\renewcommand{\footrulewidth}{0pt}
%\definecolor{headers}{HTML}{808080}
%\makeatletter
%\lhead{\footnotesize\textcolor{headers}{\@title}}
%\chead{}
%\rhead{\footnotesize\textcolor{headers}{Page \thepage\ of \pageref*{LastPage}}}
%\lfoot{}
%\cfoot{}
%\rfoot{}
%\makeatother
% boxes [optional height]
\newcommand{\emptybox}[1][10em]{
\vspace{1em}
\begin{tabularx}{\linewidth}{|X|}
\hline\\[#1]\hline
\end{tabularx}}
% comment boxes
\newcommand{\comment}[1]{
\begin{center}
\begin{tabularx}{\linewidth}{|X|}
\hline
\itshape #1 \\
\hline
\end{tabularx}
\end{center}}
% models
\usepackage{currfile}
\newcommand{\model}[1]{\section{#1}\label{\currfilename}\nopagebreak}
\newcounter{modelnumber}
\newcommand{\M}{\refstepcounter{modelnumber}\arabic{modelnumber} }}
\renewcommand{\thesection}{Model~\arabic{section}}
\DeclareTextFontCommand{\emph}{\bfseries\em}
% questions
\newcommand{\blank}[1][3em]{\rule{#1}{0.5pt}}
\newcommand{\quest}[1]{\subsection*{Questions~ (#1) \hfill Start time: \ans[3.5em]}}
\newcounter{question}
\newcommand{\Q}{\vspace{1em}\refstepcounter{question}\textbf{\arabic{question}}.~ }
\renewcommand{\thequestion}{\#\arabic{question}}
% sub-question lists
\usepackage{enumitem}
\setenumerate[1]{label=\alph*),itemsep=1ex}
\setlist{itemsep=1em,after=\vspace{1ex}}
\newcommand{\bull}{\par\hspace{3ex}\raisebox{0.25ex}{\footnotesize$\bullet$}~~}
% homework exercises
\newcommand{\prob}[3]{\vspace{1em}\textbf{#1}~~(#2)\ifx&\else\ -- \textit{#3}\fi}
\newcommand{\exer}[2]{\vspace{1em}\textbf{#1}~~#2}
\newcommand{\code}[1]{\colorbox{WhiteSmoke}{\textcolor{Maroon}{\texttt{#1}}}}
% instructor notes
\newcommand{\note}[1]{\ifdefined\Teacher\hspace*{1ex}\textcolor{answers}{#1}\fi}
% answer frames (Teacher mode)
\renewcommand\fbox{\fcolorbox{GhostWhite}{GhostWhite}}
\setlength{\fboxrule}{0.4pt} %0.4pt
\setlength{\fboxsep}{2.25pt} %3.0pt
% dimensions of answer boxes
\newlength{\depth}
\newlength{\width}
\newlength{\defaultwidth}
\setlength{\defaultwidth}{15em}
% inline answers [optional width]
\newcounter{answer}
\newcommand{\ans}[2][\defaultwidth]{
\ifdefined\Teacher
\leavevmode%
\setlength{\width}{#1}\addtolength{\width}{-2.65pt}%
\fbox{\parbox[c][13pt][c]{\width}{\textcolor{answers}{#2}}}%
\else
\leavevmode%
\refstepcounter{answer}%
\TextField[bordercolor=answers,height=13pt,width=#1,
name=ans\arabic{answer}]{}%
\fi}
% longer answers [optional height]
\newsavebox{\ansbox}
\newenvironment{answer}[1][4em]{
\nopagebreak
\begin{lrbox}{\ansbox}
\setlength{\width}{\linewidth}\addtolength{\width}{-8.3pt}
\begin{minipage}[t][#1]{\width}
\color{answers}
}{
\end{minipage}
\end{lrbox}
\ifdefined\Teacher
\par\vspace{-3pt}\fbox{\usebox{\ansbox}}\vspace{3.3pt}%
\else
\settodepth{\depth}{\usebox{\ansbox}}%
\addtolength{\depth}{2.65pt}%
\refstepcounter{answer}%
\par\vspace{1ex}%
\TextField[bordercolor=answers,height=\depth,width=\linewidth,multiline=true,
name=ans\arabic{answer}]{}%
\fi}
% variable diagram
\newcommand{\var}[2]{
\begin{tabular}{R{50pt}|C{20pt}|}
\cline{2-2}
\texttt{#1} & \texttt{#2} \\
\cline{2-2}
\end{tabular}
}
%------------------------------------------------------------------------------%
%key questions
\newcommand{\keyquestions}[1]{
Record your team's answers to the key questions (marked with \mbox{\key}) below.
\begin{enumerate}[itemsep=1.25in]
#1
\end{enumerate}
}
% titles
\makeatletter
\renewcommand{\maketitle}{\begin{center}\LARGE\@title\end{center}}
\makeatother
% role names
\newcommand{\rolenames}{
\Large Recorder's Report\\[20pt]
\normalsize
\begin{tabular}{lrp{0.1in}lr}
Manager: & \ans{} & & Reader: & \ans{} \\[15pt]
Recorder: & \ans{} & & Driver: & \ans{} \\[15pt]
Date: & \ans{} & & Score: & Satisfactory \hspace{10pt} /
\hspace{10pt} Not Satisfactory
\end{tabular}
}
% instructor's guide template for CS1 and CS2 activities
\newcommand{\guide}[3]{
\subsection*{Content Learning Objectives}
\textit{After completing this activity, students should be able to:}
\begin{itemize}[itemsep=0pt,after=]
#1
\end{itemize}
\subsection*{Process Skill Goals}
\textit{During the activity, students should make progress toward:}
\begin{itemize}[itemsep=0pt,after=]
#2
\end{itemize}
\ifdefined\Teacher
\vspace*{-13pt}\color{answers}
\subsection*{Facilitation Notes}
\vspace{-\bigskipamount}
\setlength{\parskip}{\bigskipamount}
#3
\setlength{\parskip}{0pt}
\normalcolor
\fi
%\usepackage{xstring}
%\IfSubStr{\theauthor}{ and }
% {\subsection*{Activity Authors}}
% {\subsection*{Activity Author}}
%\theauthor
\vfill
\vspace{\baselineskip}
\begin{minipage}{0.133\linewidth}
\includegraphics[width=\linewidth]{../../figures/by-nc-sa.png}
\end{minipage}
\hfill
\begin{minipage}{0.853\linewidth}
\small
\activityeditor{} derived this work from \theauthor ~ work found at \activitysource{} and continues to be licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
\end{minipage}
\clearpage
}
% instructor's guide template for AR Architecture and Organization activities
\newcommand{\guides}[4]{
\subsection*{Content Learning Objectives}
\textit{After completing this activity, students should be able to:}
\begin{itemize}[itemsep=0pt,after=]
#1
\end{itemize}
\subsection*{Process Skill Goals}
\textit{During the activity, students should make progress toward:}
\begin{itemize}[itemsep=0pt,after=]
#2
\end{itemize}
\ifdefined\Teacher
\vspace*{-13pt}\color{answers}
\subsection*{Facilitation Notes}
\vspace{-\bigskipamount}
\setlength{\parskip}{\bigskipamount}
#3
\setlength{\parskip}{0pt}
\normalcolor
\fi
%\usepackage{xstring}
%\IfSubStr{\theauthor}{ and }
% {\subsection*{Activity Authors}}
% {\subsection*{Activity Author}}
%\theauthor
\vfill
\hrule
\subsection*{Sources}
\begin{itemize}[itemsep=0pt,after=]
#4
\end{itemize}
\vspace{\baselineskip}
\begin{minipage}{0.133\linewidth}
\includegraphics[width=\linewidth]{../../figures/by-nc-sa.png}
\end{minipage}
\hfill
\begin{minipage}{0.853\linewidth}
\small
\textsuperscript{\textcopyright}2019-2023 by \activityeditor{}, \activitysource{}. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
\end{minipage}
\clearpage
}
% links on GitHub
\newcommand{\github}[2]{\href{https://github.com/cspogil/PythonCS1/blob/master/#1}{#2}}
\newcommand{\src}[2]{\href{https://drive.google.com/drive/folders/1CxGpmO-vsoYlrcQZ-6qSbmgnw2mLdbn9?usp=sharing}{\it #2}}
% Key image
\newcommand{\key}{\hfill
\raisebox{-.3\height}{\includegraphics[width=0.6in]{../../figures/key.png}}}