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

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
6 months ago
9 months ago
6 months ago
  1. \newcommand{\prac}{}
  2. \newcommand{\lect}{}
  3. \newcommand{\self}{}
  4. \newcommand{\points}[1]{{\color{red}[#1 \ifthenelse{#1=1}{point}{points}]}}
  5. \newcommand{\setsectionnum}[1]{%
  6. \unless\iftitle%
  7. \setcounter{section}{#1}%
  8. \fi%
  9. }
  10. \makeatletter
  11. \newcommand\annotateFilename[1]{%
  12. \ifannotate
  13. \filename@parse{#1}%
  14. \edef\filename{\detokenize\expandafter{\filename@base}.\detokenize\expandafter{\filename@ext}}%
  15. \marginnote{\fbox{\color{red}\filename}}
  16. \fi
  17. }
  18. \makeatother
  19. \newcommand\printSolution[1]{
  20. \begin{solutionBox}%
  21. \input{#1}\annotateFilename{#1}%
  22. \end{solutionBox}%
  23. }
  24. \newcommand\printSolutionBreakable[1]{
  25. \begin{breakableSolutionBox}%
  26. \input{#1}\annotateFilename{#1}%
  27. \end{breakableSolutionBox}%
  28. }
  29. \newcommand\question[4][]{%
  30. \def\BREAKABLE{#1}%
  31. \def\FILENAME{#2}%
  32. \def\SOLUTIONS{#3}%
  33. \def\SPACING{#4}%
  34. \input{\FILENAME}\annotateFilename{\FILENAME}
  35. \ifsolution
  36. \ifthenelse{ \equal{\BREAKABLE}{} }%
  37. {\renewcommand*{\do}[1]{\printSolution{##1}}% How to process each item
  38. \docsvlist{#3}}%
  39. {\renewcommand*{\do}[1]{\printSolutionBreakable{##1}}% How to process each item
  40. \docsvlist{#3}}%
  41. \fi
  42. \ifspacing
  43. \vspace{\SPACING}
  44. \fi
  45. }
  46. \newcommand\mcquestion[2]{%
  47. \def\QUESTION{#1}%
  48. \def\SOLUTION{#2}%
  49. \ifsolution
  50. \input{\SOLUTION}\annotateFilename{\SOLUTION}
  51. \else
  52. \input{\QUESTION}\annotateFilename{\QUESTION}
  53. \fi
  54. }
  55. \newcommand\dpllquestion[2]{%
  56. \def\QUESTION{#1}%
  57. \def\SOLUTION{#2}%
  58. \ifsolution
  59. \input{\SOLUTION}
  60. \else
  61. \input{\QUESTION}
  62. \fi
  63. }
  64. \newcommand*\widefbox[1]{%
  65. \def\TOPBOTMARGIN{.5}
  66. \def\LEFTMARGIN{0.5ex}
  67. \def\SOLUTIONTEXT{#1}
  68. \fbox{\parbox{%
  69. \dimexpr\textwidth-11\fboxsep-4\fboxrule\relax}{
  70. \vspace{\TOPBOTMARGIN\baselineskip}\hspace{\LEFTMARGIN}\SOLUTIONTEXT\vspace{\TOPBOTMARGIN\baselineskip}}
  71. }
  72. }
  73. \newenvironment{pythonSourceCode}
  74. {\VerbatimEnvironment\begin{minted}[mathescape, linenos, numbersep=5pt, gobble=2, frame=lines, framesep=2mm]{python}}
  75. {\end{minted}}
  76. \makeatletter
  77. \NewDocumentEnvironment{refenumerate}{m}
  78. {\begin{enumerate}[align=left,leftmargin=1.0em,itemsep=0.25em,itemindent=2.25em,label=\thesubsection.{\arabic*}]}
  79. {\edef\@currentlabel{\arabic{\@enumctr}}\label{#1}\end{enumerate}}
  80. \makeatother
  81. \newcommand{\getenumcount}[1]{\getrefnumber{#1}}
  82. \newenvironment{questionSection}[1]%
  83. {
  84. \subsection{#1\ifannotate{\color{red}~- \getenumcount{\thesubsection} Questions}\fi}%
  85. \begin{refenumerate}{\thesubsection}%
  86. }%
  87. {%
  88. \end{refenumerate}%
  89. }%
  90. \newenvironment{compactItemize}[1][-0.2pt]
  91. {\begin{itemize}\setlength{\itemsep}{#1}}
  92. {\end{itemize}}
  93. \newcommand\TODONOTE[1]{
  94. \marginnote{\color{red}\footnotesize TODO}
  95. }