C++ SS22: Klausur Strukturentwurf
This commit is contained in:
@@ -0,0 +1,481 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesClass{zitiexercise}[2021/10/12 v1.0 ZITI exercise / exam class]
|
||||
|
||||
\RequirePackage{l3keys2e,xparse,kvoptions,etoolbox}
|
||||
\RequirePackage[utf8]{inputenc}
|
||||
|
||||
\ExplSyntaxOn
|
||||
|
||||
\msg_new:nnn { zitiexercise } { options / replaced } { The~'#1'~option~does~not~work~with~this~class,
|
||||
~use~'#2'~instead. }
|
||||
|
||||
\bool_new:N \l_iwr_twosided_bool
|
||||
\bool_new:N \l_iwr_type_set_bool
|
||||
|
||||
\keys_define:nn { zitiexercise }
|
||||
{
|
||||
solutions .bool_set:N = \l_iwr_solutions_bool,
|
||||
hidepoints .bool_set:N = \l_iwr_hidepoints_bool,
|
||||
nogit .bool_set:N = \l_iwr_nogit_bool,
|
||||
|
||||
answers .code: n = \msg_warning:nnnn { zitiexercise }{ options / replaced }{ answers }{ solutions },
|
||||
noanswers .code: n = \msg_warning:nnnn { zitiexercise }{ options / replaced }{ noanswers }{ solutions },
|
||||
|
||||
type .choice:,
|
||||
type / exam .code:n = {
|
||||
\bool_set_true:N \l_iwr_type_set_bool
|
||||
\bool_set_true:N \l_iwr_twosided_bool
|
||||
\AtEndPreamble{
|
||||
\iwr@setup@exam
|
||||
\bool_if:NTF \l_iwr_solutions_bool {
|
||||
\NewDocumentCommand{\iwr@exercise@title}{}{\examsolutionstitlepage}
|
||||
\RenewDocumentCommand \iwr@aufgabe@post {} {\vspace*{\stretch{1}}\clearpage}
|
||||
} {
|
||||
\NewDocumentCommand{\iwr@exercise@title}{}{\examtitlepage}
|
||||
\RenewDocumentCommand \iwr@aufgabe@post {} {\vspace*{\stretch{1}}\cleardoublepage}
|
||||
}
|
||||
}
|
||||
},
|
||||
type / sheet .code:n = {
|
||||
\bool_set_true:N \l_iwr_type_set_bool
|
||||
\AtEndPreamble{
|
||||
\iwr@setup@sheet
|
||||
\bool_if:NTF \l_iwr_solutions_bool {
|
||||
\NewDocumentCommand{\iwr@exercise@title}{}{\sheetsolutionstitle}
|
||||
} {
|
||||
\NewDocumentCommand{\iwr@exercise@title}{}{\sheettitle}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
lang .choice:,
|
||||
lang / german .code:n = {
|
||||
\bool_set_true:N \l_iwr_lang_german_bool
|
||||
},
|
||||
lang / english .code:n = {
|
||||
\bool_set_false:N \l_iwr_lang_german_bool
|
||||
},
|
||||
|
||||
subject .tl_set:N = \l_iwr_subject_tl,
|
||||
subject .value_required:n = true,
|
||||
subject .initial:n = XXX-SUBJECT-XXX,
|
||||
|
||||
shortsubject .tl_set:N = \l_iwr_shortsubject_tl,
|
||||
shortsubject .value_required:n = true,
|
||||
shortsubject .initial:n = XXX-SHORTSUBJECT-XXX,
|
||||
|
||||
datetime .tl_set:N = \l_iwr_datetime_tl,
|
||||
datetime .value_required:n = true,
|
||||
datetime .initial:n = ,
|
||||
|
||||
duration .tl_set:N = \l_iwr_duration_tl,
|
||||
duration .value_required:n = true,
|
||||
duration .initial:n = 0,
|
||||
}
|
||||
|
||||
\keys_set:nn { zitiexercise } { lang = german }
|
||||
|
||||
\NewDocumentCommand \iwr@aufgabe@post {} {}
|
||||
|
||||
\ProcessKeysOptions{ zitiexercise }
|
||||
|
||||
\bool_if:NF \l_iwr_type_set_bool {
|
||||
\AtEndPreamble{
|
||||
\iwr@setup@standalone
|
||||
}
|
||||
}
|
||||
|
||||
\bool_if:NT \l_iwr_solutions_bool {
|
||||
\PassOptionsToClass{answers}{exam}
|
||||
}
|
||||
|
||||
\bool_if:nT {\l_iwr_twosided_bool && !\l_iwr_solutions_bool} {
|
||||
\PassOptionsToClass{twoside}{exam}
|
||||
}
|
||||
|
||||
\ExplSyntaxOff
|
||||
|
||||
\PassOptionsToClass{a4paper}{exam}
|
||||
\PassOptionsToClass{11pt}{exam}
|
||||
\PassOptionsToClass{addpoints}{exam}
|
||||
|
||||
% \DeclareVoidOption{solutions}{}
|
||||
% \DeclareVoidOption{type}{}
|
||||
% \DeclareVoidOption{oneside}{\OptionNotUsed}
|
||||
% \DeclareVoidOption{twoside}{\OptionNotUsed}
|
||||
% \DeclareVoidOption{titlepage}{\OptionNotUsed}
|
||||
% %\DeclareVoidOption{answers}{\OptionNotUsed}
|
||||
% \DeclareVoidOption*{%
|
||||
% \PassOptionsToClass{\CurrentOption}{exam}
|
||||
% }
|
||||
% \ProcessKeyvalOptions{zitiexercise}
|
||||
|
||||
% Load exam documentclass
|
||||
\LoadClass{exam}
|
||||
|
||||
\RequirePackage[german]{babel}
|
||||
\RequirePackage[T1]{fontenc}
|
||||
\RequirePackage{textcomp}
|
||||
\RequirePackage{amsmath}
|
||||
\RequirePackage{amsfonts}
|
||||
\RequirePackage{amssymb}
|
||||
\RequirePackage{multicol}
|
||||
\RequirePackage{dsfont}
|
||||
\RequirePackage{xcolor}
|
||||
\RequirePackage{hyperref}
|
||||
\RequirePackage{wasysym}
|
||||
\RequirePackage{tikz}
|
||||
\usetikzlibrary{patterns}
|
||||
\usetikzlibrary{arrows.meta,calc,decorations.markings,math,arrows.meta}
|
||||
\RequirePackage{todonotes}
|
||||
\RequirePackage{parskip}
|
||||
\RequirePackage{booktabs}
|
||||
\RequirePackage{enumitem}
|
||||
\RequirePackage{mathtools}
|
||||
\RequirePackage{titling}
|
||||
\RequirePackage{subcaption}
|
||||
\RequirePackage{minted}
|
||||
\RequirePackage{catchfile}
|
||||
\RequirePackage{lmodern}
|
||||
% LB:
|
||||
\RequirePackage{listings}
|
||||
\RequirePackage{accsupp}
|
||||
% Redefine line numbers in minted listings to not show up in copy pasted text
|
||||
\renewcommand{\theFancyVerbLine}{\BeginAccSupp{ActualText={}}
|
||||
\sffamily{\scriptsize{\arabic{FancyVerbLine}}}
|
||||
\EndAccSupp{}
|
||||
}
|
||||
|
||||
\hypersetup{
|
||||
colorlinks,
|
||||
linkcolor={red!50!black},
|
||||
citecolor={blue!50!black},
|
||||
urlcolor={blue!80!black}
|
||||
}
|
||||
|
||||
\newminted{cpp}{autogobble,linenos,mathescape,samepage,frame=single}
|
||||
\newminted{bash}{autogobble,linenos,samepage,frame=single}
|
||||
|
||||
\newmintinline{bash}{}
|
||||
\newmintinline{cpp}{}
|
||||
|
||||
\NewDocumentCommand{\Real}{}{\mathbb{R}}
|
||||
|
||||
\NewDocumentEnvironment{aufgabe}{s o o}{%
|
||||
\IfBooleanTF{#1}{%
|
||||
\IfNoValueTF{#2}{%
|
||||
\bonusquestion
|
||||
}{%
|
||||
\IfNoValueTF{#3}{%
|
||||
\question[#2]
|
||||
}{%
|
||||
\bonustitledquestion{\thequestion: #3}[#2]
|
||||
}
|
||||
}
|
||||
}{%
|
||||
\IfNoValueTF{#2}{%
|
||||
\question
|
||||
}{%
|
||||
\IfNoValueTF{#3}{%
|
||||
\question[#2]
|
||||
}{%
|
||||
\titledquestion{\thequestion: #3}[#2]
|
||||
}
|
||||
}
|
||||
}
|
||||
}{\iwr@aufgabe@post}
|
||||
|
||||
\ExplSyntaxOn
|
||||
|
||||
\NewDocumentCommand \thesubject {} { \l_iwr_subject_tl }
|
||||
\NewDocumentCommand \theshortsubject {} { \l_iwr_shortsubject_tl }
|
||||
\NewDocumentCommand \subject { m o } {
|
||||
\keys_set:nn {zitiexercise} { subject = {#1} }
|
||||
\IfNoValueTF{#2}{
|
||||
\keys_set:nn {zitiexercise} { shortsubject = {#1} }
|
||||
}{
|
||||
\keys_set:nn {zitiexercise} { shortsubject = {#2} }
|
||||
}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \thedatetime {} { \l_iwr_datetime_tl }
|
||||
\NewDocumentCommand \datetime { m } { \keys_set:nn {zitiexercise} { datetime = {#1} } }
|
||||
|
||||
\NewDocumentCommand \theduration {} { \l_iwr_duration_tl }
|
||||
\NewDocumentCommand \duration { m } { \keys_set:nn {zitiexercise} { duration = {#1} } }
|
||||
|
||||
\bool_if:NTF \l_iwr_lang_german_bool {
|
||||
\AtEndPreamble {
|
||||
\pointpoints{Punkt}{Punkte}
|
||||
\bonuspointpoints{Bonuspunkt}{Bonuspunkte}
|
||||
\hqword{Aufgabe}
|
||||
\hpgword{Seite}
|
||||
\hpword{Punkte}
|
||||
\hsword{Ergebnis}
|
||||
\htword{\textbf{Gesamt}}
|
||||
\renewcommand{\solutiontitle}{\noindent\textbf{Lösung:}\par\noindent}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \instword {} {ZITI,~Universität~Heidelberg}
|
||||
\NewDocumentCommand \sdatword {} {Abgabedatum}
|
||||
\NewDocumentCommand \quesword {} {Aufgabe}
|
||||
\NewDocumentCommand \pageword {} {Seite}
|
||||
\NewDocumentCommand \soluword {} {Musterlösung}
|
||||
} {
|
||||
\AtEndPreamble {
|
||||
\hqword{Exercise}
|
||||
\hpgword{Seite}
|
||||
\hpword{Points}
|
||||
\hsword{Score}
|
||||
\htword{\textbf{Total}}
|
||||
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \instword {} {ZITI,~Heidelberg~University}
|
||||
\NewDocumentCommand \sdatword {} {Submission~date}
|
||||
\NewDocumentCommand \quesword {} {Exercise}
|
||||
\NewDocumentCommand \pageword {} {Page}
|
||||
\NewDocumentCommand \soluword {} {Sample~Solution}
|
||||
}
|
||||
|
||||
\bool_if:NTF \l_iwr_hidepoints_bool {
|
||||
\qformat{\large\textbf{\quesword\ \thequestiontitle \hfill}\vrule depth 1em width 0pt}
|
||||
\bonusqformat{\large\textbf{\quesword\ \thequestiontitle \hfill}\vrule depth 1em width 0pt}
|
||||
} {
|
||||
\qformat{\large\textbf{\quesword\ \thequestiontitle \hfill (\thepoints)}\vrule depth 1em width 0pt}
|
||||
\bonusqformat{\large\textbf{\quesword\ \thequestiontitle \hfill (\thepoints)}\vrule depth 1em width 0pt}
|
||||
}
|
||||
|
||||
\bool_if:NTF \l_iwr_nogit_bool {
|
||||
\NewDocumentCommand \iwr@git@id {} {}
|
||||
} {
|
||||
% Get name of Git repository
|
||||
\CatchFileDef{\iwr@git@repo}{"|~git~remote~get-url~origin~|~sed~'s|.*/||'~|~sed~'s|.git$||'"}{} %$
|
||||
\CatchFileDef{\iwr@git@version}{"|~git~describe"}{}
|
||||
\NewDocumentCommand \iwr@git@id {} {\iwr@git@repo : \iwr@git@version}
|
||||
}
|
||||
|
||||
\ExplSyntaxOff
|
||||
|
||||
\extrawidth{1cm}
|
||||
\extraheadheight{-.8cm}
|
||||
|
||||
% Get rid of the question indentation
|
||||
\renewcommand{\questionshook}{%
|
||||
\setlength{\itemsep}{1em}%
|
||||
\setlength{\leftmargin}{0pt}%
|
||||
\setlength{\labelwidth}{-\labelsep}%
|
||||
}
|
||||
|
||||
|
||||
\AtBeginDocument{
|
||||
\iwr@exercise@title
|
||||
}
|
||||
|
||||
\ExplSyntaxOn
|
||||
|
||||
\NewDocumentCommand \iwr@setup@exam {}{
|
||||
\headrule
|
||||
\header{\theshortsubject}{\thetitle,~\thedate}{\pageword\ \thepage{}~/~\numpages}
|
||||
\bool_if:NTF \l_iwr_solutions_bool {
|
||||
\pagestyle{headandfoot}
|
||||
\footrule
|
||||
\footer{}{\textbf{\soluword}}{}
|
||||
\extrafootheight{-1cm}
|
||||
}{
|
||||
\pagestyle{head}
|
||||
\extrafootheight{-2cm}
|
||||
}
|
||||
\coverextrafootheight{-2cm}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \iwr@setup@sheet {}{
|
||||
\runningheadrule
|
||||
\runningheader{\theshortsubject}{\thetitle,~\thedate}{\pageword\ \thepage{}~/~\numpages}
|
||||
\bool_if:NTF \l_iwr_solutions_bool {
|
||||
\pagestyle{headandfoot}
|
||||
\runningfootrule
|
||||
\runningfooter{}{\textbf{\soluword}}{}
|
||||
\extrafootheight{-1cm}
|
||||
}{
|
||||
\pagestyle{head}
|
||||
\extrafootheight{-2cm}
|
||||
}
|
||||
% add a horizontal line above the first question
|
||||
\BeforeBeginEnvironment{questions}{%
|
||||
\noindent\rule{\linewidth}{.5pt}%
|
||||
\vspace*{.5cm}%
|
||||
}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \iwrclearpageifnoanswers {}{%
|
||||
\ifprintanswers%
|
||||
\else%
|
||||
\clearpage
|
||||
\fi%
|
||||
}
|
||||
|
||||
\NewDocumentCommand \iwr@setup@standalone {}{
|
||||
\printanswers
|
||||
\extrafootheight{-2cm}
|
||||
\NewDocumentCommand{\iwr@exercise@title}{}{\standalonetitle}
|
||||
}
|
||||
|
||||
\bool_if:NF \l_iwr_type_set_bool {
|
||||
% patch aufgabe environment to also start and end the document
|
||||
% This can't be deferred to the setup command
|
||||
\BeforeBeginEnvironment{aufgabe}{%
|
||||
\begin{questions}
|
||||
}
|
||||
\AfterEndEnvironment{aufgabe}{%
|
||||
\end{questions}
|
||||
}
|
||||
}
|
||||
|
||||
\bool_if:NTF \l_iwr_lang_german_bool {
|
||||
\NewDocumentCommand \covertext {}{
|
||||
\begin{itemize}[leftmargin=*]
|
||||
\item Tragen~Sie~bitte~als~erstes~Ihren~Namen~und~Ihre~Matrikelnummer~auf~dem~Deckblatt~ein.
|
||||
\item Mit~Ihrer~Unterschrift~bestätigen~Sie,~dass~Sie~körperlich~und~geistig~in~der~Lage~sind,~an~der~Klausur~teilzunehmen.
|
||||
\item Legen~Sie~bitte~Ihren~Studierendenausweis~zur~Kontrolle~bereit.
|
||||
\item Sollte~sich~Ihr~Gesundheitszustand~während~der~Klausur~verschlechtern,~teilen~Sie~uns~dies~bitte~sofort~mit.~In~diesem~Fall~sind~Sie~verpflichtet,~direkt~einen~Arzt~aufzusuchen~und~uns~schnellstmöglichst~ein~Attest~zukommen~zu~lassen.
|
||||
\item Sie~haben~für~die~Klausur~insgesamt~\textbf{\theduration{}~Minuten}~Zeit.
|
||||
\item Für~die~Klausur~sind~keine~Hilfsmittel~zugelassen.
|
||||
\item Prüfen~Sie~bitte,~ob~Ihre~Klausur~vollständig~ist.
|
||||
\item Sie~können~Vorder-~und~Rückseiten~der~einzelnen~Aufgaben~beschreiben.
|
||||
\item Falls~Sie~mehr~Papier~benötigen,~melden~Sie~sich~bitte~bei~uns.
|
||||
\end{itemize}
|
||||
\begin{center}
|
||||
\vspace*{1em}
|
||||
\textbf{\large Viel~Erfolg!}
|
||||
\end{center}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \nameword {}{Name}
|
||||
\NewDocumentCommand \matrword {}{Matrikulationsnummer}
|
||||
\NewDocumentCommand \signword {}{Unterschrift}
|
||||
\NewDocumentCommand \leaveempty {}{Diese~Seite~bitte~freilassen}
|
||||
}{
|
||||
\NewDocumentCommand \covertext {}{
|
||||
\begin{itemize}[leftmargin=*]
|
||||
\item Please~first~enter~your~name~and~your~matriculation~number~on~the~cover~sheet.
|
||||
\item With~your~signature~you~confirm~that~you~are~physically~and~mentally~able~to~participate~in~the~exam.
|
||||
\item Please~have~your~student~ID~card~ready~for~inspection.
|
||||
\item Should~your~health~deteriorate~during~the~exam,~please~inform~us~immediately.~In~this~case~you~are~obliged~to~see~a~doctor~directly~and~send~us~a~medical~certificate~as~soon~as~possible.
|
||||
\item You~have~a~total~of~\textbf{\theduration{}~minutes}~for~the~exam.
|
||||
\item No~study~aids~of~any~kind~are~permitted~for~the~exam.
|
||||
\item Please~check~whether~your~exam~is~complete.
|
||||
\item You~can~use~both~sides~of~the~sheets~when~working~on~the~exercises.
|
||||
\item If~you~need~more~paper,~please~contact~us.
|
||||
\end{itemize}
|
||||
\begin{center}
|
||||
\vspace*{1em}
|
||||
\textbf{\large Good~Luck!}
|
||||
\end{center}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \nameword {}{Name}
|
||||
\NewDocumentCommand \matrword {}{Matriculation~Number}
|
||||
\NewDocumentCommand \signword {}{Signature}
|
||||
\NewDocumentCommand \leaveempty {}{Please~leave~this~page~empty}
|
||||
}
|
||||
|
||||
\ExplSyntaxOff
|
||||
|
||||
\NewDocumentCommand \examtitlepage {}{%
|
||||
\begin{coverpages}
|
||||
\vspace*{\stretch{1}}
|
||||
\begin{center}
|
||||
\textbf{\Huge \thetitle}\\[1em]
|
||||
{\huge \thesubject}\\[1em]
|
||||
{\Large \thedate\\[.2em] \thedatetime}\\[2em]
|
||||
|
||||
\fbox{\fbox{\parbox{.9\textwidth}{
|
||||
\covertext%
|
||||
}}}
|
||||
\end{center}
|
||||
\vspace*{1cm}
|
||||
|
||||
\begin{center}
|
||||
{
|
||||
\renewcommand{\arraystretch}{2.2}
|
||||
\begin{tabular}{|l|p{11cm}|}
|
||||
\hline
|
||||
\nameword: & \\
|
||||
\hline
|
||||
\matrword: & \\
|
||||
\hline
|
||||
\signword: & \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
}
|
||||
\ \\[2cm]
|
||||
\gradetable[h]\\
|
||||
\vspace*{\stretch{1}}
|
||||
{\footnotesize \iwr@git@id}
|
||||
\end{center}
|
||||
\clearpage
|
||||
|
||||
\vspace*{\stretch{1}}
|
||||
\begin{center}
|
||||
\Large \leaveempty%
|
||||
\end{center}
|
||||
\vspace*{\stretch{1}}
|
||||
|
||||
\cleardoublepage
|
||||
|
||||
\end{coverpages}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \examsolutionstitlepage {}{%
|
||||
\begin{coverpages}
|
||||
\vspace*{\stretch{1}}
|
||||
\begin{center}
|
||||
\textbf{\Huge \thetitle}\\[1em]
|
||||
{\huge \thesubject}\\[1em]
|
||||
{\Large \thedate}\\[6em]
|
||||
\textbf{\Huge \soluword}\\[1em]
|
||||
\vspace*{\stretch{1}}
|
||||
{\footnotesize \iwr@git@id}
|
||||
\end{center}
|
||||
\clearpage
|
||||
\end{coverpages}
|
||||
}
|
||||
|
||||
|
||||
\NewDocumentCommand \sheettitle {}{%
|
||||
\noindent\textbf{\thesubject}
|
||||
\hfill\textbf{\thetitle}\\
|
||||
\theauthor
|
||||
\hfill
|
||||
{\sdatword\ \thedate}\\
|
||||
\instword
|
||||
\hfill\texttt{\tiny \iwr@git@id}\\
|
||||
\vspace*{.5cm}
|
||||
\begin{center}
|
||||
\textbf{\Large \thetitle}
|
||||
\end{center}
|
||||
}
|
||||
|
||||
|
||||
\NewDocumentCommand \sheetsolutionstitle {}{%
|
||||
\noindent\textbf{\thesubject}
|
||||
\hfill\textbf{\thetitle}\\
|
||||
\theauthor
|
||||
\hfill
|
||||
{\sdatword\ \thedate}\\
|
||||
\instword
|
||||
\hfill\texttt{\tiny \iwr@git@id}\\
|
||||
\vspace*{.5cm}
|
||||
\begin{center}
|
||||
\textbf{\Large \thetitle}\\[.5em]
|
||||
{\Large \soluword}
|
||||
\end{center}
|
||||
}
|
||||
|
||||
\NewDocumentCommand \standalonetitle {}{%
|
||||
{\noindent\huge Aufgabe: \texttt{\textbf{\jobname}}}\\[.5em]
|
||||
{\noindent\Large git: \texttt{\textbf{\iwr@git@id}}}\\[1em]
|
||||
\noindent\rule{\linewidth}{.5pt}%
|
||||
\vspace*{.5cm}%
|
||||
}
|
||||
Reference in New Issue
Block a user