diff options
author | Karl Berry <karl@freefriends.org> | 2015-09-25 23:12:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-09-25 23:12:52 +0000 |
commit | 536b6d675a9ee412a5056db0d953012a0f03fcbe (patch) | |
tree | 9eedaaa875d3d3223b0499e70a2890ec787d3f95 | |
parent | 7b3caccd5a070d5419779041629ae27d7a4a3db9 (diff) |
uassign (25sep15)
git-svn-id: svn://tug.org/texlive/trunk@38459 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/uassign/README | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/uassign/README.md | 27 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/uassign/uassign.pdf | bin | 75443 -> 112902 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/uassign/uassign.tex | 190 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/uassign/uassign.sty | 162 |
5 files changed, 299 insertions, 104 deletions
diff --git a/Master/texmf-dist/doc/latex/uassign/README b/Master/texmf-dist/doc/latex/uassign/README deleted file mode 100644 index 66d84bd1096..00000000000 --- a/Master/texmf-dist/doc/latex/uassign/README +++ /dev/null @@ -1,24 +0,0 @@ -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/README.md b/Master/texmf-dist/doc/latex/uassign/README.md new file mode 100644 index 00000000000..f25aa8d81e4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/uassign/README.md @@ -0,0 +1,27 @@ +Version: 1.01 +Date: September 23, 2015 +Author: Nathan Esau +Package: uassign + +# Overview + +## Description + +The purpose of the uassign package is to provide simple question and solution +style environments for typesetting university assignments. The uassign package +was designed with the following objectives in mind: + +* Simplicity: uassign package is small and easy to modify +* Hide environments: ability to produce a question sheet (questions only) and + solution sheet (solutions only) or both. This is done by passing the + hidequestion or hideanswers option to the package +* Flexibility: the uassign package doesn't create conflicts with other packages, + such as hyperref when included. Commands which could cause conflicts with + other packages are used only when certain options are passed to the uassign + package + +Environments: question, solution, example, exsolution, definition +Commands: ientry +Options: hidequestions, hideanswer, assignheader, notesheader, links +Packages used: ifthen, hyperref, bookmark, color, enumerate, amsmath, amsthm, + fancyhdr, titlesec diff --git a/Master/texmf-dist/doc/latex/uassign/uassign.pdf b/Master/texmf-dist/doc/latex/uassign/uassign.pdf Binary files differindex 3ac0f4fde9a..1500c13c365 100644 --- a/Master/texmf-dist/doc/latex/uassign/uassign.pdf +++ b/Master/texmf-dist/doc/latex/uassign/uassign.pdf diff --git a/Master/texmf-dist/doc/latex/uassign/uassign.tex b/Master/texmf-dist/doc/latex/uassign/uassign.tex index 20ef3bdfb83..0b8c40c2342 100644 --- a/Master/texmf-dist/doc/latex/uassign/uassign.tex +++ b/Master/texmf-dist/doc/latex/uassign/uassign.tex @@ -1,9 +1,9 @@ -\documentclass[12pt]{article} +\documentclass[twocolumn,twoside,11pt]{report} -\usepackage{uassign} +\usepackage[nobox]{assign} \usepackage{hyperref} \usepackage[margin=1.0in]{geometry} -%\usepackage{bookmark} +\def\arraystretch{1.2} \hypersetup{ colorlinks, @@ -20,95 +20,167 @@ \begin{document} \maketitle -\tableofcontents -\section{Overview} +\setcounter{secnumdepth}{-1} +\chapter{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: +\section{Description} +The purpose of the \texttt{uassign} package is to provide simple question and solution style environments for typesetting university assignments. 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. +\item \textit{Simplicity}: \texttt{uassign} package is small and easy to modify +\item \textit{Hide environments}: Ability to produce a question sheet (questions only) and a solution sheet (solutions only) or both. This is done by passing the \texttt{hidequestions} or \texttt{hideanswers} option to the package. +\item \textit{Flexibility}: The \texttt{uassign} package doesn't create conflicts with other packages, such as \texttt{hyperref} when included. Commands which could cause conflicts with other packages are used only when certain options are passed to the \texttt{uassign} package. -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: +\section{Features} + +\subsection{Environments} + +\begin{table}[!htpb] +\centering +\begin{tabular}{l l l} +\hline +Environment & Description \\ \hline +\texttt{question} & Assignment questions \\ +\texttt{solution} & Assignment solutions \\ +\texttt{example} & Illustrative examples \\ +\texttt{exsolution} & Solution to examples \\ +\texttt{definition} & Definitions for terms \\ \hline +\end{tabular} +\caption{Environments provided by \texttt{uassign}} +\end{table} + +\vspace{10mm} +\subsection{Commands} + +\begin{table}[!htpb] +\centering +\begin{tabular}{l l l} +\hline +Command & Description \\ \hline +\verb|\ientry| & Bold-faced index entry \\ \hline +%\verb|\ebox| & Square box to end solution \\ \hline +\end{tabular} +\caption{Commands provided by \texttt{uassign}} +\end{table} + +\subsection{Options} + +\begin{table}[!htpb] +\centering +\begin{tabular}{l l} +\hline +Option & Description \\ \hline +\verb|hidequestions| & Hide \texttt{question} \\ +\verb|hideanswers| & Hide \texttt{solution} \\ +\verb|assignheader| & \texttt{fancyhdr} \\ +\verb|notesheader| & \texttt{titlesec}, \texttt{fancyhdr} \\ +\verb|links| & \texttt{hypersetup} format \\ \hline +\end{tabular} +\caption{Options provided by \texttt{uassign}} +\end{table} + +\subsection{Packages used} + +\begin{table}[!htpb] +\centering +\begin{tabular}{l l} +\hline +Package(s) & Usage \\ \hline +\texttt{ifthen} & Processing options \\ +\texttt{hyperref} & Hyperlinks in pdf \\ +\texttt{bookmark} & pdf bookmarks \\ +\texttt{color} & Color links \\ +\texttt{enumerate} & Options for \texttt{enumerate} \\ +\texttt{amsmath, amsthm} & Math typesetting \\ +\texttt{fancyhdr} & Format top of page header \\ +\texttt{titlesec} & Format section, chapter \\ \hline +\end{tabular} +\caption{Packages used by \texttt{uassign}} +\end{table} + +\section{Demonstration} + +\subsection{question environment} \begin{verbatim} \begin{question} -What is the answer to life and all its questions? +What is the answer to life? \end{question} \end{verbatim} -\noindent Which produces the following output: - +\hrule \begin{question} -What is the answer to life and all its questions? +What is the answer to life? \end{question} -\bigskip -\noindent Notice that the question is automatically numbered. +\vspace{3mm} +\hrule -\subsection{\texttt{solution} environment} - -Simply use \verb|\begin{solution} ... code ... \end{solution}|. For example: +\subsection{solution environment} \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} +\hrule \begin{solution} The answer is 42. \end{solution} + +\vspace{3mm} +\hrule + +\subsection{example environment} + +\begin{verbatim} +\begin{example} +Explain what facebook is. +\end{example} \end{verbatim} -\noindent Which produces the following output: +\hrule +\begin{example} +Explain what facebook is. +\end{example} -\setcounter{questioncounter}{3} -\setcounter{solutioncounter}{3} +\vspace{3mm} +\hrule -\begin{question} -What is the answer to life and all it's questions? -\end{question} +\subsection{exsolution environment} +\begin{verbatim} \begin{solution} -The answer is 42. +Facebook is a social media site. \end{solution} +\end{verbatim} + +\hrule +\begin{exsolution} +Facebook is a social media site. +\end{exsolution} -\bigskip\noindent -A \texttt{medskip} of spacing is used before each question and solution environment. +\vspace{3mm} +\hrule -\section{Hiding environments} +\subsection{definition environment} + +\begin{verbatim} +\begin{definition} +The \ientry{mean} is the average value. +\end{definition} +\end{verbatim} -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. +\hrule +\begin{definition} +The \ientry{mean} is the average value. +\end{definition} -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. +\vspace{3mm} +\hrule \end{document} diff --git a/Master/texmf-dist/tex/latex/uassign/uassign.sty b/Master/texmf-dist/tex/latex/uassign/uassign.sty index 28d1c4f758e..07befed26f0 100644 --- a/Master/texmf-dist/tex/latex/uassign/uassign.sty +++ b/Master/texmf-dist/tex/latex/uassign/uassign.sty @@ -1,21 +1,44 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{uassign}[2015/09/04 University assignments package] +\ProvidesPackage{assign}[2015/09/23 v1.01 University assignments package] % Author: Nathan Esau -% Date: September 6, 2015 -% Version: 1.0 +% +% Packages included: ifthen, hyperref, bookmark, color, enumerate, +% amsmath, fancyhdr, titlesec +% Options: notesheader, links, hideanswers, hidequestions, +% assignheader +% Environments: question, solution, example, exsolution, definition +% Commands: ientry + +%% Project Public License, as described in lppl.txt in the base +%% LaTeX distribution, either version 1.2 or (at your option) +%% any later version. \RequirePackage{ifthen} +\RequirePackage{hyperref} +\RequirePackage{bookmark} +\RequirePackage{color} +\RequirePackage{enumerate} +\RequirePackage{amsmath} +\RequirePackage{fancyhdr} +\RequirePackage{titlesec} +\RequirePackage{amsthm} \makeatletter +% Commands +\newcommand{\ebox}[1]{% +\hfill$\qed$ +} + +\newcommand{\ientry}[1]{% +\index{#1}\textbf{#1}} + + % Counters \newcounter{questioncounter} \newcounter{solutioncounter} -% For printing "# " OR "Solution: " for answers -\newboolean{questionsandanswers} - % For hiding question environment \newboolean{showquestions} \setboolean{showquestions}{true} @@ -27,10 +50,65 @@ \DeclareOption{hideanswers}{\setboolean{showanswers}{false}} \DeclareOption{hidequestions}{\setboolean{showquestions}{false}} -\DeclareOption*{\PackageWarning{assn}{Unknown ‘\CurrentOption’}} +\DeclareOption{assignheader}{% + \pagestyle{fancy} + \fancyhf{} + \renewcommand{\headrulewidth}{0pt} + % Define rhead, lhead in assignment + + %\usepackage[margin=1.0in,headheight=27.18335pt]{geometry} + \setlength{\headheight}{27.18335pt} + \cfoot{\thepage} +} + +\DeclareOption{notesheader}{% + +% Format header +\pagestyle{fancy} +\renewcommand{\chaptermark}[1]{\markboth{#1}{}} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\fancyhead[CE]{\textit{\nouppercase{\leftmark}}} +\fancyhead[CO]{\textit{\nouppercase{\rightmark}}} +\fancyhead[LE,RO]{\thepage} +\cfoot{} + +% Format chapter +\titleformat{\chapter}[display] +{\bfseries\filcenter} +{\huge\thechapter} +{1ex} +{ +\vspace{2ex}% +\LARGE} +[\vspace{0.5ex}% +{\titlerule[1.0pt]} +\vspace{10.0ex} +] +\titlespacing*{\chapter}{0pt}{-30pt}{40pt} + +% Format section +\titleformat*{\section}{\centering\large\bfseries} +\titleformat*{\subsection}{\centering\normalsize\bfseries\itshape} +} + +\DeclareOption{links}{% + +% Hyper link setup +\hypersetup{ + colorlinks, + linkcolor={blue}, + linktoc=page, + urlcolor=blue +} + +% +} + +\DeclareOption*{\PackageWarning{uassign}{Unknown ‘\CurrentOption’}} \ProcessOptions\relax -% For hiding +% For hiding question and solution environments \newsavebox{\trashcan} % Question environment @@ -38,22 +116,27 @@ % show the questions \newenvironment{question}{% % - \medskip + \bigskip \refstepcounter{questioncounter} \vspace{-5mm} \list{\thequestioncounter .}{% \settowidth{\leftmargin}{10. \hskip\labelsep}% \labelwidth\leftmargin\advance\labelwidth-\labelsep \partopsep=0pt\bigskip - \item - }}{\endlist}}% + \item + \begingroup + }% + \endgroup + }{\endlist}}% {% % don't show the questions \newenvironment{question}{% - \begin{lrbox}{\trashcan}}% - {\end{lrbox}}% -\question Hello -\endgroup + \begin{lrbox}{\trashcan} + \begin{minipage}{5cm} + }% + {% + \end{minipage} + \end{lrbox}}% } % Solution environment @@ -61,7 +144,7 @@ % show the answers \newenvironment{solution}[1][1.5em]{% % - \medskip + \bigskip \refstepcounter{solutioncounter} \vspace{-5mm} \list{\ifthenelse{\boolean{showquestions}}{}{\thesolutioncounter .}}{% @@ -69,14 +152,51 @@ \labelwidth\leftmargin\advance\labelwidth-\labelsep \partopsep=0pt\bigskip \ifthenelse{\boolean{showquestions}}{% - \medskip \item[] \qquad \ \textbf{Solution: } \vspace{-3mm} \item[]} + \bigskip \item[] \textbf{Solution: } \medskip \item[]} {\item}% - }}{\endlist}}% + \begingroup + }% + \endgroup + }{\endlist}}% {% % don't show the answers \newenvironment{solution}{% - \begin{lrbox}{\trashcan}}% - {\end{lrbox}}% + \begin{lrbox}{\trashcan} + \begin{minipage}{5cm} + }% + {% + \end{minipage} + \end{lrbox}}% } + +\newcounter{examplecounter} +%\numberwithin{examplecounter}{chapter} +\newcounter{exsolutioncounter} +%\numberwithin{solutioncounter}{chapter} +\newcounter{defcounter} +%\numberwithin{defcounter}{chapter} + +% Example environment +\newenvironment{example}{ +\bigskip + \refstepcounter{examplecounter} + \noindent\textbf{Example \theexamplecounter} +}{} + +% Solution environment +\newenvironment{exsolution}{ +\bigskip + \refstepcounter{exsolutioncounter} + \noindent\textbf{Solution \theexsolutioncounter} + \begingroup + \endgroup +}{} + +% Definition environment +\newenvironment{definition}{ +\bigskip + \refstepcounter{defcounter} + \noindent\textbf{Definition \thedefcounter} +}{} -\makeatother
\ No newline at end of file +\makeatother |