From 1cbe6d526f871c46e2fa636611f1173b3e9411eb Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 8 Sep 2015 21:27:03 +0000 Subject: uassign (8sep15) git-svn-id: svn://tug.org/texlive/trunk@38326 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/uassign/README | 24 +++++ Master/texmf-dist/doc/latex/uassign/uassign.pdf | Bin 0 -> 75443 bytes Master/texmf-dist/doc/latex/uassign/uassign.tex | 114 +++++++++++++++++++++++ Master/texmf-dist/tex/latex/uassign/uassign.sty | 82 ++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 3 +- Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 + Master/tlpkg/tlpsrc/uassign.tlpsrc | 0 7 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/doc/latex/uassign/README create mode 100644 Master/texmf-dist/doc/latex/uassign/uassign.pdf create mode 100644 Master/texmf-dist/doc/latex/uassign/uassign.tex create mode 100644 Master/texmf-dist/tex/latex/uassign/uassign.sty create mode 100644 Master/tlpkg/tlpsrc/uassign.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/uassign/README b/Master/texmf-dist/doc/latex/uassign/README new file mode 100644 index 00000000000..66d84bd1096 --- /dev/null +++ b/Master/texmf-dist/doc/latex/uassign/README @@ -0,0 +1,24 @@ +Version: 1.0 +Date: September 6, 2015 +Author: Nathan Esau +Package: uassign + +The purpose of the uassign package is to provide a simple question and solution +environment for typesetting university assignments. Although there exist Latex +classes, such as the exam class, and packages, such as the exercise package, +which could be used for this purpose, the uassign package was designed with the +following objectives in mind: + +* Simplicity: two environments, one for questions (question) and one for + solutions (solution) +* Hiding: ability to hide the question or solution environment, using the + hidequestions and hideanswers options. +* Miniminalism: only dependency is ifelse package. + +A short list of features of the environments is: + +* Automatic question numbering, or headers +* Indentation of question and solution environments +* Ability to hide environments + +For more details see the .pdf file. diff --git a/Master/texmf-dist/doc/latex/uassign/uassign.pdf b/Master/texmf-dist/doc/latex/uassign/uassign.pdf new file mode 100644 index 00000000000..3ac0f4fde9a Binary files /dev/null and b/Master/texmf-dist/doc/latex/uassign/uassign.pdf differ diff --git a/Master/texmf-dist/doc/latex/uassign/uassign.tex b/Master/texmf-dist/doc/latex/uassign/uassign.tex new file mode 100644 index 00000000000..20ef3bdfb83 --- /dev/null +++ b/Master/texmf-dist/doc/latex/uassign/uassign.tex @@ -0,0 +1,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} 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 diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index d7db3a0997a..73f3c343122 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -566,7 +566,8 @@ my @TLP_working = qw( twoinone twoup txfonts txfontsb txgreeks type1cm typeface typehtml typeoutfileinfo typicons typogrid - uaclasses uadocs uafthesis ucharcat ucharclasses ucbthesis ucdavisthesis ucs + uaclasses uadocs uafthesis uassign + ucharcat ucharclasses ucbthesis ucdavisthesis ucs ucthesis udesoftec uebungsblatt uestcthesis uiucredborder uiucthesis ukrhyph ulem ulqda ulthese umich-thesis uml umlaute umoline diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index d1411ba3b44..87096c00eb3 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -986,6 +986,7 @@ depend txgreeks depend type1cm depend typeface depend typogrid +depend uassign depend ucs depend uebungsblatt depend umoline diff --git a/Master/tlpkg/tlpsrc/uassign.tlpsrc b/Master/tlpkg/tlpsrc/uassign.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3