You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

114 lines
2.6 KiB

\newcommand{\prac}{}
\newcommand{\lect}{}
\newcommand{\self}{}
\newcommand{\points}[1]{{\color{red}[#1 \ifthenelse{#1=1}{point}{points}]}}
\newcommand{\setsectionnum}[1]{%
\unless\iftitle%
\setcounter{section}{#1}%
\fi%
}
\makeatletter
\newcommand\annotateFilename[1]{%
\ifannotate
\filename@parse{#1}%
\edef\filename{\detokenize\expandafter{\filename@base}.\detokenize\expandafter{\filename@ext}}%
\marginnote{\fbox{\color{red}\filename}}
\fi
}
\makeatother
\newcommand\printSolution[1]{
\begin{solutionBox}%
\input{#1}\annotateFilename{#1}%
\end{solutionBox}%
}
\newcommand\printSolutionBreakable[1]{
\begin{breakableSolutionBox}%
\input{#1}\annotateFilename{#1}%
\end{breakableSolutionBox}%
}
\newcommand\question[4][]{%
\def\BREAKABLE{#1}%
\def\FILENAME{#2}%
\def\SOLUTIONS{#3}%
\def\SPACING{#4}%
\input{\FILENAME}\annotateFilename{\FILENAME}
\ifsolution
\ifthenelse{ \equal{\BREAKABLE}{} }%
{\renewcommand*{\do}[1]{\printSolution{##1}}% How to process each item
\docsvlist{#3}}%
{\renewcommand*{\do}[1]{\printSolutionBreakable{##1}}% How to process each item
\docsvlist{#3}}%
\fi
\ifspacing
\vspace{\SPACING}
\fi
}
\newcommand\mcquestion[2]{%
\def\QUESTION{#1}%
\def\SOLUTION{#2}%
\ifsolution
\input{\SOLUTION}\annotateFilename{\SOLUTION}
\else
\input{\QUESTION}\annotateFilename{\QUESTION}
\fi
}
\newcommand\dpllquestion[2]{%
\def\QUESTION{#1}%
\def\SOLUTION{#2}%
\ifsolution
\input{\SOLUTION}
\else
\input{\QUESTION}
\fi
}
\newcommand*\widefbox[1]{%
\def\TOPBOTMARGIN{.5}
\def\LEFTMARGIN{0.5ex}
\def\SOLUTIONTEXT{#1}
\fbox{\parbox{%
\dimexpr\textwidth-11\fboxsep-4\fboxrule\relax}{
\vspace{\TOPBOTMARGIN\baselineskip}\hspace{\LEFTMARGIN}\SOLUTIONTEXT\vspace{\TOPBOTMARGIN\baselineskip}}
}
}
\newenvironment{pythonSourceCode}
{\VerbatimEnvironment\begin{minted}[mathescape, linenos, numbersep=5pt, gobble=2, frame=lines, framesep=2mm]{python}}
{\end{minted}}
\makeatletter
\NewDocumentEnvironment{refenumerate}{m}
{\begin{enumerate}[align=left,leftmargin=1.0em,itemsep=0.25em,itemindent=2.25em,label=\thesubsection.{\arabic*}]}
{\edef\@currentlabel{\arabic{\@enumctr}}\label{#1}\end{enumerate}}
\makeatother
\newcommand{\getenumcount}[1]{\getrefnumber{#1}}
\newenvironment{questionSection}[1]%
{
\subsection{#1\ifannotate{\color{red}~- \getenumcount{\thesubsection} Questions}\fi}%
\begin{refenumerate}{\thesubsection}%
}%
{%
\end{refenumerate}%
}%
\newenvironment{compactItemize}[1][-0.2pt]
{\begin{itemize}\setlength{\itemsep}{#1}}
{\end{itemize}}
\newcommand\TODONOTE[1]{
\marginnote{\color{red}\footnotesize TODO}
}