summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/uassign
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-08 21:27:03 +0000
committerKarl Berry <karl@freefriends.org>2015-09-08 21:27:03 +0000
commit1cbe6d526f871c46e2fa636611f1173b3e9411eb (patch)
tree4f93e29e34e5c6fa063b2599245e649e0f6204f9 /Master/texmf-dist/tex/latex/uassign
parentaf86b79e62d0939454e4969229a28ac4392df64c (diff)
uassign (8sep15)
git-svn-id: svn://tug.org/texlive/trunk@38326 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/uassign')
-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