File latex/course.sty added (mode: 100644) (index 0000000..c46ae64) |
|
1 |
|
%%%%%%%%%%%% |
|
2 |
|
% Specific to the class |
|
3 |
|
\newcommand{\website}{\href{http://spots.augusta.edu/caubert/pcp/}{spots.augusta.edu/caubert/pcp/}} |
|
4 |
|
\newcommand{\hwClass}{CSCI 1301 - Principles of Computer Programming I -- Fall 2019} % Course/class |
|
5 |
|
%\newcommand{\website}{\href{http://spots.augusta.edu/caubert/db/}{spots.augusta.edu/caubert/db/}} |
|
6 |
|
%\newcommand{\hwClass}{CSCI 3410 - Database Systems -- Fall 2019} % Course/class |
|
7 |
|
%%%%%%%%%% |
|
8 |
|
|
|
9 |
|
%%% For CSCI 1301 : |
|
10 |
|
|
|
11 |
|
\newcommand{\cs}{C\#\xspace}%C\nolinebreak[4]\raisebox{.6ex}{\includegraphics[scale=.8]{latex/hash-symbol}}\} |
|
12 |
|
\usepackage{mathabx} % For the \dlsh symbol (new line, return carriage) |
|
13 |
|
|
|
14 |
|
% To stop pigmentize treating $ like a syntax error… |
|
15 |
|
%\AtBeginEnvironment{minted}{% Actually, we want to capture mintinline as well… |
|
16 |
|
\renewcommand{\fcolorbox}[4][]{#4} |
|
17 |
|
%} % https://tex.stackexchange.com/q/14166 |
|
18 |
|
|
|
19 |
|
\newcommand{\csi}[1]{\mintinline{csharp}{#1}} |
|
20 |
|
|
|
21 |
|
\usepackage{caption} |
|
22 |
|
\newenvironment{code}{\captionsetup{type=listing}}{} |
|
23 |
|
\newfontfamily\symb{DejaVu Sans} |
|
24 |
|
\usepackage{rotating} |
|
25 |
|
|
|
26 |
|
%%% End of for CSCI 1301. |
File latex/packages.sty added (mode: 100644) (index 0000000..a0ab17d) |
|
1 |
|
\usepackage[T1]{fontenc} |
|
2 |
|
\usepackage{fontspec} |
|
3 |
|
%\usepackage[charter]{mathdesign} |
|
4 |
|
\usepackage[utopia]{mathdesign} |
|
5 |
|
%\usepackage[garamond]{mathdesign} |
|
6 |
|
\defaultfontfeatures{Ligatures=TeX} |
|
7 |
|
\usepackage{fancyhdr} |
|
8 |
|
\usepackage{xsim} |
|
9 |
|
\usepackage{xunicode} |
|
10 |
|
\usepackage{mathtools} |
|
11 |
|
\usepackage{lastpage} % Required to determine the last page for the footer |
|
12 |
|
\usepackage{multicol} |
|
13 |
|
\usepackage{graphicx} % Required to insert images |
|
14 |
|
\usepackage{hyperref} |
|
15 |
|
\usepackage{microtype} |
|
16 |
|
\usepackage{booktabs} |
|
17 |
|
\usepackage[table]{xcolor} |
|
18 |
|
\usepackage{colortbl} |
|
19 |
|
\usepackage[inline]{enumitem} |
|
20 |
|
\usepackage[cachedir=latex/cache/minted]{minted} |
|
21 |
|
%\usemintedstyle{../VisualCS} |
|
22 |
|
\usepackage{fvextra} |
|
23 |
|
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}} |
|
24 |
|
\usepackage{titlesec} |
|
25 |
|
\usepackage{fourier-orns} |
|
26 |
|
\usepackage{csquotes} |
|
27 |
|
\usepackage{xspace} |
|
28 |
|
\usepackage{needspace} % For xsim styling |
|
29 |
|
\usepackage[us, raise]{datetime} |
|
30 |
|
\usepackage{siunitx} |
|
31 |
|
\sisetup{ |
|
32 |
|
group-four-digits = true, |
|
33 |
|
group-separator = {,} |
|
34 |
|
} |
|
35 |
|
|
|
36 |
|
% True / False syntax |
|
37 |
|
\ExplSyntaxOn |
|
38 |
|
\NewDocumentCommand \IfTagSetTF {m+m+m} |
|
39 |
|
{ \seq_if_in:NnTF \l__xsim_chosen_tags_tags_seq {#1} {#2} {#3} } |
|
40 |
|
\NewDocumentCommand \IfTagSetT {m+m} |
|
41 |
|
{ \IfTagSetTF {#1} {#2} {} } |
|
42 |
|
\NewDocumentCommand \IfTagSetF {m+m} |
|
43 |
|
{ \IfTagSetTF {#1} {} {#2} } |
|
44 |
|
\ExplSyntaxOff |
|
45 |
|
% Cf. https://tex.stackexchange.com/a/413353/34551 |
File latex/style.sty added (mode: 100644) (index 0000000..605c482) |
|
1 |
|
%%%%%%%%%%%% |
|
2 |
|
% Color and style |
|
3 |
|
%%%%%%%%%%%% |
|
4 |
|
|
|
5 |
|
\hypersetup{colorlinks=true, allcolors=black} |
|
6 |
|
|
|
7 |
|
%%%%%%%%%%%%%%% |
|
8 |
|
% Margins and line spacing |
|
9 |
|
%%%%%%%%%%%%%%% |
|
10 |
|
\usepackage{geometry} |
|
11 |
|
\geometry{vmargin={.8in, .9in}, hmargin=1in} |
|
12 |
|
\linespread{1.1} |
|
13 |
|
|
|
14 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
15 |
|
% Info / Layout / Headers % |
|
16 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
17 |
|
|
|
18 |
|
\IfTagSetTF{hw}{ |
|
19 |
|
%%%%%%%%%%%% |
|
20 |
|
% Homework % |
|
21 |
|
%%%%%%%%%%%% |
|
22 |
|
\newcommand{\hwTitle}{Homework\ \#\hwNum} |
|
23 |
|
\newcommand{\hwInstructions}{% |
|
24 |
|
Quiz\ \#\hwNum, on \displaydate{hwDateNext}, will consist of questions taken or inspired from this homework.% |
|
25 |
|
} |
|
26 |
|
\newcommand{\hwDatetoprint}{\displaydate{hwDate}} |
|
27 |
|
\preto\enddocument{\begin{center}\LARGE \aldineleft \end{center}} |
|
28 |
|
}{ |
|
29 |
|
\IfTagSetTF{qz}{ |
|
30 |
|
%%%%%%%% |
|
31 |
|
% Quiz % |
|
32 |
|
%%%%%%%% |
|
33 |
|
\newcommand{\hwTitle}{Quiz\ \# \hwNum} |
|
34 |
|
\newcommand{\hwInstructions}{% |
|
35 |
|
The quiz is taken book closed, and in silence. Please give complete solution to the following questions.% |
|
36 |
|
} |
|
37 |
|
\newcommand{\hwDatetoprint}{\displaydate{hwDateNext}} |
|
38 |
|
}{ |
|
39 |
|
\IfTagSetTF{ex}{ |
|
40 |
|
%%%%%%%% |
|
41 |
|
% Exam % |
|
42 |
|
%%%%%%%% |
|
43 |
|
\newcommand{\hwTitle}{Exam\ \# \hwNum} |
|
44 |
|
\newcommand{\hwInstructions}{% |
|
45 |
|
The exam is taken without any material beside writing material% (in particular, calculators are \emph{not} allowed) |
|
46 |
|
, and in silence. |
|
47 |
|
Answer the following questions and problems, trying to be as clear and as accurate as possible. |
|
48 |
|
Take the time to read carefully the statements before trying to answer them. |
|
49 |
|
You can write on the back of your test, in which case you're asked to indicate it clearly. |
|
50 |
|
% You can use the abbreviations \csi{C.WL()} and \csi{C.RL()} as we do in class, but please make sure lower case and upper case letters are easy to distinguish. |
|
51 |
|
% Every example of execution is displayed with the \underline{user input underlined}, and carriage return is represented by {\symb ↵}. % $\dlsh$ |
|
52 |
|
This exam has \numberofusedexercises{} problems, for a total of \printtotalpoints{}. |
|
53 |
|
% (\(+\)\printtotalbonus{}). |
|
54 |
|
|
|
55 |
|
%This exam has \numquestions\ questions, for a total of \numpoints\ points. |
|
56 |
|
%The number of points for each question is for indicative purposes only. |
|
57 |
|
|
|
58 |
|
%\qformat{\textbf{Problem \thequestion} \hfill %\dotfill |
|
59 |
|
% \totalpoints\ points} |
|
60 |
|
} |
|
61 |
|
\newcommand{\hwDatetoprint}{\displaydate{hwDate}} |
|
62 |
|
}{ |
|
63 |
|
\IfTagSetT{fi}{ |
|
64 |
|
%%%%%%%%% |
|
65 |
|
% Finale% |
|
66 |
|
%%%%%%%%% |
|
67 |
|
\newcommand{\hwTitle}{Final Exam} |
|
68 |
|
\newcommand{\hwInstructions}{% |
|
69 |
|
The exam is taken without any material beside writing material, and in silence. |
|
70 |
|
Answer the following questions and problems, trying to be as clear and as accurate as possible. |
|
71 |
|
You can write on the back of your test, in which case you're asked to indicate it clearly. |
|
72 |
|
This exam has \numberofusedexercises{} problems, for a total of \printtotalpoints{}.% (\(+\)\printtotalbonus{}). |
|
73 |
|
|
|
74 |
|
%This exam has \numquestions\ questions, for a total of \numpoints\ points. |
|
75 |
|
%The number of points for each question is for indicative purposes only. |
|
76 |
|
|
|
77 |
|
%\qformat{\textbf{Problem \thequestion} \hfill %\dotfill |
|
78 |
|
% \totalpoints\ points} |
|
79 |
|
} |
|
80 |
|
\newcommand{\hwDatetoprint}{\displaydate{hwDate}} |
|
81 |
|
}}}} |
|
82 |
|
|
|
83 |
|
\newcommand{\hwAuthorName}{Clément Aubert} |
|
84 |
|
|
|
85 |
|
\hypersetup{ |
|
86 |
|
pdfinfo={ |
|
87 |
|
Title={\hwTitle}, |
|
88 |
|
Author={\hwAuthorName}, |
|
89 |
|
CreationDate={\hwDatetoprint}, |
|
90 |
|
Subject={\hwClass} |
|
91 |
|
} |
|
92 |
|
} |
|
93 |
|
|
|
94 |
|
%%%%%%%%%% |
|
95 |
|
% Header % |
|
96 |
|
%%%%%%%%%% |
|
97 |
|
|
|
98 |
|
\pagestyle{fancy} |
|
99 |
|
\lhead{\textbf{\hwTitle}} % Top left header |
|
100 |
|
\IfTagSetTF{hw}% Top right header |
|
101 |
|
{\rhead{\hwClass}} |
|
102 |
|
{% |
|
103 |
|
\chead{\ifthenelse{\value{page}=1}{\textbf{Name:}}{}} |
|
104 |
|
\rhead{\ifthenelse{\value{page}=1}{\rule{1.5cm}{1pt}/\TotalExerciseGoal{points}{}{}}{}} |
|
105 |
|
} |
|
106 |
|
\lfoot{\hwDatetoprint} % Bottom left footer |
|
107 |
|
\IfTagSetTF{hw}% Bottom center footer |
|
108 |
|
{\cfoot{\website}} |
|
109 |
|
{\cfoot{\hwClass}} |
|
110 |
|
\rfoot{Page\ \thepage\ of\ \protect\pageref{LastPage}} % Bottom right footer |
|
111 |
|
|
|
112 |
|
\renewcommand\headrulewidth{0.4pt} % Size of the header rule |
|
113 |
|
\renewcommand\footrulewidth{0.4pt} % Size of the footer rule |
|
114 |
|
|
|
115 |
|
%%%%%%%%%%%%%% |
|
116 |
|
% Decoration % |
|
117 |
|
%%%%%%%%%%%%%% |
|
118 |
|
|
|
119 |
|
\titleformat{\section}[block]{\Large\bfseries\filcenter}{}{.1em}{} |
File latex/xsim.sty added (mode: 100644) (index 0000000..080afe7) |
|
1 |
|
\DeclareExerciseEnvironmentTemplate{runinex} |
|
2 |
|
{% |
|
3 |
|
\par\vspace{\baselineskip} |
|
4 |
|
\Needspace*{2\baselineskip} |
|
5 |
|
\noindent |
|
6 |
|
\textbf{\XSIMmixedcase{\GetExerciseName}\ % |
|
7 |
|
\GetExerciseProperty{counter} - } % |
|
8 |
|
} |
|
9 |
|
{} |
|
10 |
|
|
|
11 |
|
|
|
12 |
|
\DeclareExerciseEnvironmentTemplate{runinsol} |
|
13 |
|
{% |
|
14 |
|
\par\vspace{\baselineskip} |
|
15 |
|
\Needspace*{2\baselineskip} |
|
16 |
|
\noindent |
|
17 |
|
\textbf{\XSIMmixedcase{\GetExerciseName}.} % |
|
18 |
|
}% |
|
19 |
|
{} |
|
20 |
|
|
|
21 |
|
|
|
22 |
|
\DeclareExerciseEnvironmentTemplate{pointsInMargin} |
|
23 |
|
{% |
|
24 |
|
\par\vspace{\baselineskip} |
|
25 |
|
\Needspace*{2\baselineskip} |
|
26 |
|
\noindent |
|
27 |
|
\textbf{\XSIMmixedcase{\GetExerciseName}~ |
|
28 |
|
\GetExerciseProperty{counter}. } % |
|
29 |
|
\GetExercisePropertyT{subtitle}{ \textit{#1}} % <<< notice the space |
|
30 |
|
\IfInsideSolutionF{% |
|
31 |
|
\GetExercisePropertyT{points}{% |
|
32 |
|
\marginpar{% |
|
33 |
|
\IfInsideSolutionF{\rule{1.2cm}{1pt}/\\}% <<<< NEW |
|
34 |
|
\printgoal{\PropertyValue}% |
|
35 |
|
\GetExercisePropertyT{bonus-points}{+\printgoal{\PropertyValue}}% |
|
36 |
|
\,\IfExerciseGoalSingularTF{points} |
|
37 |
|
{\XSIMtranslate{point-abbr}} |
|
38 |
|
{\XSIMtranslate{point-abbr}}% |
|
39 |
|
}% |
|
40 |
|
}% |
|
41 |
|
}% |
|
42 |
|
} |
|
43 |
|
{} |
|
44 |
|
|
|
45 |
|
|
|
46 |
|
\DeclareExerciseType{problem}{ |
|
47 |
|
exercise-env = problem , |
|
48 |
|
solution-env = answer , |
|
49 |
|
exercise-name = Problem , |
|
50 |
|
solution-name = Answer , |
|
51 |
|
exercise-template = default , |
|
52 |
|
solution-template = default |
|
53 |
|
} |
|
54 |
|
|
|
55 |
|
\xsimsetup{ |
|
56 |
|
exercise/name = Q. , |
|
57 |
|
exercise/within = section , |
|
58 |
|
exercise/the-counter = \arabic{exercise} , |
|
59 |
|
problem/within = section , |
|
60 |
|
problem/the-counter = \arabic{problem} , |
|
61 |
|
solution/template = runinsol , |
|
62 |
|
path = {latex/cache/xsim} |
|
63 |
|
} |
|
64 |
|
|
|
65 |
|
\IfTagSetTF{hw}{ |
|
66 |
|
\xsimsetup{% |
|
67 |
|
exercise/template = runinex |
|
68 |
|
} |
|
69 |
|
}{ |
|
70 |
|
\xsimsetup{ |
|
71 |
|
exercise/template = pointsInMargin,% |
|
72 |
|
problem/template = pointsInMargin% , |
|
73 |
|
% problem/post-hook = {\vspace*{10em}} |
|
74 |
|
} |
|
75 |
|
} |
File template.tex added (mode: 100644) (index 0000000..2a4dc59) |
|
1 |
|
%%%%%%%%%%%% |
|
2 |
|
% Specific to the document |
|
3 |
|
\newdate{hwDateNext}{06}{09}{2012} |
|
4 |
|
\newdate{hwDate}{06}{09}{2012} |
|
5 |
|
\newcommand{\hwNum}{2} % Number of the Homework / Quiz / Exam / Final. |
|
6 |
|
%%%%%%%%%%% |
|
7 |
|
|
|
8 |
|
\usepackage{latex/course} |
|
9 |
|
\usepackage{latex/style} |
|
10 |
|
\usepackage{latex/xsim} |
|
11 |
|
|
|
12 |
|
\begin{document} |
|
13 |
|
|
|
14 |
|
% Debugging: |
|
15 |
|
% \noindent Homework: \IfTagSetTF{hw}{true}{false}\\ |
|
16 |
|
% Quiz: \IfTagSetTF{qz}{true}{false}\\ |
|
17 |
|
% Exam: \IfTagSetTF{ex}{true}{false}\\ |
|
18 |
|
% Finale: \IfTagSetTF{fi}{true}{false} |
|
19 |
|
|
|
20 |
|
\hwInstructions{} |
|
21 |
|
\IfTagSetT{hw}{ |
|
22 |
|
\section{Part I -- Questions} |
|
23 |
|
} |
|
24 |
|
|
|
25 |
|
\begin{exercise}[tags={hw}] |
|
26 |
|
Homework question. |
|
27 |
|
|
|
28 |
|
\end{exercise} |
|
29 |
|
|
|
30 |
|
\begin{solution} |
|
31 |
|
Solution. |
|
32 |
|
\end{solution} |
|
33 |
|
|
|
34 |
|
\begin{exercise}[tags={qz}, points={12}] |
|
35 |
|
Quizz question. |
|
36 |
|
\end{exercise} |
|
37 |
|
|
|
38 |
|
\begin{problem}[tags={ex}, points={30}] |
|
39 |
|
Test, examen. |
|
40 |
|
\end{problem} |
|
41 |
|
|
|
42 |
|
\begin{problem}[tags={fi}, points={30}] |
|
43 |
|
Test, final. |
|
44 |
|
\end{problem} |
|
45 |
|
|
|
46 |
|
\IfTagSetF{hw}{ |
|
47 |
|
\end{document} |
|
48 |
|
} |
|
49 |
|
|
|
50 |
|
\begin{center}\LARGE \aldineleft \end{center} |
|
51 |
|
\section{Part II -- Problems} |
|
52 |
|
|
|
53 |
|
\begin{problem}[tags={hw}] |
|
54 |
|
\label{pb:test} |
|
55 |
|
Problem for homework, and various useful snippets. |
|
56 |
|
|
|
57 |
|
\SI{100}{\gram}, % |
|
58 |
|
\SI{0.04}[\$]{} |
|
59 |
|
|
|
60 |
|
{ |
|
61 |
|
\centering |
|
62 |
|
\rowcolors{2}{gray!25}{white} |
|
63 |
|
\begin{tabular}{c c} |
|
64 |
|
\rowcolor{gray!40} \rule{0pt}{25pt} \textbf{Operation} & \textbf{Result}\\ |
|
65 |
|
\mintinline{csharp}{3 + 4} & \mintinline{csharp}{7}\\ |
|
66 |
|
\mintinline{csharp}{3 - 4} & \mintinline{csharp}{-1}\\ |
|
67 |
|
\mintinline{csharp}{3 * 4} & \mintinline{csharp}{12}\\ |
|
68 |
|
\mintinline{csharp}{6 / 2} & \mintinline{csharp}{3}\\ |
|
69 |
|
\mintinline{csharp}{6 % 4} & \mintinline{csharp}{2} |
|
70 |
|
\end{tabular} |
|
71 |
|
|
|
72 |
|
} |
|
73 |
|
|
|
74 |
|
Here is an example of execution, where the user input is underlined, and hitting \enquote{enter} is represented by {\symb ↵}: |
|
75 |
|
|
|
76 |
|
\begin{minted}[escapeinside=||]{text} |
|
77 |
|
Please, enter your name, followed by enter. |
|
78 |
|
|\underline{Clément{\symb ↵}}| |
|
79 |
|
Please, enter your area code, followed by enter. |
|
80 |
|
|\underline{828{\symb ↵}}| |
|
81 |
|
Your id is Clément828 |
|
82 |
|
Press any key to continue . . . |
|
83 |
|
\end{minted} |
|
84 |
|
|
|
85 |
|
\begin{center} |
|
86 |
|
\begin{tabular}{|l|} |
|
87 |
|
\hline |
|
88 |
|
\multicolumn{1}{|c|}{Circle}\\ |
|
89 |
|
\hline |
|
90 |
|
- radius : float\hspace*{4em}\\ |
|
91 |
|
\hline |
|
92 |
|
+ setRadius(radiusParam : float) : void\\ |
|
93 |
|
+ getRadius(): float\\ |
|
94 |
|
+ getArea(): float\\\hline |
|
95 |
|
\end{tabular} |
|
96 |
|
\end{center} |
|
97 |
|
|
|
98 |
|
|
|
99 |
|
\begin{minted}{csharp} |
|
100 |
|
public void SetRadius(double RadiusArgument) |
|
101 |
|
{ |
|
102 |
|
radius = RadiusArgument; |
|
103 |
|
} |
|
104 |
|
\end{minted} |
|
105 |
|
|
|
106 |
|
See Listings~\ref{figex1}, where the user input is underlined, and hitting carriage return is represented by {\symb ↵}. |
|
107 |
|
\end{problem} |
|
108 |
|
|
|
109 |
|
\begin{listing} |
|
110 |
|
\begin{minted}[escapeinside=||]{text} |
|
111 |
|
Enter 'c' for 10x15cm, anything else for 8x11in. |
|
112 |
|
|\underline{c{\symb ↵}}| |
|
113 |
|
Is this your first time here? Type 'y' for 'yes'. |
|
114 |
|
|\underline{y{\symb ↵}}| |
|
115 |
|
Enter a number of copies. |
|
116 |
|
|\underline{90{\symb ↵}}| |
|
117 |
|
Welcome! |
|
118 |
|
We cherish our new customers, so we are giving you a $3 discount! |
|
119 |
|
Your total is $13,50. You had a 10% discount! |
|
120 |
|
\end{minted} |
|
121 |
|
\caption{A First Example of Execution for Problem~\autoref{pb:test}} |
|
122 |
|
\label{figex1} |
|
123 |
|
\end{listing} |
|
124 |
|
|
|
125 |
|
%\begin{multicols}{2} |
|
126 |
|
\begin{minted}[linenos]{mysql} |
|
127 |
|
CREATE TABLE AUTHOR( |
|
128 |
|
FName VARCHAR(30), |
|
129 |
|
LName VARCHAR(30), |
|
130 |
|
Id INT PRIMARY KEY |
|
131 |
|
); |
|
132 |
|
\end{minted} |
|
133 |
|
\label{code} |
|
134 |
|
%\end{multicols} |
|
135 |
|
|
|
136 |
|
\end{document} |