texlive[49590] Master: exercisepoints (3jan19)
commits+karl at tug.org
commits+karl at tug.org
Thu Jan 3 22:59:46 CET 2019
Revision: 49590
http://tug.org/svn/texlive?view=revision&revision=49590
Author: karl
Date: 2019-01-03 22:59:46 +0100 (Thu, 03 Jan 2019)
Log Message:
-----------
exercisepoints (3jan19)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/exercisepoints/
trunk/Master/texmf-dist/doc/latex/exercisepoints/README.md
trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.pdf
trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.tex
trunk/Master/texmf-dist/tex/latex/exercisepoints/
trunk/Master/texmf-dist/tex/latex/exercisepoints/exercisepoints.sty
trunk/Master/tlpkg/tlpsrc/exercisepoints.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/exercisepoints/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/exercisepoints/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/exercisepoints/README.md 2019-01-03 21:59:46 UTC (rev 49590)
@@ -0,0 +1,48 @@
+# The exercisepoints Package
+A LaTeX package to count exercises and points
+
+## Introduction and Usage
+This package can be used to facilitate exercise counting and exercise point counting in a LaTeX-document. It counts the number of exercises and it sums all the points of the exercises in a document.
+Especially for exams it is also common to have an overview of all exercises and their maximal points. This is also supported by this package by providing a macro to retrieve the points of each exercise.
+
+### Load the Package
+To use this package type
+```
+ \usepackage{exercisepoints}
+```
+anywhere in your document’s preamble. If this does not work because the package is not contained in your LaTeX-distribution, simply copy the file ‘exercisepoints.sty’ into the same folder as your document (or, if you plan to use it more often, copy it into your local texmf directory). There are no options and this package does not require any other packages to be loaded (it loads the ifthen package).
+
+### Typeset a First Exercise
+Now you can typeset your first exercise using the following code.
+```
+\begin{exercise}[Simple Addition]
+ What is 1+1?\points{2.5}
+\end{exercise}
+```
+
+### Further Information
+For further information please read the package documentation in ‘exercisepoints.pdf’ (you can either obtain this file from the GitHub releases page or simply compile the file ‘exercisepoints.tex’ twice with pdflatex).
+
+## Version History
+- *2019/01/03 v1.2.3* Revised README.md
+- *2019/01/02 v1.2.2* Revised documentation
+- *2018/08/15 v1.2.1* Renamed the package from *hkexercise* to *exercisepoints* to comply with CTAN rules (see [CTAN](https://ctan.org/file/help/ctan/CTAN-upload-addendum))
+- *2017/02/27 v1.2.0* Added the ``\setitempointsunit{...} `` command.
+- *2017/07/02 v1.1.0* This version introduces subexercises. Moreover several checks were added to avoid use of commands like ``\currentexercisepoints`` outside of exercise environments and to prevent nesting of exercises. New option ``customlayout`` disables built in exercise layout. Added ``\bonuspoint`` commands.
+- *2017/06/26 v1.0.1* Redefined ``\currentexercisepoints`` so it can be used within section command.
+- *2017/06/26 v1.0* The initial version of this package is published on GitHub.
+
+## Copyright and License
+Copyright © 2017-2019 Henning Kerstan.
+
+This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version. The latest version of this license is in
+
+[http://www.latex-project.org/lppl.txt](http://www.latex-project.org/lppl.txt)
+
+and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.
+
+This work has the LPPL maintenance status ‘maintained’.
+
+The Current Maintainer of this work is Henning Kerstan.
+
+This work consists of the files ‘exercisepoints.sty’ and ‘exercisepoints.tex’.
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/exercisepoints/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.pdf 2019-01-03 21:58:47 UTC (rev 49589)
+++ trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.pdf 2019-01-03 21:59:46 UTC (rev 49590)
Property changes on: trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.tex 2019-01-03 21:59:46 UTC (rev 49590)
@@ -0,0 +1,456 @@
+% !TEX encoding = UTF-8 Unicode
+% !TEX program = pdflatex
+%
+%% exercisepoints.tex
+%% Documentation for the exercisepoints package
+%%
+%% Copyright (c) 2017-2019 Henning Kerstan
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Henning Kerstan.
+%
+% This work consists of the files `exercisepoints.sty' and `exercisepoints.tex'.
+%
+
+
+% use KOMA article in twocolumn layout
+\documentclass[
+ twocolumn,%
+ fontsize=9pt,% this gives roughly 80 characters per line in twocolumns
+ DIV=calc,% calculate typearea
+ numbers=noendperiod% don't print periods at end of numbers
+]{scrartcl}
+
+
+% font selection & set up
+\usepackage{charter} % Charter as serif font (main text)
+\usepackage{biolinum} % Linux Biolinum as sans serif font (headings)
+\usepackage[scaled=0.85]{beramono} % Bera Mono as monospace font (code listings)
+\usepackage{eulervm} % Euler virtual math fonts
+\RequirePackage[T1]{fontenc} % T1 fontenc
+\usepackage[final]{microtype}
+\setkomafont{captionlabel}{\sffamily\small\bfseries}
+\setkomafont{caption}{\sffamily\small}
+\usepackage[english]{babel}
+
+
+% load the exercisepoints package
+\usepackage{exercisepoints}
+
+
+% load xcolor for colors in code listings
+\usepackage[dvipsnames]{xcolor}
+
+
+% set up code listings
+% - highlight standard LaTeX keywords in bold gray
+% - highlight exercisepoints keywords in bold navy blue
+\newcommand{\emphstyle}{\ttfamily\color{NavyBlue}\bfseries}%
+\newcommand{\keyword}[1]{{\emphstyle#1}}%
+\usepackage{listings}
+\lstset{%
+ language=[LaTeX]TeX,%
+ basicstyle=\small\ttfamily,%
+ keywordstyle=,%\color{black!70},%
+ keywords={equal},%
+ identifierstyle=,%
+ commentstyle=\itshape\color{OliveGreen},%
+ stringstyle=,%
+ showstringspaces=false,%
+ emphstyle=\emphstyle,%
+ breaklines=true,%
+ backgroundcolor=\color{black!5},%
+ numbers=none,
+ xleftmargin=1ex,
+ xrightmargin=1ex,
+ numberstyle=\small\ttfamily,
+ numbersep=1ex,
+ emph={%
+ exercisepoints,
+ AtBeginExercise,%
+ AtEndExercise,
+ AtBeginSubexercise,%
+ AtEndSubexercise,%
+ points,%
+ itempoints,%
+ totalpoints,%
+ numberofexercises,%
+ currentexercisetitle,%
+ currentexercisepoints,%
+ currentexercisenumber,%
+ exercise,%
+ currentsubexercisetitle,%
+ currentsubexercisepoints,%
+ currentsubexercisenumber,%
+ subexercise,%
+ bonuspoints,%
+ getbonuspoints,%
+ customlayout,%
+ totalpointswithbonus,%
+ setitempointsunit
+ }
+}
+
+
+% obtain package version using xstring package to obtain 17 leftmost characters in the internal package version string
+\makeatletter
+\usepackage{xstring}
+\newcommand{\packageversion}{\StrBefore[2]{\expandafter\csname ver at exercisepoints.sty\endcsname}{ }}
+\makeatother
+
+
+% use forloop package to automatically loop through all exercises
+\usepackage{forloop}
+
+
+% use gitinfo2 package for displaying git commit information in footer
+\usepackage[mark]{gitinfo2}
+
+
+% math examples
+\usepackage{amsmath,amssymb}
+
+
+% set up metadata
+\author{Henning Kerstan}
+\title{%
+ The exercisepoints Package\thanks{%
+ \url{https://github.com/henningkerstan/exercisepoints}%
+ }
+}
+\subtitle{\packageversion}
+\date{}
+
+
+% use enumitem package and set up enumerate/itemize layout
+\usepackage{enumitem}
+\setlist[itemize]{%
+ leftmargin=*,%
+ itemsep=5pt,%
+ topsep=5pt,%
+ parsep=0pt,%
+ partopsep=0pt,%
+ label=\textcolor{black}{$\triangleright$}%
+}%
+\setlist[enumerate]{%
+ leftmargin=*,%
+ itemsep=5pt,%
+ topsep=5pt,%
+ parsep=0pt,%
+ partopsep=0pt,%
+ label=\textcolor{black}{\arabic*.},%
+ ref=\arabic*%
+}%
+
+
+% use hyperref for hyperlinks
+\usepackage[
+ unicode=true,%
+ pdfa,%
+ colorlinks=false,%
+ linktoc=page,
+ pdfauthor={Henning Kerstan},
+ pdftitle={The exercisepoints Package}
+]{hyperref}
+
+
+% start of the actual document
+\begin{document}
+\maketitle
+\begin{abstract}
+\noindent\itshape The exercisepoints package provides an exercise environment and several macros to count points for exercises. The actual typesetting of an exercise can be defined by the user.
+\end{abstract}
+
+\section{Introduction and Basic Usage}
+This package can be used to facilitate exercise counting and exercise point counting in a \LaTeX-document. It counts the number of exercises (for example, it counted that this document has \emph{\numberofexercises\ exercises}) and it sums all the points of all exercises (for example, the package determined that the exercises in this document have a total of \emph{\totalpoints\ points}).
+
+Especially for exams it is also common to have an overview of all exercises and their maximal points. This is also supported by this package by providing a macro to retrieve the points of each exercise. For example, the exercise overview for this document is given in Figure~\ref{fig:exercise-overview} below.
+
+\newcounter{exercisenumber}
+\newcounter{exercisedisplaynumber}
+\setcounter{exercisedisplaynumber}{0}
+
+\begin{figure}[h]\centering
+ \begin{tabular}{l|p{1cm}|r}
+ \textbf{Exercise} & \textbf{Points} & \textbf{Max. Points}\\
+ \hline
+ \forloop{exercisenumber}{0}{\value{exercisenumber} < \numberofexercises}{%
+ \stepcounter{exercisedisplaynumber}%
+ \theexercisedisplaynumber && \getpoints{\theexercisenumber}\\%
+ }%
+ Sum && \totalpoints\\\hline%
+ Bonus && \getbonuspoints\\\hline%
+ Sum with Bonus && \totalpointswithbonus%
+ \end{tabular}
+ \label{fig:exercise-overview}
+ \caption{Overview of all exercises}
+\end{figure}
+
+\noindent This package only provides functionality for counting and adding points, the actual typesetting of the exercise can be entirely determined by the user.
+
+\subsection{Load the Package}
+To use this package type
+\begin{lstlisting}
+\usepackage{exercisepoints}
+\end{lstlisting}
+anywhere in your document's preamble. If this does not work because the package is not contained in your \LaTeX-distribution, simply copy the file `exercisepoints.sty' into the same folder as your document (or, if you plan to use it more often, copy it into your local texmf directory).
+
+\subsection{Typeset a First Exercise}
+Now you can typeset your first exercise using the following code.
+
+\begin{lstlisting}
+\begin{exercise}[Simple Addition]
+ What is 1+1?\points{2.5}
+\end{exercise}
+\end{lstlisting}
+
+\noindent If you typeset this without further modifications it will yield the following result.\vspace{1cm}
+
+\begin{exercise}[Simple Addition]
+ What is $1+1$?\points{2.5}
+\end{exercise}
+%
+As you can see, inside the code we used \textcolor{NavyBlue}{\ttfamily\bfseries \textbackslash points\{2.5\}} to assign this exercise a total of 2.5 points. These points were printed flushed right in the exercise header.
+
+\subsection{Play with the Points}
+If you issue the \textcolor{NavyBlue}{\ttfamily\bfseries \textbackslash points\{...\}} macro multiple times within an exercise environment, the points will add up. Thus let us consider the following code.
+
+\begin{lstlisting}
+\begin{exercise}[Simple Equation]
+ Determine a number $x$ such that $3 \cdot x = 15$\points{1.5} and explain how you did that.\points{3}
+\end{exercise}
+\end{lstlisting}
+
+\noindent This code will typeset as follows.
+
+\begin{exercise}[Simple Equation]
+ Determine a number $x$ such that $3 \cdot x = 15$\points{1.5} and explain how you did that.\points{3}
+\end{exercise}
+
+\noindent As expected, the points were added to obtain the total 1.5 + 3 = 4.5 points which again is printed in the exercise's header.
+
+This feature is especially handy if you have an exercise with several subparts (items). In this case you can also use the \textcolor{NavyBlue}{\ttfamily\bfseries \textbackslash itempoints\{...\}} macro which does the same as the \textcolor{NavyBlue}{\ttfamily\bfseries \textbackslash points\{...\}} macro but additionally also prints the supplied points flush right. We rewrite our previous exercise with an enumerate environment as follows.
+
+\begin{lstlisting}
+\begin{exercise}[Simple Equation]\vspace{-1.5em}
+ \begin{enumerate}
+ \item Determine $x$ such that $3 \cdot x = 15$.\itempoints{1.5}
+ \item Explain how you arrived at your solution in the previous part.\itempoints{3}
+ \end{enumerate}
+\end{exercise}
+\end{lstlisting}
+
+\noindent This code results in the following output.
+\begin{exercise}[Simple Equation]\vspace{-1.5em}
+ \begin{enumerate}
+ \item Determine $x$ such that $3 \cdot x = 15$.\itempoints{1.5}
+ \item Explain how you arrived at your solution in the previous part.\itempoints{3}
+ \end{enumerate}
+\end{exercise}
+
+Note that by default this only displays the number of points in parentheses. If you want to add a unit, you can use
+\begin{lstlisting}
+\setitempointsunit{pt}{pts}
+\end{lstlisting}
+anywhere in your document which sets \emph{pt} (singular form) and \emph{pts} (plural form) as units for the itempoints. Afterwards, all itempoints will display this unit right of the number.\setitempointsunit{pt}{pts}
+
+\noindent In fact, if we do this and assign the first part of the above exercise just one point instead of 1.5 (replacing \texttt{\textbackslash\keyword{itempoints}\{1.5\}} by \texttt{\textbackslash \keyword{itempoints}\{1\}}), it will be displayed as follows.
+\begin{exercise}[Simple Equation]\vspace{-1.5em}
+ \begin{enumerate}
+ \item Determine $x$ such that $3 \cdot x = 15$.\itempoints{1}
+ \item Explain how you arrived at your solution in the previous part.\itempoints{3}
+ \end{enumerate}
+\end{exercise}
+
+\subsection{Obtain the Total Points}
+If you have typeset your exercises, there are a few commands to obtain the total number of points.
+
+\begin{itemize}
+ \item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash numberofexercises} expands to the number of all exercises in the document.
+ \item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash totalpoints} expands to the sum of all points of all exercises in the document.
+ \item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash getpoints\{x\}} expands to the total points of the exercise number x (starting with $0$).
+\end{itemize}
+Note that the information for these macros is retrieved from the .aux file so to get the right numbers here, you have to compile your document twice. As a simple example for the above macros we take the following code.
+
+
+\begin{lstlisting}[emph={numberofexercises,totalpoints,getpoints}]
+Exercise 0 has \getpoints{0} points, there are \numberofexercises\ exercises with a total of \totalpoints\ points.
+\end{lstlisting}
+
+\noindent This compiles to the following sentence.\smallskip
+
+Exercise 0 has \getpoints{0} points, there are \numberofexercises\ exercises with a total of \totalpoints\ points.
+
+\subsection{Use Bonus Points}
+In some courses it is possible to obtain a bonus for the exam. This is supported by providing the commands
+\begin{lstlisting}
+\bonuspoints{x}
+\end{lstlisting}
+which will set the total amount of bonus points to $x$ bonuspoints (in this document we have used it with $x=10$\bonuspoints{10}) and
+\begin{lstlisting}
+\getbonuspoints
+\end{lstlisting}
+which retrieves the current bonus points (in this document it expands to \getbonuspoints). Please note that the {bonuspoint} command differs from the \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash points} and \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash itempoint} commands in two aspects:
+\begin{itemize}
+\item Bonus points are \emph{not additive}, i.e., if you use \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash bonuspoints} multiple times in your document, only the last occurence will set the bonus points.
+\item Bonus points are \emph{not} added to the total points. However, there is an additional macro
+\begin{lstlisting}
+\totalpointswithbonus
+\end{lstlisting}
+which will expand to the sum of \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash totalpoints} and \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash getbonuspoints}. In this document it thus expands to \totalpointswithbonus.
+\end{itemize}
+
+\subsection{Subexercises}
+If you have an exercise with many different parts (for example, if you have one overall topic with several areas), you can use the subexercise environment to structure your exercise. Subexercises work exactly as exercises, but can only be used within an exercise environment. The following is a compiled example of such an exercise.
+
+\begin{exercise}[Calculus]
+ \vspace{-1em}
+ \begin{subexercise}[Derivatives]
+ Determine the derivatives of the following functions.
+ \begin{enumerate}
+ \item $f\colon \mathbb{R} \to \mathbb{R}$, $f(x) = x^2+2x+3$ \itempoints{1}
+ \item $g\colon \mathbb{R} \to \mathbb{R}$, $g(x) = \exp(x^2)$ \itempoints{3}
+ \end{enumerate}
+ \end{subexercise}\vspace{-1em}
+ \begin{subexercise}[Maxima and Minima]
+ Determine the local maximum or minimum of the function $f\colon \mathbb{R} \to \mathbb{R}, f(x) = x^2+2x+3$.\points{3}
+ \end{subexercise}\vspace{-1em}
+\end{exercise}
+
+\noindent It was typeset using the following code.
+
+\begin{lstlisting}
+\begin{exercise}[Calculus]
+ \vspace{-1em}
+ \begin{subexercise}[Derivatives]
+ Determine the derivatives of the following functions.
+ \begin{enumerate}
+ \item $f\colon \mathbb{R} \to \mathbb{R}$,
+ $f(x) = x^2+2x+3$ \itempoints{1}
+ \item $g\colon \mathbb{R} \to \mathbb{R}$,
+ $g(x) = \exp(x^2)$ \itempoints{3}
+ \end{enumerate}
+ \end{subexercise}\vspace{-1em}
+ \begin{subexercise}[Maxima and Minima]
+ Determine the local maximum or minimum of the function
+ $f\colon \mathbb{R} \to \mathbb{R},
+ f(x) = x^2+2x+3$.\points{3}
+ \end{subexercise}
+\end{exercise}
+\end{lstlisting}
+
+\noindent Note that it is only possible to use the subexercise environment within an exercise environment and it is not possible to nest subexercise environments.
+
+\section{Exercise Layout}
+This package only provides a minimal layout style for an exercise which is \emph{not meant to be actually used}. It is just included to test the package functionality.
+
+\subsection{Disable the Built In Layout}
+If you define your own layout, you can load the package (but it is not necessary) with the \textcolor{NavyBlue}{\ttfamily\bfseries customlayout} option, i.e. by issuing the command
+\begin{lstlisting}
+\usepackage[customlayout]{exercisepoints}
+\end{lstlisting}
+which disables the built in exercise style. Note that in this case your document will only compile exercises or subexercises if you have defined the respective layout. Otherwise compilation will stop with a package error message.
+
+\subsection{Define Your Own Layout}
+In order to define how your exercise looks like, you can use the two commands listed below.
+\begin{lstlisting}
+\AtBeginExercise{%
+ % your code
+}
+
+\AtEndExercise{%
+ % your code
+}
+\end{lstlisting}
+For example, the minimal example style is implemented using the following code.
+\begin{lstlisting}
+\AtBeginExercise{%
+ ~\smallskip\\\sffamily%
+ \ifthenelse{\equal{\currentexercisetitle}{}}%
+ {\textbf{Exercise~\currentexercisenumber}}%
+ {%
+ \textbf{Exercise~\currentexercisenumber:} %
+ \currentexercisetitle%
+ }%
+ \,~\hfill\textbf{(\currentexercisepoints~Points)}%
+ \smallskip\\\noindent\normalfont%
+}
+\AtEndExercise{~\smallskip\\}%
+\end{lstlisting}
+As you can see, there are three useful macros that can be used for defining the exercise layout:
+\begin{itemize}
+ \item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentexercisetitle} expands to the exercise title supplied as (optional) argument to the exercise environment.
+ \item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentexercisenumber} expands to the current internal exercise number (starting at $0$).
+ \item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentexercisepoints} expands to the current exercise total points. Note that this is retrieved from the .aux file so to get the right number here, you have to compile your document twice.
+\end{itemize}
+
+\noindent For subexercises you have essentially the same commands, i.e., you have the commands
+\begin{itemize}
+\item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash AtBeginSubexercise\{...\}},
+\item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash AtEndSubexercise\{...\}},
+\item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentsubexercisenumber},
+\item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentsubexercisepoints} and
+\item \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentsubexercisetitle}
+\end{itemize}
+which work as their counterparts for exercises.
+
+\subsection{Example Layout Using (Sub-)Sections}
+One option for a custom layout could be to use sections for exercises and subsections for subexercises. This can be achieved using the following code.
+
+\begin{lstlisting}
+\usepackage[customlayout]{exercisepoints}
+\AtBeginExercise{%
+ \section{\texorpdfstring{%
+ \currentexercisetitle\hfill%
+ (\currentexercisepoints~Points)}{%
+ \currentexercisetitle (\currentexercisepoints~Points)}%
+ }
+}
+\AtEndExercise{\clearpage}
+\AtBeginSubexercise{%
+ \subsection{\texorpdfstring{%
+ \currentsubexercisetitle\hfill%
+ (\currentsubexercisepoints~Points)}{%
+ \currentsubexercisetitle %
+ (\currentsubexercisepoints~Points)}%
+ }
+}
+\AtEndSubexercise{}
+\end{lstlisting}
+
+\section{Copyright and License}
+Copyright \copyright\ 2017--2019 Henning Kerstan.\medskip
+
+\noindent This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version. The latest version of this license is in\medskip
+
+ \url{http://www.latex-project.org/lppl.txt}\medskip
+
+\noindent and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.\medskip
+
+\noindent This work has the LPPL maintenance status `maintained'.\medskip
+
+\noindent The Current Maintainer of this work is Henning Kerstan.\medskip
+
+\noindent This work consists of the files `exercisepoints.sty' and `exercisepoints.tex'.
+
+
+\section{Version History}
+\begin{description}
+\item[\packageversion] Revised README.md.
+\item[2019/01/02 v1.2.2] Slight revision of documentation.
+\item[2018/08/15 v1.2.1] Renamed the package from \emph{hkexercise} to \emph{exercisepoints} to comply with CTAN rules (see \url{https://ctan.org/file/help/ctan/CTAN-upload-addendum})
+\item[2017/02/27 v1.2.0] Added the \texttt{\textbackslash\keyword{setitempointsunit}\{...\}} command.
+\item[2017/07/02 v1.1.0] This version introduces subexercises. Moreover several checks were added to avoid use of commands like \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentexercisepoints} outside of exercise environments and to prevent nesting of exercises. New option \textcolor{NavyBlue}{\ttfamily\bfseries customlayout} disables built in exercise layout. Added \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash bonuspoint} commands.
+\item[2017/06/26 v1.0.1] Redefined \textcolor{NavyBlue}{\ttfamily\bfseries\textbackslash currentexercisepoints} so it can be used within section command.
+\item[2017/06/26 v1.0] The initial version of this package is published on GitHub.
+\end{description}
+\end{document}
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/exercisepoints/exercisepoints.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/exercisepoints/exercisepoints.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/exercisepoints/exercisepoints.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/exercisepoints/exercisepoints.sty 2019-01-03 21:59:46 UTC (rev 49590)
@@ -0,0 +1,330 @@
+% !TEX encoding = UTF-8 Unicode
+%
+%% exercisepoints.sty
+%% A LaTeX package to count exercises and points.
+%%
+%% Copyright (c) 2017-2019 Henning Kerstan.
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Henning Kerstan.
+%
+% This work consists of the files `exercisepoints.sty' and `exercisepoints.tex'.
+%
+
+
+% package identification
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{exercisepoints}[%
+ 2019/01/03 v1.2.3 %
+ count exercises and points%
+]
+
+
+% switches for custom exercise layout
+\newif\if at exercisepoints@usecustomlayout%
+\newif\if at exercisepoints@exercise at layoutdefined%
+\newif\if at exercisepoints@subexercise at layoutdefined%
+
+\DeclareOption{customlayout}{%
+ \@exercisepoints at usecustomlayouttrue%
+}
+
+% this package does not have any other options
+\DeclareOption*{
+ \PackageWarning{exercisepoints}{Unknown option '\CurrentOption'}
+}
+\ProcessOptions\relax%
+
+
+% avoid nesting (i.e. putting exercises in exercises)
+\newif\if at exercisepoints@inexercise%
+\global\@exercisepoints at inexercisefalse%
+\newif\if at exercisepoints@insubexercise%
+\global\@exercisepoints at insubexercisefalse%
+
+
+% counters to store number of exercises
+\newcounter{exercisepoints at exercisecount}
+\newcounter{exercisepoints at subexercisecount}[exercisepoints at exercisecount]
+
+
+% lengths to store points
+\newlength{\exercisepoints at currentexercisepoints}
+\newlength{\exercisepoints at currentsubexercisepoints}
+\newlength{\exercisepoints at totalpoints}
+\newlength{\exercisepoints at bonuspoints}
+
+
+% macros to get total points and total number of exercises (whole document)
+\providecommand{\totalpoints}{0}
+\providecommand{\numberofexercises}{0}
+
+
+% macros to get info about current exercise(-part)
+% (to be used in AtBeginExercise or AtEndExercise hooks)
+\providecommand{\currentexercisetitle}{}
+\providecommand{\currentsubexercisetitle}{}
+
+\providecommand{\currentexercisepoints}{%
+ \if at exercisepoints@inexercise\else%
+ \PackageError{exercisepoints}{'\string\currentexercisepoints' can only be used in exercise or subexercise environment}%
+ \fi%
+ %
+ \ifcsname exercisepoints at points@\currentexercisenumber\endcsname%
+ \@nameuse{exercisepoints at points@\currentexercisenumber}%
+ \else%
+ \textbf{??}% TODO:issue package warning in such a way that it can be used also in section commands
+ \fi%
+}
+
+\providecommand{\currentsubexercisepoints}{%
+ \if at exercisepoints@insubexercise\else%
+ \PackageError{exercisepoints}{'\string\currentsubexercisepoints' can only be used in subexercise environment}%
+ \fi%
+ %
+ \ifcsname exercisepoints at points@\currentexercisenumber.\currentsubexercisenumber\endcsname%
+ \@nameuse{exercisepoints at points@\currentexercisenumber.\currentsubexercisenumber}%
+ \else%
+ \textbf{??}% TODO:issue package warning in such a way that it can be used also in section commands
+ \fi%
+}
+
+\providecommand{\currentexercisenumber}{%
+ \theexercisepoints at exercisecount%
+}
+
+\providecommand{\currentsubexercisenumber}{%
+ \theexercisepoints at subexercisecount%
+}
+
+
+% hooks to modify the exercise typesetting
+\providecommand{\AtBeginExercise}[1]{
+ \renewcommand{\exercisepoints at begin}{#1}%
+ \@exercisepoints at exercise@layoutdefinedtrue%
+}
+
+\providecommand{\AtEndExercise}[1]{
+ \renewcommand{\exercisepoints at end}{#1}
+}
+
+% the same for subexercises
+\providecommand{\AtBeginSubexercise}[1]{
+ \renewcommand{\exercisepoints at sub@begin}{#1}
+ \@exercisepoints at subexercise@layoutdefinedtrue%
+}
+
+\providecommand{\AtEndSubexercise}[1]{
+ \renewcommand{\exercisepoints at sub@end}{#1}
+}
+
+
+% storage for the hooks
+\newcommand{\exercisepoints at begin}{}
+\newcommand{\exercisepoints at end}{}
+\newcommand{\exercisepoints at sub@begin}{}
+\newcommand{\exercisepoints at sub@end}{}
+
+
+% a very simple default exercise style
+\if at exercisepoints@usecustomlayout\else%
+ \RequirePackage{ifthen}%
+ \AtBeginExercise{%
+ ~\smallskip\\\sffamily%
+ \ifthenelse{\equal{\currentexercisetitle}{}}%
+ {\textbf{Exercise~\currentexercisenumber}} % empty title
+ {%
+ \textbf{Exercise~\currentexercisenumber:} %
+ \currentexercisetitle%
+ }% non-empty title
+ \,~\hfill\textbf{(\currentexercisepoints~Points)}%
+ \smallskip\\\noindent\normalfont%
+ }
+ \AtEndExercise{~\smallskip\\}
+ %
+ \AtBeginSubexercise{%
+ ~\smallskip\\\sffamily%
+ \ifthenelse{\equal{\currentsubexercisetitle}{}}%
+ {\emph{Exercise~\currentexercisenumber.\currentsubexercisenumber}} % empty title
+ {%
+ \emph{Exercise~\currentexercisenumber.\currentsubexercisenumber:} %
+ \emph{\currentsubexercisetitle}%
+ }% non-empty title
+ \,~\hfill\emph{(\currentsubexercisepoints~Points)}%
+ \smallskip\\\noindent\normalfont%
+ }
+ \AtEndSubexercise{~\\}
+\fi
+
+
+% points commands sets points (additive within an exercise environment)
+\newcommand{\points}[1]{%
+ \if at exercisepoints@inexercise%
+ \addtolength{\exercisepoints at currentexercisepoints}{#1 pt}%
+ \global\exercisepoints at currentexercisepoints=\exercisepoints at currentexercisepoints%
+ \addtolength{\exercisepoints at totalpoints}{#1 pt}%
+ \global\exercisepoints at totalpoints=\exercisepoints at totalpoints%
+ \if at exercisepoints@insubexercise%
+ \addtolength{\exercisepoints at currentsubexercisepoints}{#1 pt}%
+ \global\exercisepoints at currentsubexercisepoints=\exercisepoints at currentsubexercisepoints%
+ \fi%
+ \else%
+ \PackageError{exercisepoints}{\string\points{...} can only be used within exercise or subexercise environment.}%
+ \fi%
+}
+
+% itempoints units
+\newcommand{\exercisepoints at itempointsunit@singular}{}
+\newcommand{\exercisepoints at itempointsunit@plural}{}
+\newcommand{\setitempointsunit}[2]{% singular, plural
+ \renewcommand{\exercisepoints at itempointsunit@singular}{#1}%
+ \renewcommand{\exercisepoints at itempointsunit@plural}{#2}%
+}
+
+% itempoints calls points and displays points flush right for use in
+% enumerate environments
+\RequirePackage{ifthen}
+\newcommand{\itempoints}[1]{%
+ \points{#1}%
+ % check if exactly 1 points
+ \ifthenelse{\equal{#1}{1}}{% not robust, so issuing 1.0 will not result in correct (singular) form!
+ \ifthenelse{\equal{\exercisepoints at itempointsunit@singular}{}}{%
+ \,~\hfill(#1)%
+ }{%
+ \,~\hfill(#1~\exercisepoints at itempointsunit@singular)%
+ }%
+ }{%
+ \ifthenelse{\equal{\exercisepoints at itempointsunit@plural}{}}{%
+ \,~\hfill(#1)%
+ }{%
+ \,~\hfill(#1~\exercisepoints at itempointsunit@plural)%
+ }%
+ }%
+}
+
+
+
+
+% getpoints retrieves points for a specific exercise number (starting at 0)
+\newcommand{\getpoints}[1]{%
+ \ifthenelse{#1 < \numberofexercises}%
+ {\exercisepoints at readfromaux{points@#1}}%
+ {\textbf{??}}%
+}
+
+
+% aux storage function (key-value store using #1 as key and #2 as value)
+\newcommand{\exercisepoints at storetoaux}[2]{%
+ \immediate\write\@auxout{%
+ \string\global\string\long\string\@namedef{exercisepoints@#1}{#2}%
+ }%
+}
+
+
+% aux retrieval
+\newcommand{\exercisepoints at readfromaux}[1]{%
+ \ifcsname exercisepoints@#1\endcsname%
+ \@nameuse{exercisepoints@#1}%
+ \else%
+ \textbf{??}%
+ \PackageWarning{exercisepoints}{%
+ Key 'exercisepoints@#1' not found in aux file. Maybe you need to recompile?%
+ }%
+ \fi%
+}
+
+
+% exercise environment; optional parameter is title of the respective exercise
+\newenvironment{exercise}[1][]{%
+ \if at exercisepoints@inexercise%
+ \PackageError{exercisepoints}{You cannot nest exercise environments}%
+ \fi
+ %
+ \if at exercisepoints@exercise at layoutdefined\else%
+ \PackageError{exercisepoints}{Option `customlayout' requires you to define an exercise layout using at least `\string\AtBeginExercise{...}'}
+ \fi
+ %
+ \global\@exercisepoints at inexercisetrue%
+ \setlength{\exercisepoints at currentexercisepoints}{0pt}%
+ \global\exercisepoints at currentexercisepoints=\exercisepoints at currentexercisepoints%
+ \renewcommand{\currentexercisetitle}{#1}%
+ \exercisepoints at begin%
+}{%
+ \exercisepoints at end%
+ \exercisepoints at storetoaux{points@\theexercisepoints at exercisecount}{\strip at pt\exercisepoints at currentexercisepoints}%
+ \stepcounter{exercisepoints at exercisecount}%
+ \global\@exercisepoints at inexercisefalse%
+}
+
+
+% exercise environment; optional parameter is title of the respective exercise
+\newenvironment{subexercise}[1][]{%
+ \if at exercisepoints@insubexercise%
+ \PackageError{exercisepoints}{You cannot nest subexercise environments}%
+ \fi%
+ %
+ \if at exercisepoints@subexercise at layoutdefined\else%
+ \PackageError{exercisepoints}{Option `customlayout' requires you to define a subexercise layout using at least `\string\AtBeginSubexercise{...}'}
+ \fi%
+ \global\@exercisepoints at insubexercisetrue%
+ \setlength{\exercisepoints at currentsubexercisepoints}{0pt}%
+ \global\exercisepoints at currentsubexercisepoints=\exercisepoints at currentsubexercisepoints%
+ \renewcommand{\currentsubexercisetitle}{#1}%
+ \exercisepoints at sub@begin%
+}{%
+ \exercisepoints at sub@end%
+ \exercisepoints at storetoaux{points@\theexercisepoints at exercisecount.\theexercisepoints at subexercisecount}{\strip at pt\exercisepoints at currentsubexercisepoints}%
+ \stepcounter{exercisepoints at subexercisecount}%
+ \global\@exercisepoints at insubexercisefalse%
+}
+
+
+\newcommand{\bonuspoints}[1]{%
+ \setlength{\exercisepoints at bonuspoints}{#1 pt}%
+ \global\exercisepoints at bonuspoints=\exercisepoints at bonuspoints%
+}
+
+\newcommand{\getbonuspoints}{%
+ \exercisepoints at readfromaux{points at bonus}%
+}
+
+\newcommand{\totalpointswithbonus}{%
+ \readfromaux{totalpointswithbonus}%
+}
+
+
+% read values from aux file at begin
+\AtBeginDocument{
+ \setlength{\exercisepoints at totalpoints}{0pt}% reset total points length
+ %
+ % set numberofexercises to 0 if not found in aux
+ \ifcsname exercisepoints at numberofexercises\endcsname%
+ \renewcommand{\numberofexercises}{%
+ \exercisepoints at readfromaux{numberofexercises}%
+ }%
+ \fi%
+ %
+ \renewcommand{\totalpoints}{\exercisepoints at readfromaux{points at total}}%
+ \renewcommand{\totalpointswithbonus}{\exercisepoints at readfromaux{points at totalwithbonus}}%
+}
+
+
+% store values in aux file at end
+\AtEndDocument{
+ \exercisepoints at storetoaux{numberofexercises}{\theexercisepoints at exercisecount}%
+ \exercisepoints at storetoaux{points at total}{\strip at pt\exercisepoints at totalpoints}%
+ \exercisepoints at storetoaux{points at bonus}{\strip at pt\exercisepoints at bonuspoints}%
+ \newlength{\exercisepoints at totalpointswithbonus}%
+ \setlength{\exercisepoints at totalpointswithbonus}{\exercisepoints at totalpoints}%
+ \addtolength{\exercisepoints at totalpointswithbonus}{\exercisepoints at bonuspoints}%
+ \exercisepoints at storetoaux{points at totalwithbonus}{\strip at pt\exercisepoints at totalpointswithbonus}%
+}
Property changes on: trunk/Master/texmf-dist/tex/latex/exercisepoints/exercisepoints.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2019-01-03 21:58:47 UTC (rev 49589)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2019-01-03 21:59:46 UTC (rev 49590)
@@ -262,7 +262,8 @@
euler eulerpx eulervm euro euro-ce europasscv europecv eurosym
everyhook everypage
exam exam-n examdesign example examplep
- exceltex excludeonly exercise exercisebank exercises exp-testopt
+ exceltex excludeonly exercise exercisebank exercisepoints exercises
+ exp-testopt
expdlist expex export expressg exsheets exsol extarrows exteps
extpfeil extract extsizes
facsimile factura facture facture-belge-simple-sans-tva faktor
Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc 2019-01-03 21:58:47 UTC (rev 49589)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc 2019-01-03 21:59:46 UTC (rev 49590)
@@ -390,6 +390,7 @@
depend excludeonly
depend exercise
depend exercisebank
+depend exercisepoints
depend exercises
depend exp-testopt
depend expdlist
Added: trunk/Master/tlpkg/tlpsrc/exercisepoints.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list