summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/uassign/uassign.tex
blob: 20ef3bdfb839537a7befc807a0bd1a17a47dd6d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
\documentclass[12pt]{article}

\usepackage{uassign}
\usepackage{hyperref}
\usepackage[margin=1.0in]{geometry}
%\usepackage{bookmark}

\hypersetup{
	colorlinks,
	linkcolor={blue},
	linktoc=page
}

\setcounter{secnumdepth}{0}

\title{The \texttt{uassign} package}
\author{Nathan Esau}
\date{\today}

\begin{document}

\maketitle
\tableofcontents

\section{Overview}

The purpose of the \texttt{uassign} is to provide a simple question and solution environment for typesetting university assignments. Although there exist \LaTeX \ classes, such as the \texttt{exam} class, and packages, such as the \texttt{exercise} package, which could be used for this purpose, the \texttt{uassign} package was designed with the following objectives in mind:

\begin{itemize}
\item \textit{Simplicity}: Two environments -- one for questions and one for solutions 
\item \textit{Hide environments}: Ability to produce a question sheet (questions only, i.e. an assignment) and a solution sheet (solutions only, i.e. an answer key) or both. This is done by passing a \texttt{hidequestions} or \texttt{hideanswers} option to the package
\item \textit{Minimal dependencies}: Only the \textit{ifelse} package is needed. All environments, i.e. \texttt{tabular}, \texttt{figure}, etc. can be used within the question and solution environments.

By default used within the \texttt{question} and \texttt{solution} environment.
\end{itemize}% see http://tex.stackexchange.com/questions/242036/multiline-code-listings-in-cweb
\def\beginlisting{%
    \par\vskip\baselineskip%
    \begingroup%
    \tt\obeylines\obeyspaces%
    \catcode`\{12\catcode`\}12%
}
\def\endlisting{%
    \endgroup\par%
    \vskip\baselineskip%
}

The \texttt{question} and \texttt{solution} environments provide the following features:

\begin{itemize}
\item Automatic question numbering. The question counter is called \texttt{questioncounter} and its value can be accessed using \verb|\thequestioncounter|. Likewise, the solution counter is called \texttt{solutioncounter} and its value can be accessed using \verb|\thesolutioncounter|. To set the value of the question counter use \verb|\setcounter{questioncounter}{5}| and the next question would be question \texttt{6.}
\item Indenting. The question numbers are right aligned in the left margin, and the entire question or solution is indented using a \verb|\list|.
\end{itemize}

\section{Environments}

\subsection{\texttt{question} environment}

Simply use \verb|\begin{question} ... code ... \end{question}|. For example:

\begin{verbatim}
\begin{question}
What is the answer to life and all its questions? 
\end{question}
\end{verbatim}

\noindent Which produces the following output:

\begin{question}
What is the answer to life and all its questions? 
\end{question}

\bigskip
\noindent Notice that the question is automatically numbered.

\subsection{\texttt{solution} environment}

Simply use \verb|\begin{solution} ... code ... \end{solution}|. For example:

\begin{verbatim}
\setcounter{questioncounter}{3}
\setcounter{solutioncounter}{3}

\begin{question}
What is the answer to life and all it's questions?
\end{question}

\begin{solution}
The answer is 42.
\end{solution}
\end{verbatim}

\noindent Which produces the following output:

\setcounter{questioncounter}{3}
\setcounter{solutioncounter}{3}

\begin{question}
What is the answer to life and all it's questions?
\end{question}

\begin{solution}
The answer is 42.
\end{solution}

\bigskip\noindent
A \texttt{medskip} of spacing is used before each question and solution environment.

\section{Hiding environments}

To hide solutions use the \texttt{hideanswers} option. When you load the package, the code would be \verb|\usepackage[hideanswers]{uassign}|. Likewise, questions can be hided using the \texttt{hidequestions} option. 

If questions are hide, then solutions are numbered. If questions are shown and solutions are shown, then solutions will have the word \textbf{Solution:} at the start of the solution.

\end{document}