summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/uassign/uassign.sty82
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/uassign/uassign.sty b/Master/texmf-dist/tex/latex/uassign/uassign.sty
new file mode 100644
index 00000000000..28d1c4f758e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/uassign/uassign.sty
@@ -0,0 +1,82 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{uassign}[2015/09/04 University assignments package]
+
+% Author: Nathan Esau
+% Date: September 6, 2015
+% Version: 1.0
+
+\RequirePackage{ifthen}
+
+\makeatletter
+
+% Counters
+\newcounter{questioncounter}
+\newcounter{solutioncounter}
+
+% For printing "# " OR "Solution: " for answers
+\newboolean{questionsandanswers}
+
+% For hiding question environment
+\newboolean{showquestions}
+\setboolean{showquestions}{true}
+
+% For hiding solution environment
+\newboolean{showanswers}
+\setboolean{showanswers}{true}
+
+\DeclareOption{hideanswers}{\setboolean{showanswers}{false}}
+\DeclareOption{hidequestions}{\setboolean{showquestions}{false}}
+
+\DeclareOption*{\PackageWarning{assn}{Unknown ‘\CurrentOption’}}
+\ProcessOptions\relax
+
+% For hiding
+\newsavebox{\trashcan}
+
+% Question environment
+\ifthenelse{\boolean{showquestions}}{%
+ % show the questions
+ \newenvironment{question}{%
+ %
+ \medskip
+ \refstepcounter{questioncounter}
+ \vspace{-5mm}
+ \list{\thequestioncounter .}{%
+ \settowidth{\leftmargin}{10. \hskip\labelsep}%
+ \labelwidth\leftmargin\advance\labelwidth-\labelsep
+ \partopsep=0pt\bigskip
+ \item
+ }}{\endlist}}%
+{%
+ % don't show the questions
+ \newenvironment{question}{%
+ \begin{lrbox}{\trashcan}}%
+ {\end{lrbox}}%
+\question Hello
+\endgroup
+}
+
+% Solution environment
+\ifthenelse{\boolean{showanswers}}{%
+ % show the answers
+ \newenvironment{solution}[1][1.5em]{%
+ %
+ \medskip
+ \refstepcounter{solutioncounter}
+ \vspace{-5mm}
+ \list{\ifthenelse{\boolean{showquestions}}{}{\thesolutioncounter .}}{%
+ \settowidth{\leftmargin}{10. \hskip\labelsep}%
+ \labelwidth\leftmargin\advance\labelwidth-\labelsep
+ \partopsep=0pt\bigskip
+ \ifthenelse{\boolean{showquestions}}{%
+ \medskip \item[] \qquad \ \textbf{Solution: } \vspace{-3mm} \item[]}
+ {\item}%
+ }}{\endlist}}%
+{%
+ % don't show the answers
+ \newenvironment{solution}{%
+ \begin{lrbox}{\trashcan}}%
+ {\end{lrbox}}%
+}
+
+\makeatother \ No newline at end of file