caubert / HW_Template (public) (License: Creative Commons Attribution 4.0 International License) (since 2019-05-20) (hash sha1)
Latex macros and document to create easily homeworks, quizzes, exams and final exams for the computer science classes I teach.

/template.tex (2a4dc59cd1cca3f4312b9b1a641b48db5e6dc707) (3149 bytes) (mode 100644) (type blob)

%%%%%%%%%%%%
% Specific to the document
\newdate{hwDateNext}{06}{09}{2012}
\newdate{hwDate}{06}{09}{2012}
\newcommand{\hwNum}{2} % Number of the Homework / Quiz / Exam / Final.
%%%%%%%%%%%

\usepackage{latex/course}
\usepackage{latex/style}
\usepackage{latex/xsim}

\begin{document}

% Debugging:
% \noindent Homework: \IfTagSetTF{hw}{true}{false}\\
% Quiz: \IfTagSetTF{qz}{true}{false}\\
% Exam: \IfTagSetTF{ex}{true}{false}\\
% Finale:	\IfTagSetTF{fi}{true}{false}

\hwInstructions{}
\IfTagSetT{hw}{
	\section{Part I -- Questions}
}

\begin{exercise}[tags={hw}]
	Homework question.
	
\end{exercise}

\begin{solution}
	Solution.
\end{solution}

\begin{exercise}[tags={qz}, points={12}]
	Quizz question.
\end{exercise}

\begin{problem}[tags={ex}, points={30}]
Test, examen.
\end{problem}

\begin{problem}[tags={fi}, points={30}]
Test, final.
\end{problem}

\IfTagSetF{hw}{
\end{document}
}

\begin{center}\LARGE \aldineleft \end{center}
\section{Part II -- Problems}

\begin{problem}[tags={hw}]
	\label{pb:test}
Problem for homework, and various useful snippets.

\SI{100}{\gram}, %
\SI{0.04}[\$]{}

{
	\centering
	\rowcolors{2}{gray!25}{white}
	\begin{tabular}{c c}
		\rowcolor{gray!40} \rule{0pt}{25pt} \textbf{Operation} & \textbf{Result}\\
		\mintinline{csharp}{3 + 4} & \mintinline{csharp}{7}\\
		\mintinline{csharp}{3 - 4} & \mintinline{csharp}{-1}\\
		\mintinline{csharp}{3 * 4} & \mintinline{csharp}{12}\\
		\mintinline{csharp}{6 / 2} & \mintinline{csharp}{3}\\
		\mintinline{csharp}{6 % 4} & \mintinline{csharp}{2}
		\end{tabular}
		
	}

Here is an example of execution, where the user input is underlined, and hitting \enquote{enter} is represented by {\symb ↵}:

\begin{minted}[escapeinside=||]{text}
Please, enter your name, followed by enter.
|\underline{Clément{\symb ↵}}|
Please, enter your area code, followed by enter.
|\underline{828{\symb ↵}}|
Your id is Clément828
Press any key to continue . . .
\end{minted}

	\begin{center}
	\begin{tabular}{|l|}
		\hline
		\multicolumn{1}{|c|}{Circle}\\
		\hline
		- radius : float\hspace*{4em}\\
		\hline
		+ setRadius(radiusParam : float) : void\\
		+ getRadius(): float\\
		+ getArea(): float\\\hline
	\end{tabular}
\end{center}


\begin{minted}{csharp}
public void SetRadius(double RadiusArgument)
{
radius = RadiusArgument;
}
\end{minted}

See Listings~\ref{figex1}, where the user input is underlined, and hitting carriage return is represented by {\symb ↵}.
\end{problem}

\begin{listing}
	\begin{minted}[escapeinside=||]{text}
	Enter 'c' for 10x15cm, anything else for 8x11in.
	|\underline{c{\symb ↵}}|
	Is this your first time here? Type 'y' for 'yes'.
	|\underline{y{\symb ↵}}|
	Enter a number of copies.
	|\underline{90{\symb ↵}}|
	Welcome!
	We cherish our new customers, so we are giving you a $3 discount!
	Your total is $13,50. You had a 10% discount!
	\end{minted}
	\caption{A First Example of Execution for Problem~\autoref{pb:test}}
	\label{figex1}
\end{listing}

%\begin{multicols}{2}
\begin{minted}[linenos]{mysql}
CREATE TABLE AUTHOR(
	FName VARCHAR(30),
	LName VARCHAR(30),
	Id INT PRIMARY KEY
);
\end{minted}
\label{code}
%\end{multicols}

\end{document}

Mode Type Size Ref File
040000 tree - a1136a5f7a1920eccd50038dff2d9e6598e392b2 latex
100644 blob 359 57c4371348ce14aac381e956cf4ee4f8a97755ac main.tex
100644 blob 3149 2a4dc59cd1cca3f4312b9b1a641b48db5e6dc707 template.tex
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/caubert/HW_Template

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/caubert/HW_Template

Clone this repository using git:
git clone git://git.rocketgit.com/user/caubert/HW_Template

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main