From 0e871146bcb1bf041dac127d5b76011aa31e28aa Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Jul 2014 22:05:15 +0000 Subject: exsheets (20jul14) git-svn-id: svn://tug.org/texlive/trunk@34665 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/exsheets/README | 12 +- .../doc/latex/exsheets/cntformats_en.pdf | Bin 416305 -> 0 bytes .../doc/latex/exsheets/cntformats_en.tex | 310 ----------- .../texmf-dist/doc/latex/exsheets/exsheets_en.pdf | Bin 675963 -> 672736 bytes .../texmf-dist/doc/latex/exsheets/exsheets_en.tex | 150 ++--- Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf | Bin 444774 -> 0 bytes Master/texmf-dist/doc/latex/exsheets/tasks_en.tex | 460 ---------------- .../texmf-dist/tex/latex/exsheets/cntformats.sty | 349 ------------ Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 585 ++++++++++---------- .../tex/latex/exsheets/exsheets_headings.cfg | 2 + .../tex/latex/exsheets/exsheets_headings.def | 4 +- Master/texmf-dist/tex/latex/exsheets/tasks.cfg | 55 -- Master/texmf-dist/tex/latex/exsheets/tasks.sty | 601 --------------------- 13 files changed, 395 insertions(+), 2133 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf delete mode 100644 Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex delete mode 100644 Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf delete mode 100644 Master/texmf-dist/doc/latex/exsheets/tasks_en.tex delete mode 100644 Master/texmf-dist/tex/latex/exsheets/cntformats.sty delete mode 100644 Master/texmf-dist/tex/latex/exsheets/tasks.cfg delete mode 100644 Master/texmf-dist/tex/latex/exsheets/tasks.sty (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README index b1408ac5818..3bbc7723442 100644 --- a/Master/texmf-dist/doc/latex/exsheets/README +++ b/Master/texmf-dist/doc/latex/exsheets/README @@ -1,14 +1,10 @@ -------------------------------------------------------------------------- -EXSHEETS 2014/06/27 +EXSHEETS 2014/07/20 bundled packages: -the EXSHEETS package v0.14 +the EXSHEETS package v0.15 Yet another package for the creation of exercise sheets the EXSHEETS-LISTINGS package v0.2 Using listings in exsheets -the CNTFORMATS package v0.6 - A different way to read counters. -the TASKS package v0.9c - Horizontal columned lists. -------------------------------------------------------------------------- Clemens Niederberger @@ -35,10 +31,6 @@ The exsheets bundle consists of the files exsheets_configurations.cfg, exsheets_en.tex, exsheets_en.pdf - - tasks.sty, tasks.cfg, tasks_en.tex, task_en.pdf - - - cntformats.sty, cntformats_en.tex, cntformats_en.pdf - - README -------------------------------------------------------------------------- If you have any ideas, questions, suggestions or bugs to report, please diff --git a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf deleted file mode 100644 index 8cf3a16ec5d..00000000000 Binary files a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex deleted file mode 100644 index 261b9bdb6d3..00000000000 --- a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex +++ /dev/null @@ -1,310 +0,0 @@ -% arara: pdflatex -% !arara: biber -% !arara: pdflatex -% arara: pdflatex -% -------------------------------------------------------------------------- -% the CNTFORMATS package -% -% A different way to read counters -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2014 Clemens Niederberger -% -% 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 Clemens Niederberger. -% -------------------------------------------------------------------------- -% The translations package is part of the exsheets bundle -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\documentclass[load-preamble+]{cnltx-doc} -\usepackage{cntformats} - -\setcnltx{ - package = {cntformats} , - authors = Clemens Niederberger , - email = {contact@mychemistry.eu} , - url = {https://bitbucket.org/cgnieder/exsheets/} , - info = {% - {\small part of the \href{exsheets_en.pdf}{\ExSheets} - bundle}\\[\baselineskip] - a different way to read counters% - } , - add-cmds = { - @cntfmts@parsed@pattern, AddCounterPattern, - eSaveCounterPattern, - NewCounterPattern, NewPatternFormat, - ReadCounterFrom, ReadCounterPattern, ReadCounterPatternFrom, - SaveCounterPattern - } , - add-silent-cmds = { - alphalph, - cs, - ExplSyntaxOff, ExplSyntaxOn, - int, - myoddnumber, - numexpr, ordinalnum, - relax, - somesetupcommand, - tmpa, tmpb, the - } -} - -\defbibheading{bibliography}[\bibname]{\addsec{#1}} - -\newpackagename\ExSheets{ExSheets} -\def\at{\cnltxat} - -\usepackage[biblatex]{embrac}[2012/06/29] - \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] - \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] - -\usepackage{booktabs,array,ragged2e} -\usepackage{subcaption} - -% ---------------------------------------------------------------------------- -% example definitions that have to be done in the preamble: -\usepackage{alphalph} -\NewPatternFormat{aa}{\alphalph} -\usepackage{fmtcount} -\NewPatternFormat{o}{\ordinalnum} -\newcommand*\myoddnumber[1]{\the\numexpr2*(#1)-1\relax} -\NewPatternFormat{x}{\myoddnumber} -\NewCounterPattern{testa}{ta} - -\begin{document} - -\section{Motivation} -\cntformats\ provides a way to format counters with what I will call patterns. -This does not in any way effect the usual \LaTeXe\ way of treating counters -and does not use \cs*{the\meta{counter}} nor is it affected by the redefinition of -them. - -This package is aimed at package or class authors and probably not very useful -for document authors. - -When I first had the idea for this package the idea of what it does already -existed as part of the \ExSheets\ package. I can't recall why I came up with -the idea in the first place or why I originally wanted a new syntax for -formatting the \code{question} counter. I am also not convinced any more that -it is a good idea. Anyway, here we are. - -\section{License and Requirements}\label{sec:license} -\license - -\cntformats\ requires the \needpackage{etoolbox} package~\cite{pkg:etoolbox} -and the \pkg*{cnltx-base}\footnote{\CTANurl{cnltx}} package~\cite{bnd:cnltx}. - -\section{Example} -A use case typically looks as follows: -\begin{example}[side-by-side] - \ReadCounterPattern{se.sse} -\end{example} -where the key \code{se} stands for the current value of the \code{section} -counter and \code{sse} for \code{subsection}, respectively. \code{se.sse} is -an example for what will be called \emph{pattern}. The keys for the counters -can have optional arguments that specify the format: -\begin{example}[side-by-side] - \stepcounter{subsection} - \ReadCounterPattern{se[A](sse[r])} -\end{example} -\code{A} stands for \cs*{Alph} and \code{r} for \cs*{roman}. A complete list -can be found in table~\ref{tab:predefined:formats} on -page~\pageref{tab:predefined:formats}. As you can see you can insert -arbitrary other tokens in a pattern that won't be changed. It is important to -notice, though, that the patterns are only replaced if they're \emph{not} -placed in a braced group! - -\begin{example}[side-by-side] - \ReadCounterPattern{{se[A](sse[r])}} -\end{example} - -I would imagine that the argument to \cs{ReadCounterPattern} is usually -supplied by a user setting an option \ldots -\begin{sourcecode} - \somesetupcommand{ - counter-format = se[A](sse[r]) - } -\end{sourcecode} -\ldots{} and then internally used by the corresponding package or class. - - -\section{Usage} -In the following description of the available commands the symbol -\textcolor{expandable}{\expandablesign} means that the command is expandable. - -In order to make counters known to \cntformats\ the following commands are used: -\begin{commands} - \command{AddCounterPattern}[\sarg\oarg{module}\marg{counter}\marg{pattern}] - This command will make the (existing) counter \meta{counter} known to - \cntformats\ and assign the pattern \meta{pattern} to it. - \command{NewCounterPattern}[\sarg\oarg{module}\marg{counter}\marg{pattern}] - This command will create a new counter \meta{counter}, make it known to - \cntformats\ and assign the pattern \meta{pattern} to it. - \command{ReadCounterFrom}[\oarg{module}\marg{counter}\marg{internal cmd}] - If you use one of the commands above with the starred version the number - for the pattern is not automatically fetched from the internal - \cs*{c@\meta{counter}}. This can now be assigned with - \cs{ReadCounterFrom} where \meta{internal cmd} is the macro that holds - the number. -\end{commands} -The commands above can only be used in the document preamble. - -After the creation of these pattern markers one wants to be able to use them. -There are a number of macros that allow different aspects of usage. -\begin{commands} - \command{ReadCounterPattern}[\oarg{module}\marg{pattern}] - Reads, interprets and prints a pattern. - \expandable\command{\at cntfmts\at parsed\at pattern} - After \cs{ReadCounterPattern} has been used the current pattern - interpretation is stored in this macro. The \emph{interpretation} is - \emph{not} what is printed. See the examples below for details. - \command{ReadCounterPatternFrom}[\oarg{module}\marg{macro that holds - pattern}] - Reads, interprets and prints a pattern that's stored in a macro.\\ - Otherwise the same as \cs{ReadCounterPattern}. - \command{SaveCounterPattern}[\marg{cmd a}\marg{cmd b}\marg{pattern}] - Saves the \meta{pattern} in \meta{cmd a} and the interpreted pattern in - \meta{cmd b}. - \command{eSaveCounterPattern}[\oarg{module}\marg{cmd a}\marg{cmd - b}\marg{pattern}] - Saves the \meta{pattern} in \meta{cmd a} and the expanded pattern in - \meta{cmd b}. - \command{SaveCounterPatternFrom}[\oarg{module}\marg{cmd a}\marg{cmd - b}\marg{macro that holds pattern}] - Like \cs{SaveCounterPattern} but reads the pattern from a macro. - \command{eSaveCounterPatternFrom}[\oarg{module}\marg{cmd a}\marg{cmd - b}\marg{macro that holds pattern}] - Like \cs{eSaveCounterPattern} but reads the pattern from a macro. -\end{commands} - -The optional argument \meta{module} should be specific for a package, say, so -that different patterns for the \code{section} for example don't interfer with -each other. If you leave the argument the default module \code{cntfmts} is -used. - -The \ExSheets\ packages uses the commands with the module \code{exsheets}. -You can find the following lines in \ExSheets' code: -\begin{sourcecode} - \AddCounterPattern*[exsheets]{section}{se} - \ReadCounterFrom[exsheets]{section} \l__exsheets_counter_sec_int - \NewCounterPattern*[exsheets]{question}{qu} - \ReadCounterFrom[exsheets]{question} \l__exsheets_counter_qu_int -\end{sourcecode} - -Now let's see a short example that hopefully explains what the macros do: -\begin{example} - % preamble - % \NewCounterPattern{testa}{ta} - \setcounter{testa}{11} - \ReadCounterPattern{ta} - \ReadCounterPattern{ta[a]} \\ - \ttfamily\makeatletter - \meaning\@cntfmts@parsed@pattern - - \bigskip - \SaveCounterPattern\tmpa\tmpb{ta[a]} - \meaning\tmpa \\ - \meaning\tmpb - - \bigskip - \eSaveCounterPattern\tmpa\tmpb{ta[a]} - \meaning\tmpa \\ - \meaning\tmpb -\end{example} -You can see that somehow an additional \cs*{@empty} found its way into the -interpreted pattern. This is due to the fact that reading optional arguments -expandably isn't easy and must have some safety net. - -\section{Predefined and New Patterns and Format Keys} -\subsection{Predefined Patterns and Format Keys} -\cntformats\ predefines a number of pattern keys. These are listed in -table~\ref{tab:predefined:patterns}. - -\subsection{New Patterns and Format Keys} -Table~\ref{tab:predefined:formats} lists the predefined formats. If you want -you can add own formats. -\begin{commands} - \command{NewPatternFormat}[\marg{pattern}\marg{format}] - \meta{format} is a number presentation command like \cs*{@alph}, \ie, - it needs a mandatory argument that takes a number. It is used in - \meta{format} \emph{without} its argument. This command can only be used - in the preamble. -\end{commands} - -\begin{table} - \centering - \caption{Predefined Patterns and Format Keys.} - \addtocounter{table}{-1}% necessary fix for subcaption and KOMA - \begin{minipage}{.48\linewidth} - \centering - \subcaption{Predefined Patterns for the module \code{cntfmts}.} - \label{tab:predefined:patterns} - \begin{tabular}{>{\ttfamily}l>{\ttfamily}l} - \toprule - \normalfont\bfseries counter & \normalfont\bfseries pattern \\ - \midrule - chapter & ch \\ - section & se \\ - subsection & sse \\ - subsubsection & ssse \\ - paragraph & pg \\ - \bottomrule - \end{tabular} - \end{minipage} - \begin{minipage}{.48\linewidth} - \centering - \subcaption{Predefined Format Keys} - \label{tab:predefined:formats} - \begin{tabular}{>{\ttfamily}ll} - \toprule - \normalfont\bfseries key & \normalfont\bfseries format \\ - \midrule - 1 & \cs*{arabic} \\ - a & \cs*{alph} \\ - A & \cs*{Alph} \\ - r & \cs*{roman} \\ - R & \cs*{Roman} \\ - \bottomrule - \end{tabular} - \end{minipage} -\end{table} - -Here are now a few examples of possible new patterns. Suppose the following code -in the preamble: -\begin{sourcecode} - \usepackage{alphalph,fmtcount} - \newcommand*\myoddnumber[1]{\the\numexpr2*(#1)-1\relax} - - \NewPatternFormat{aa}{\alphalph} - \NewPatternFormat{o}{\ordinalnum} - \NewPatternFormat{x}{\myoddnumber} - - \newcounter{testa} - \NewCounterPattern{testa}{ta} - \setcounter{testa}{4} -\end{sourcecode} - -Then we can use the new pattern and the new formats as -follows:\setcounter{testa}{4} -\begin{example} - \ReadCounterPattern{ta[aa]} - \ReadCounterPattern{ta[o]} - \ReadCounterPattern{ta[x]} -\end{example} - -\end{document} diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf index 191ab5488e5..e0d18574c53 100644 Binary files a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf and b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf differ diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex index a96d6c2584c..728d373118f 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex @@ -1,8 +1,8 @@ % arara: pdflatex % !arara: biber +% arara: pdflatex % !arara: pdflatex % !arara: pdflatex -% arara: pdflatex % -------------------------------------------------------------------------- % the EXSHEETS package % @@ -31,7 +31,7 @@ % feel free to contact me. % -------------------------------------------------------------------------- \documentclass[load-preamble+,scrartcl={DIV10}]{cnltx-doc} -\usepackage[load-headings,load-tasks]{exsheets} +\usepackage{exsheets} \setcnltx{ package = {exsheets} , authors = Clemens Niederberger , @@ -39,8 +39,7 @@ url = {https://bitbucket.org/cgnieder/exsheets/} , title = the \ExSheets\ bundle , info = {% - the packages \ExSheets, \ExSheetslistings, \href{tasks_en.pdf}{\Tasks} and - \href{cntformats_en.pdf}{\cntformats}\\ + the packages \ExSheets{} and \ExSheetslistings \\ \emph{or}\\ Yet another package for the creation of exercise sheets and exams.% } , @@ -75,6 +74,7 @@ GetQuestionProperty, grade, includequestions,iflastquestion, + IfQuestionPropertyF,IfQuestionPropertyT,IfQuestionPropertyTF, IfQuestionSubtitleF,IfQuestionSubtitleT,IfQuestionSubtitleTF, lastvariant, NewQuSolPair,NewLstQuSolPair, @@ -133,8 +133,6 @@ \usepackage{exsheets-listings} \edef\exsheetslistingsverion{v\csname exsheets@listings@version\endcsname} -\edef\cntfmtsversion{\csname @cntfmts@version\endcsname} -\edef\tasksversion{v\csname @tasks@version\endcsname} \microtypesetup{tracking=scshape} @@ -282,18 +280,14 @@ in section~\ref{sec:additional_info}. Then there is --~at least in Germany~-- the habit of having lists of exercises aligned in columns but counting from the left to the right instead from up to -down. \ExSheets\ provides a possibility for that (see the \Tasks\ package). -I am not quite content with it as it works now, though\footnote{There are - still other possibilities, for example take a look here: - \url{http://tex.stackexchange.com/questions/67966/enumerate-in-multicols} or - at the \pkg{multienum} package~\cite{pkg:multienum}.}. - -On the other hand \ExSheets\ doesn't --~and probably won't~-- offer a real -possibility for creating multiple choice questions. As a fact it doesn't -provide many (if any) means to specify the \emph{type} of question or the -structure. If these are your needs take a look at -\pkg{examdesign}~\cite{pkg:examdesign}, for example. Or exploit the -possibilities \pkg{enumitem}~\cite{pkg:enumitem} gives you. +down. That's why the \pkg{tasks} package was developed as part of \ExSheets{} +and was ditrsibuted as part of the bundle\changedversion{0.15}. Now it is a +package of its own but is loaded by \ExSheets{} automatically with the +necessary setup to make them work together nicely. + +\ExSheets{} has no native support for multiple choice tests but that doesn't +mean that you can't create them with \ExSheets. It just means that they may +be a bit more work with \ExSheets{} than with other packages. I had the idea for this package in 2008. Back then my \TeX{} skills were by far not good enough to write it. Actually, even today I wouldn't have been @@ -304,21 +298,17 @@ wider usage. At the time of writing (\today) there still are probably lots of rough edges let alone bugs so I am very interested in all kinds of feedback. \section{Additional Packages} -\ExSheets\ actually bundles four packages: \ExSheets, \ExSheetslistings\ -\Tasks\ and \cntformats. \ExSheetslistings\ is an add-on to \ExSheets\ -that offers some functionality to use \pkg{listings} with \ExSheets. It is -presented in part~\ref{part:listings}. - -The \Tasks\ package and the \cntformats\ package have their own -documentation. These packages provide functionality that is used by -\ExSheets. They can, however, be used independently from \ExSheets. - -The package \cntformats\ is probably not really useful on a user-level but -maybe for package writers. +\ExSheets\ actually bundles two packages: \ExSheets, \ExSheetslistings. +\ExSheetslistings\ is an add-on to \ExSheets\ that offers some functionality +to use \pkg{listings} with \ExSheets. It is presented in +part~\ref{part:listings}. \ExSheets\ used to bundle the \pkg{translations} package, too\changedversion{0.9i}, but doesn't any more. You can find the -\pkg{translations} package as a package of it's own on the \ac{ctan}. +\pkg{translations} package as a package of it's own on the \ac{ctan}. It also +used to bundle the packages \pkg{tasks} and +\pkg{cntformats}\changedversion{0.15}. They're available now as packages of +their own as well. \section{Installation and Documentation} If you install \ExSheets\ manually beware to put the files @@ -327,26 +317,23 @@ If you install \ExSheets\ manually beware to put the files \item[]\verb+exsheets_headings.cfg+ \end{itemize} in the same directory as the \code{exsheets.sty} file\footnote{That is, a - directory like \code{texmf-local/tex/latex/exsheets}, probably}. You -\emph{can} install the other packages, \Tasks\ and \cntformats, in different -locations but since they belong to \ExSheets\ they probably should be placed -in the same directory. - -You should put the file \code{tasks.cfg} in the same directory as the -\code{tasks.sty} file. + directory like \code{texmf-local/tex/latex/exsheets}, probably}. As with every manual package installation you need to make sure to put the files in a directory where \TeX\ can find them and afterwards update the database. -\subsection{The \Tasks\ Package} -\noindent\sinceversion{0.9a}The \Tasks\ package has got its own documentation -- -\url{tasks_en.pdf}. Please read that file for details on the package. +\subsection{The \pkg*{tasks} Package} +The \pkg{tasks} package~\cite{pkg:tasks} used to be part of the \ExSheets\ +bundle but is a package of its own now\changedversion{0.15} and released +independently. You can find it as every other package on \ctan\ and in a full +\TeX~Live or \hologo{MiKTeX} installation. -\subsection{The \cntformats\ Package} -\noindent\sinceversion{0.5}The \cntformats\ package has got its own -documentation -- \url{cntformats_en.pdf}. Please read that file for details -on the package. +\subsection{The \pkg*{cntformats} Package} +The \pkg{cntformats} package~\cite{pkg:cntformats} used to be part of the +\ExSheets\ bundle but is a package of its own now\changedversion{0.15} and +released independently. You can find it as every other package on \ctan\ and +in a full \TeX~Live or \hologo{MiKTeX} installation. \subsection{The \pkg*{translations} Package} The \pkg{translations} package~\cite{pkg:translations} used to be part of the @@ -430,14 +417,26 @@ New options: \item New option \option{post-hook} to the \env{question} environment that allows to add code directly after the question body, see section~\ref{sec:opti-ques-envir}. - \item New command \cs{ExSheetsHeading}. + \item New command \cs{ExSheetsHeading}, see + section~\ref{sec:using-an-exsheets}. \item New pre-defined question properties \code{question-body}, - \code{bonus-points} and \code{counter}, see section - \ref{sec:additional_info}. + \code{bonus-points} and \code{counter}, see + section~\ref{sec:additional_info}. \item New option \option{save-to-aux}, see section \ref{sec:additional_info}. \end{itemize} +\subsection{Version 0.15} +\begin{itemize} + \item The packages \pkg{tasks} and \pkg{cntformats} have been removed from + the bundle and are now distributed as packages of their own. + \item The options \option*{load-headings} and \option*{load-tasks} have been + dropped. The optional functionality they provided is now provided all the + time. + \item New command \cs{IfQuestionPropertyTF}, see + section~\ref{sec:additional_info}. +\end{itemize} + \section{Thanks} I need to thank the many users who gave me feedback so far! For one thing this shows me that \ExSheets\ is useful to people. It also led to many @@ -512,14 +511,14 @@ The package \ExSheets\ has some options, namely the following ones: This code is placed immediately before the subtitle of the questions and solutions. It only has an effect with a title instance that uses the subtitle coffin, see section~\ref{sec:exsheets-headings}. - %% load-headings - \keybool{load-headings}\Default{false} - Loads additional styles for the headings. More on this is described in - section~\ref{sec:exsheets-headings}. - %% load-tasks - \keybool{load-tasks}\Default{false} - Loads additional styles for the \env{tasks} environment. See - the \href{tasks_en.pdf}{documentation of the \Tasks\ package}. + % %% load-headings + % \keybool{load-headings}\Default{false} + % Loads additional styles for the headings. More on this is described in + % section~\ref{sec:exsheets-headings}. + % %% load-tasks + % \keybool{load-tasks}\Default{false} + % Loads additional styles for the \env{tasks} environment. See + % the \href{tasks_en.pdf}{documentation of the \Tasks\ package}. %% totoc \keybool{totoc}\Default{false} This option adds the questions and solutions with their names and numbers @@ -1291,6 +1290,12 @@ Now the commands for recovering the properties: command is expandable. Since\changedversion{0.12} the properties of a question are written to the \code{aux} file it is possible to retrieve them before the corresponding \env{question} environment has been used. + \expandable\command{IfQuestionPropertyTF}[\marg{name}\marg{id}\marg{true}\marg{false}] + A command\sinceversion{0.15} that returns \meta{true} if the question with + the \acs{id} \meta{id} has the property \meta{name} and \meta{false} + otherwise. The variants \cs{IfQuestionPropertyT} and + \cs{IfQuestionPropertyF} also exist which only have the \meta{true} or the + \meta{false} branch. \end{commands} Let's say we have declared the properties \code{notes}, \code{reference} and @@ -1849,12 +1854,10 @@ handle pairs. \end{figure} The following subsections will show all definitions of the instances available -with the package option \option{load-headings} and how they look. This will -hopefully give you enough ideas to create your own instance if you want to -have another heading style than the ones available. - -Of you use the option \option{load-headings} each of the following instances is -available through the option \key{headings}{instance}. +and how they look. This will hopefully give you enough ideas to create your +own instance if you want to have another heading style than the ones +available. Each of the following instances is available through the option +\key{headings}{instance}. The following examples use a sample text defined as follows: \begin{sourcecode} @@ -2352,6 +2355,31 @@ Text before A `fancy-wp' heading. \sample \end{question} +\subsection{Using an \ExSheets{} Heading in Custom Code}\label{sec:using-an-exsheets} + +It can be useful to have access to \ExSheets{} headings in custom code. This +is possible with the following command\sinceversion{0.14}: + +\begin{commands} + \command{ExSheetsHeading}[\marg{instance}\marg{title}\marg{number}% + \marg{points}\marg{bonus}\marg{id}] + The meaning of the arguments is as follows: + \begin{itemize} + \item \meta{instance}: the name of the headings instance to be used. + \item \meta{title}: the contents of the \code{title} coffin. + \item \meta{number}: the contents of the \code{number} coffin. + \item \meta{points}: The number of points given to the question. If + non-zero this will cause the points to be printed in the \code{points} + coffin. + \item \meta{bonus}: the same as \meta{points} but for bonus points. + \item \meta{id}: the \acs{id} of the question this heading belongs to. + \end{itemize} +\end{commands} + +In combination with \cs{ForEachQuestion} the command can be used to build a +custom list of questions. An example of its usage can be seen at the German +Q\&A~site \TeX welt: \url{http://texwelt.de/wissen/fragen/6698#6738}. + \subsection{Load Custom Configurations} If you have custom configurations you want to be loaded automatically then save them in a file \code{exsheets\_configurations.cfg}. If this file is present it diff --git a/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf b/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf deleted file mode 100644 index 671ff5e4f3b..00000000000 Binary files a/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex b/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex deleted file mode 100644 index 8489ad90296..00000000000 --- a/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex +++ /dev/null @@ -1,460 +0,0 @@ -% arara: pdflatex -% arara: biber -% arara: pdflatex -% arara: pdflatex -% -------------------------------------------------------------------------- -% the TASKS package -% -% horizontal columned lists -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2014 Clemens Niederberger -% -% 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 Clemens Niederberger. -% -------------------------------------------------------------------------- -% The tasks package is part of the exsheets bundle -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\documentclass[load-preamble+]{cnltx-doc} -\usepackage[more]{tasks} - -\setcnltx{ - package = {tasks} , - authors = Clemens Niederberger , - email = {contact@mychemistry.eu} , - url = {https://bitbucket.org/cgnieder/exsheets/} , - info = {% - {\small part of the \href{exsheets_en.pdf}{\ExSheets} - bundle}\\[\baselineskip] - create horizontal columned lists% - } , - add-cmds = { - checkedchoicebox , - choicebox, - NewTasks, - settasks, - startnewitemline , - task - } , - add-silent-cmds = { - choice, correct, - DeclareInstance, DeclareTemplateInterface, - leftthumbsup, - s, sample - } -} - -\newpackagename\ExSheets{ExSheets} -\newpackagename\ExSheetslistings{ExSheets-listings} -\newpackagename\cntformats{cntformats} -\newpackagename\Tasks{tasks} - -% ---------------------------------------------------------------------------- -% other packages, bibliography, index -\usepackage{xcoffins,wasysym,enumitem,booktabs,siunitx} -\usepackage[accsupp]{acro} -\DeclareAcronym{id}{ - short = id , - long = Identifier , - format = \scshape , - pdfstring = ID , - accsupp = ID -} - -\usepackage{filecontents} -\usepackage{csquotes} - - - -% ---------------------------------------------------------------------------- -% example definitions that have to be done in the preamble: -\usepackage{exsheets} -\usepackage{dingbat} -\NewTasks[style=multiplechoice]{multiplechoice}[\choice](3) -\newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} - - -\def\s{This is some sample text we will use to create a somewhat - longer text spanning a few lines.} -\def\sample{\s\ \s\par\s} - -\begin{document} - -\section{Motivation} -Originally \Tasks\ has been an integral part of \ExSheets\changedversion{0.7}. -However, users told me that it indeed could be useful to have it as a -stand-alone package not having to load the whole \ExSheets\ beast just for -having the \env{tasks} environment available. Since I agree with this the -environment has been extracted into a package if its own, \Tasks. - -The reason for the \env{tasks} environment is an unwritten agreement in German -maths textbooks (in (junior) high school, especially) to organize exercises in -columns counting horizontally rather than vertically. That is what -\code{tasks} primarily is for. If you don't need this feature you're better -off using traditional \LaTeX{} lists and the \pkg{enumitem} package for -customization. - -\section{License and Requirements}\label{sec:license} -\license - -\Tasks\ requires the \bnd{l3kernel}~\cite{bnd:l3kernel} bundle -,\needpackage{xparse}, \pkg{xtemplate} and \needpackage{l3keys2e} which are -part of the \bnd{l3packages}~\cite{bnd:l3packages} bundle, -\pkg{epic}~\cite{pkg:epic}, \pkg{cntformats}\footnote{Part of the \ExSheets\ - bundle}, and \pkg{environ}~\cite{pkg:environ}. - - -\section{How it works} -\subsection{The Basics} -The \env{tasks} environment is similar to a list like \env{enumerate} but not -the same. Here are some of the differences: -\begin{itemize} - \item A first difference: there is no pagebreak possible inside an item but - only between items. - \item A second difference: the enumeration default is a), b), c) \ldots - \item A third difference: there is a split at \emph{every} occurrence of the - item separator. For this reason the default separator is not \cs*{item} - but \cs{task} so it is unique to this environment only. - \item A fourth difference: the \env{tasks} environment cannot be nested. - You can, however, use an \env*{itemize} environment or something in it. - \item A fifth difference: verbatim material cannot be used in it. You'll - have to use \cs*{string}, \cs*{texttt} or \cs*{detokenize}. If this - won't suffice then don't use \env{tasks}. -% \item A sixth difference: %footnotes -\end{itemize} - -\begin{environments} - \environment{tasks}[\oarg{options}\darg{num of columns}] - List like environment where the single items are iintroduced with - \cs{task}. -\end{environments} -Let's see an example: -\begin{example} - % \sample is defined to contain some sample text: - % \def\s{This is some sample text we will use to create a somewhat - % longer text spanning a few lines.} - % \def\sample{\s\ \s\par\s} - Some text before the list. - \begin{tasks} - \task \sample - \task \sample - \task \sample - \end{tasks} - And also some text after it. -\end{example} - -The environment takes the optional argument \darg{num of columns} with which -the number of columns used by the environment is specified. -\begin{example} - \begin{tasks}(2) - \task \sample - \task \s\ \s - \task \s - \task \sample - \task \s\par\s - \end{tasks} -\end{example} - -\subsection{Introducing a New Row} -Sometimes it may come in handy if the current\sinceversion{0.9} row of items -could be terminated and a new one is started. This is possible with the -following command: -\begin{commands} - \command{startnewitemline} - Introduce a new line in a \env{tasks} environment. -\end{commands} -\begin{example} - \begin{tasks}(4) - \task the first - \task the second - \task the third - \task the fourth - \task \rlap{the fifth item is way too long for this so we start a new row} - \startnewitemline - \task the sixth - \task the seventh - \task \rlap{the eighth item also is too long} \startnewitemline - \task the nineth - \task the tenth - \end{tasks} -\end{example} - - - -\section{Available Options}\label{sec:tasks:options} -The \Tasks\ package has one package option which also is called when you load -\ExSheets\ with the \option{load-tasks} option. -\begin{options} - \opt{more} - Load additional instances for the \env{tasks} object, details are - explained later in section~\ref{sec:tasks:instances}. -\end{options} - -The environment itself has some more options, namely the following ones that -can be set using a setup command: -\begin{commands} - \command{settasks}[\marg{options}] - Setup command for \Tasks. -\end{commands} -\begin{options} - \keyval{style}{instance}\Default - Choose the instance to be used. Read more on this in - section~\ref{sec:tasks}. - \keyval{counter-format}{counter specs}\Default - \sinceversion{0.9}Sets a custom label. The letters \code{tsk} are - replaced with the task-counter. An optional argument directly following - these letters specifies the counter format: \code{1}: \cs*{arabic}, - \code{a}: \cs*{alph}, \code{A}: \cs*{Alph}, \code{r}: \cs*{roman} and - \code{R}: \cs*{Roman}. - \keyval{label-format}{code}\Default - \changedversion{0.9}Can be used to apply a formatting like, \eg, - \cs*{bfseries} to the labels. - \keyval{label}{code}\Default - \changedversion{0.9}Overwrite the automatic label to a custom one. - \keyval{label-width}{dim}\Default{1em} - Sets the width of the item labels. - \keyval{label-offset}{dim}\Default{.3333em} - \sinceversion{0.7}Sets the offset, \ie, the distance between label and - item. - \keyval{item-indent}{dim}\Default{2.5em} - \sinceversion{0.9a}The indent of an item, \ie, the horizontal space - available for both label and label-offset. If - \[ - \text{\code{indent}} = - \text{\code{label-width}} + \text{\code{label=offset}} - \] - the label will align with the textblock above (if - \keyis{label-align}{left} is set). - \keychoice{label-align}{left,right,center}\Default{left} - \sinceversion{0.7}Determines how the labels are aligned within the - label-box whose width is set with \option{label-width}. - \keyval{before-skip}{skip}\Default{0pt} - Sets the skip before the list. - \keyval{after-skip}{skip}\Default{0pt} - Sets the skip after the list. - \keyval{after-item-skip}{skip}\Default{1ex plus 1ex minus 1ex} - \sinceversion{0.9}This vertical skip is inserted between rows of items. - \keybool{resume}\Default{false} - The enumeration will resume from a previous \env{tasks} environment. In - order to use this option properly you shouldn't mix different \env{tasks} - environments that both count their items. -\end{options} - -Now the same list as above but with three columns and a different label: -\begin{example} - \begin{tasks}[counter-format=(tsk[r]),label-width=4ex](2) - \task \sample - \task \s\ \s - \task \s - \task \sample - \task \s\par\s - \end{tasks} -\end{example} -% \begin{tasks}[counter-format=(tsk[r]),label-width=4ex](3) -% \task \sample -% \task \s\ \s -% \task \s -% \task \sample -% \task \s\par\s -% \end{tasks} - -Let's use it inside a question, \ie, inside \ExSheets' \env{question} -environment: -\begin{example} - % since settings are local the following ones will be lost - % outside this example; - \settasks{ - counter-format = qu.tsk , - item-indent = 2em , - label-width = 2em , - label-offset = 0pt - } - \begin{question}[type=exam]{4} - I have these two tasks for you. Shall we begin? - \begin{tasks}(2) - \task The first task: easy! - \task The second task: even more so! - \end{tasks} - \end{question} - \begin{solution}[print] - Now, let's see\ldots\ ah, yes: - \begin{tasks} - \task This is the first solution. Told you it was easy. - \task This is the second solution. And of course you knew that! - \end{tasks} - \end{solution} -\end{example} - -\section{Available Instances}\label{sec:tasks:instances} -When you use the package option \option{more} of the \Tasks\ package or load -\ExSheets\ with the \option{load-tasks} option there are currently three -additional instances for the \code{tasks} object available: -\begin{description} - \item[itemize] uses \cs*{labelitemi} as labels. - \item[enumerate] enumerates the items with 1., 2., \ldots - \item[multiplechoice] a --~well~-- `multiple choice' list. -\end{description} -\begin{example} - \begin{tasks}[style=itemize](2) - \task that's just how\ldots - \task \ldots we expected - \end{tasks} - \begin{tasks}[style=enumerate](2) - \task that's just how\ldots - \task \ldots we expected - \end{tasks} - \begin{tasks}[style=multiplechoice](2) - \task that's just how\ldots - \task \ldots we expected - \end{tasks} -\end{example} - -\section{Custom Labels} -If you want to change a single label inside a list, you can use the optional -argument of \cs{task}. This will temporarily overwrite the default label. -\begin{example}[side-by-side] - \begin{tasks}[style=itemize] - \task a standard item - \task another one - \task[+] a different one - \task and another one - \end{tasks} -\end{example} - -\section{New Tasks} -It is possible to add custom environments that work like the \code{tasks} -environment. -\begin{commands} - \command{NewTasks}[\oarg{options}\marg{name}\oarg{separator}\darg{cols}] - Define environment \meta{name} that uses \meta{separator} to introduce a - new item. Default for \meta{separator} is \cs{task}, default for - \meta{cols} is \code{1}. The \meta{options} are the ones described in - section~\ref{sec:tasks:options}. - \command{RenewTasks}[\oarg{options}\marg{name}\oarg{separator}\darg{cols}] - Renew environment previously defined with \cs{NewTasks}. -\end{commands} -The \env{tasks} environment is defined as follows: -\begin{sourcecode} - \NewTasks{tasks} -\end{sourcecode} - -The separator does not have to be a control sequence: -\begin{example} - % preamble: - % \usepackage{dingbat} - \NewTasks[label=\footnotesize\leftthumbsup,label-width=1.3em]{done}[*] - \begin{done} - * First task - * Second Task - \end{done} -\end{example} -Although this might seem handy or even nice I strongly advice against using -something different than a command sequence. Remember that the items will be -split at \emph{every} occurrence of the separator. So in order to use the -separator (here for example for a starred variant of a command) within an item -it has to be hidden in braces. This is avoided of you use a command sequence -which even doesn't have to be defined. - -Let's say you want a \env*{multiplechoice} environment that has three columns -in its default state. You could do something like this: -\begin{example} - % preamble: - % \NewTasks[style=multiplechoice]{multiplechoice}[\choice](3) - % \newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} - % - % \PrintSolutionsTF and the {question} environment are provided - % by the ExSheets package - \begin{question} - \begin{multiplechoice} - \choice First choice - \choice Second choice - \choice[\correct] Third choice - \end{multiplechoice} - \end{question} - \begin{solution}[print] - \begin{multiplechoice} - \choice First choice - \choice Second choice - \choice[\correct] Third choice - \end{multiplechoice} - \end{solution} -\end{example} - -The last example shows you two additional commands: -\begin{commands} - \command{choicebox}[\quad\choicebox] - Print an empty square. - \command{checkedchoicebox}[\quad\checkedchoicebox] - Print a crossed-out square. -\end{commands} - - -\section{Styling \Tasks} -Equivalent to the styling of \ExSheets\ \Tasks\ uses \pkg{xtemplate} to -declare additional instances for the lists. - -\subsection{The \code{tasks} Object}\label{sec:tasks} -The object that's defined by \Tasks\ is the `tasks' object. This time there -are four instances available for the one template (again `default') that was -defined. - -\subsubsection{Available Options} -This section only lists the options that can be used when defining an instance -of the `default' template. The following subsections will give some examples -of their usage. - -\begin{sourcecode} - \DeclareTemplateInterface{tasks}{default}{3} - { - % option : type = default - enumerate : boolean = true , - label : tokenlist , - indent : length = 2.5em , - counter-format : tokenlist = tsk[a]) , - label-format : tokenlist , - label-width : length = 1em , - label-offset : length = .3333em , - after-item-skip : skip = 1ex plus 1ex minus 1ex - } -\end{sourcecode} - -\subsubsection{Predefined Instances} -This is rather brief this time: -\begin{sourcecode} - % ALPHABETIZE: a) b) c) - \DeclareInstance{tasks}{alphabetize}{default}{} - % available when `load-tasks=true': - % ITEMIZE: - \DeclareInstance{tasks}{itemize}{default} - { - enumerate = false , - label-width = 1.125em - } - % ENUMERATE: - \DeclareInstance{tasks}{enumerate}{default} - { counter-format = tsk. } - % MULTIPLECHOICE: - \DeclareInstance{tasks}{multiplechoice}{default} - { - enumerate = false , - label = \choicebox , - } -\end{sourcecode} - -\end{document} diff --git a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty deleted file mode 100644 index 22a10598aef..00000000000 --- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty +++ /dev/null @@ -1,349 +0,0 @@ -% -------------------------------------------------------------------------- -% the CNTFORMATS package -% -% A different way to read counters -% -% This package is part of the exsheets bundle -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2012-2014 Clemens Niederberger -% -% 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 Clemens Niederberger. -% -------------------------------------------------------------------------- -% The cntformats package is part of the exsheets bundle -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\def\@cntfmts@date{2013/10/11} -\def\@cntfmts@version{v0.6} - -\ProvidesPackage{cntformats}[% - \@cntfmts@date\space - \@cntfmts@version\space - A different way to read counters. (CN)] -\RequirePackage{etoolbox,cnltx-base} -% -------------------------------------------------------------------------- -% message handling -\def\@cntfmts@error@message{% - For details have a look at the `exsheets' manual.} - -\cnltx@create@generic@message{@cntfmts}{cntformats}{Error}{\@cntfmts@error@message} -\cnltx@create@generic@message{@cntfmts}{cntformats}{Warning}{} -\cnltx@create@generic@message{@cntfmts}{cntformats}{WarningNoLine}{} -\cnltx@create@generic@message{@cntfmts}{cntformats}{Info}{} - -\def\@cntfmts@err@already@defined#1{% - \@cntfmts@error{The counter `#1' already exists!}} -\def\@cntfmts@err@unknown@counter#1{% - \@cntfmts@error{The counter `#1' is undefined!}} -\def\@cntfmts@err@pattern@defined#1#2{% - \@cntfmts@error{The pattern `#2' for module `#1' is already defined!}} -\def\@cntfmts@err@pattern@undefined#1#2{% - \@cntfmts@error{The pattern `#2' for module `#1' is undefined!}} - -% ---------------------------------------------------------------------------- -% tokenlist analyzing and manipulating -% if you happen to read this code and notice some obvious reasons why these -% macros shoudn't be used like this, please send me your improved version -% (seriously! But please explain why yours is better) -% \long\def\@cntfmts@ifintl#1#2{% -% \def\@cntfmts@intl@tmpa##1#2{}% -% \expandafter\if\expandafter\relax\expandafter -% \detokenize\expandafter{\@cntfmts@intl@tmpa#1{}{}#2}\relax% -% \expandafter\@secondoftwo -% \else -% \expandafter\@firstoftwo -% \fi -% } -% \long\def\@cntfmts@ifintlcs#1{% -% \expandafter\@cntfmts@ifintl\expandafter{#1}} - -% \long\def\@cntfmts@replaceonceincs#1#2#3{% -% \@cntfmts@ifintlcs#1{#2}% -% {\@cntfmts@replace@once@incs#1{#2}{#3}}{}% -% } -% \long\def\@cntfmts@replace@once@incs#1#2#3{% -% \def\@cntfmts@replo@tmpa##1#2##2\q@stop{% -% \def#1{##1#3##2}}% -% \expandafter\@cntfmts@replo@tmpa#1\q@stop -% } - -% \long\def\@cntfmts@replaceallin#1#2#3{% -% \def\@cntfmts@repla@tmpa{#1}% -% \@cntfmts@replaceonceincs\@cntfmts@repla@tmpa{#2}{#3}% -% \@cntfmts@ifintlcs\@cntfmts@repla@tmpa{#2}% -% {\expandafter\@cntfmts@replaceallin\expandafter{\@cntfmts@repla@tmpa}{#2}{#3}}% -% {\expandonce\@cntfmts@repla@tmpa}% -% } -% \long\def\@cntfmts@replaceallincs#1#2#3{% -% \@cntfmts@replaceonceincs#1{#2}{#3}% -% \@cntfmts@ifintlcs#1{#2}{\@cntfmts@replaceallincs#1{#2}{#3}}{}% -% } - -% ---------------------------------------------------------------------------- -% expansion tools -% heavily inspired by expl3's \exp_args:N -- one might say: copied -% \long\def\@cntfmts@getnextbraced#1#2#3{#2\@cntfmts@firstofone{#3{#1}}} -% \long\def\@cntfmts@firstofone#1{#1} -% \long\def\@cntfmts@braced@unexpanded#1\@cntfmts@firstofone#2#3{% -% #1\@cntfmts@firstofone{#2{#3}}} -% \long\def\@cntfmts@braced@expandedonce#1\@cntfmts@firstofone#2#3{% -% \expandafter\@cntfmts@getnextbraced\expandafter{#3}{#1}{#2}} - -% \long\def\@cntfmts@expand@first{% -% \@cntfmts@braced@expandedonce -% \@cntfmts@firstofone} - -% \long\def\@cntfmts@expand@second{% -% \@cntfmts@braced@unexpanded -% \@cntfmts@braced@expandedonce -% \@cntfmts@firstofone} - -% \long\def\@cntfmts@expand@third{% -% \@cntfmts@braced@unexpanded -% \@cntfmts@braced@unexpanded -% \@cntfmts@braced@expandedonce -% \@cntfmts@firstofone} - -% ---------------------------------------------------------------------------- -% expandable commands with optional argument (and no mandatory) -% this is probably not very robust. If you know what you're doing you're -% probably able to define a better version yourself. If not: don't use this -% one! -% \long\def\@cntfmts@isopt@#1[#2\q@marker#3#{% -% \if\relax\detokenize{#1#2}\relax -% \expandafter\@firstoftwo -% \else -% \expandafter\@secondoftwo -% \fi} -% \long\def\@cntfmts@isopt#1#2#3{% -% \@cntfmts@isopt@#1\q@marker[\q@marker{#2#1}{#2[{#3}]{#1}}} - -% \long\def\@cntfmts@defwopt#1[#2]#3{% -% \long\def#1##1{\@cntfmts@isopt{##1}{\csuse{\@cntfmts@strip@bs#1@opt}}{#2}}% -% \long\csdef{\@cntfmts@strip@bs#1@opt}[##1]{#3}} - -% \def\@cntfmts@strip@bs{\expandafter\@gobble\string} - -% ---------------------------------------------------------------------------- -% #1: module -% #2: counter -\def\@cntfmts@def@counter@read#1#2#3{% - \cnltx@expandargs(no)\csdef - {@#1@read@#3@counter}% - {\csname @#1@read@#2@counter\endcsname}% -} - -% create pattern for an existing counter: -% #1: module -% #2: counter -% #3: id -\newcommand*\@cntfmts@add@counter@pattern[3][cntfmts]{% - \ifcsdef{c@#2} - {}{\@cntfmts@err@unknown@counter{#2}}% - \ifcsdef{@#1@#2@counter} - {\@cntfmts@err@pattern@defined{#1}{#2}} - {\csdef{@#1@#2@counter}{}}% - \listcsadd{@#1@counter@ids}{#3}% - \@cntfmts@def@counter@read{#1}{#2}{#3}% -} - -\newcommand*\@cntfmts@add@counter@pattern@nostar[3][cntfmts]{% - \@cntfmts@add@counter@pattern[#1]{#2}{#3}% - \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% -} - -\newrobustcmd*\AddCounterPattern{% - \@ifstar - {\@cntfmts@add@counter@pattern} - {\@cntfmts@add@counter@pattern@nostar}% -} -\@onlypreamble\AddCounterPattern - -% create pattern for a new counter -% #1: counter -% #2: id -\newcommand*\@cntfmts@new@counter@pattern[3][cntfmts]{% - \ifcsdef{the#2} - {\@cntfmts@err@counter@defined{#2}}{}% - \newcounter{#2}% - \listcsadd{@#1@counter@ids}{#3}% - \@cntfmts@def@counter@read{#1}{#2}{#3}% - \csdef{@#1@#2@counter}{} -} - -\newcommand*\@cntfmts@new@counter@pattern@nostar[3][cntfmts]{% - \@cntfmts@new@counter@pattern[#1]{#2}{#3}% - \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% -} - -\newrobustcmd*\NewCounterPattern{% - \@ifstar - {\@cntfmts@new@counter@pattern} - {\@cntfmts@new@counter@pattern@nostar}% -} -\@onlypreamble\NewCounterPattern - -% renew pattern: -\newcommand*\@cntfmts@renew@counter@pattern[3][cntfmts]{% - \ifcsdef{the#2} - {}{\@cntfmts@err@unknown@counter{#2}}% - \ifcsdef{@#1@#2@counter}{} - {\@cntfmts@err@pattern@undefined{#1}{#2}}% - \ifinlistcs{@#1@counter@ids}{#3} - {}{\listcsadd{@#1@counter@ids}{#3}}% - \@cntfmts@def@counter@read{#1}{#2}{#3}% -} - -\newcommand*\@cntfmts@renew@counter@pattern@nostar[3][cntfmts]{% - \@cntfmts@renew@counter@pattern[#1]{#2}{#3}% - \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% -} - -\newrobustcmd\RenewCounterPattern{% - \@ifstar - {\@cntfmts@renew@counter@pattern} - {\@cntfmts@renew@counter@pattern@nostar}% -} -\@onlypreamble\RenewCounterPattern - -% ---------------------------------------------------------------------------- -% assign a different internal command to than \c@ -% can/must be used after a call from \AddCounterPattern* or -% \NewCounterPattern* -% #1: module -% #2: counter -% #3: internal command -\def\@cntfmts@create@read@counter#1#2#3{% - \expandafter\newexpandablecmd - \expandafter*\csname @#1@read@#2@counter\endcsname[1][]{% - \ifblank{##1} - {\@arabic{#3}} - {\csuse{@cntfmts@counter@type@##1}{#3}}% - }% -} - -\newrobustcmd*\ReadCounterFrom[3][cntfmts]{% - \@cntfmts@create@read@counter{#1}{#2}{#3}% -} - -% ---------------------------------------------------------------------------- -% pattern formats -% #1: key -% #2: number presentation command like \@alph -\def\@cntfmts@new@pattern@format#1#2{% - \csdef{@cntfmts@counter@type@#1}{#2}% -} - -\newrobustcmd*\NewPatternFormat[2]{% - \@cntfmts@new@pattern@format{#1}{#2}% -} -\@onlypreamble\NewPatternFormat - -% ---------------------------------------------------------------------------- -% interpret and print pattern: -% #1: module -% #2: list -% #3: pattern -\def\@cntfmts@read@counter@pattern#1#2#3{% - \def\@cntfmts@parsed@pattern{#3\@empty}% - \forlistcsloop{\@cntfmts@replace@pattern{#1}}{#2}% -} -% #1: module -% #2: pattern-key -\def\@cntfmts@replace@pattern#1#2{% - \cnltx@replace@all\@cntfmts@parsed@pattern - {#2}{\csuse{@#1@read@#2@counter}}% -} - -\newrobustcmd*\ReadCounterPattern[2][cntfmts]{% - \@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}\@cntfmts@parsed@pattern -} - -\newrobustcmd*\ReadCounterPatternFrom[2][cntfmts]{% - \cnltx@expandargs(nno)\@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}% - \@cntfmts@parsed@pattern -} - -% #1: save pattern in -% #2: save interpretation in -% #3: pattern -% #4: module -\newcommand*\@cntfmts@save@counter@pattern[4]{% - \@cntfmts@read@counter@pattern{#4}{@#4@counter@ids}{#3}% - \let#2\@cntfmts@parsed@pattern - \def#1{#3}% -} - -\newcommand*\@cntfmts@esave@counter@pattern[4]{% - \@cntfmts@read@counter@pattern{#4}{@#4@counter@ids}{#3}% - \edef#2{\@cntfmts@parsed@pattern}% - \def#1{#3}% -} - -\newrobustcmd*\SaveCounterPattern[4][cntfmts]{% - \@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% -} - -\newrobustcmd*\SaveCounterPatternFrom[4][cntfmts]{% - \cnltx@expandargs(nno)\@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% -} - -\newrobustcmd*\eSaveCounterPattern[4][cntfmts]{% - \@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% -} - -\newrobustcmd*\eSaveCounterPatternFrom[4][cntfmts]{% - \cnltx@expandargs(nno)\@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% -} - -% ---------------------------------------------------------------------------- -% predefined formats and pattern -\NewPatternFormat{a}{\@alph} -\NewPatternFormat{A}{\@Alph} -\NewPatternFormat{1}{\@arabic} -\NewPatternFormat{r}{\@roman} -\NewPatternFormat{R}{\@Roman} - -\ifdef\c@paragraph - {\AddCounterPattern{paragraph}{pg}}{} -\ifdef\c@subsubsection - {\AddCounterPattern{subsubsection}{ssse}}{} -\ifdef\c@subsection - {\AddCounterPattern{subsection}{sse}}{} -\ifdef\c@section - {\AddCounterPattern{section}{se}}{} -\ifdef\c@chapter - {\AddCounterPattern{chapter}{ch}}{} - -\endinput - -% HISTORY: -2012/09/30 v0.2beta - first version (as part of the `exsheets' bundle) -2012/11/08 v0.4 - stepped number with `exsheets' until now; next stepping - won't synchronize but will step to whatever deems - appropriate -2012/04/23 v0.5 - changed tests for heading commands to test explicitly for - the associated counters - - change test for counter in \@cntfmts@add@counter@pattern - from \the to \c@ - - rename tokenlist test macros to use cntformats' - namespace -2013/10/11 v0.6 - use my `cnltx-base' package for the programming tools it - provides; this allows to get rid of the artefacts in the - expanded patterns - diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index f6425d9bb7d..4e628c964af 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -25,8 +25,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\def\exsheets@date{2014/06/28} -\def\exsheets@version{0.14} +\def\exsheets@date{2014/07/20} +\def\exsheets@version{0.15} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -37,10 +37,10 @@ % -------------------------------------------------------------------------- % check expl3 version: -\@ifpackagelater { expl3 } { 2012/11/21 } +\@ifpackagelater {expl3} {2014/01/01} { } { - \PackageError { exsheets } { Support~package~expl3~too~old } + \PackageError {exsheets} {Support~package~expl3~too~old} { You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ 'l3packages'.\MessageBreak @@ -78,19 +78,19 @@ % ---------------------------------------------------------------------------- % messages -\msg_new:nnn { exsheets} { totalpoints } +\msg_new:nnn {exsheets} {totalpoints} { You~need~to~activate~`points/parse'~if~you~want~to~use~ \token_to_str:N \totalpoints .~I~will~do~nothing~instead. } -\msg_new:nnn { exsheets} { parse-points } +\msg_new:nnn {exsheets} {parse-points} { You~need~to~activate~`points/parse'~if~you~want~to~use~ \token_to_str:N #1 .~I~will~do~nothing~instead. } -\msg_new:nnn { exsheets} { headings } +\msg_new:nnn {exsheets} {headings} { You~requested~the~headings~instance~`#1'~\msg_line_context: \c_space_tl which~is~not~defined.~Did~you~forget~to~use~the~package~option~ @@ -98,52 +98,52 @@ pretend~nothing~happened. } -\msg_new:nnn { exsheets } { random-file } +\msg_new:nnn {exsheets} {random-file} { You~asked~me~to~select~#1~questions~from~file~#2~which~contains~#3~questions.~ I'll~select~all~of~them. } -\msg_new:nnn { exsheets } { random-selectable } +\msg_new:nnn {exsheets} {random-selectable} { You~asked~me~to~select~#1~questions~from~file~#2~which~contains~#3~questions.~ #4~of~these~are~selectable,~so~I'll~select~all~of~them. } -\msg_new:nnn { exsheets } { only-inside-question } +\msg_new:nnn {exsheets} {only-inside-question} { The~command~`~\token_to_str:N #1 \c_space_tl'~can~only~be~used~inside~ the~question~environment. } -\msg_new:nnn { exsheets } { loading-configurations } +\msg_new:nnn {exsheets} {loading-configurations} { Loading~custom~configurations~file~`exsheets_configurations.cgf'. } -\msg_new:nnn { exsheets } { deprecated-command } +\msg_new:nnn {exsheets} {deprecated-command} { The~command~`~\token_to_str:N #1 \c_space_tl'~is~deprecated.~ Use~`~\token_to_str:N #2 \c_space_tl'~instead. } -\msg_new:nnn { exsheets } { dropped-option } +\msg_new:nnn {exsheets} {dropped-option} { The~option~`#1'~has~been~dropped. } -\msg_new:nnn { exsheets } { grade-missing } +\msg_new:nnn {exsheets} {grade-missing} { The~grade~`#1'~has~never~been~declared. } -\msg_new:nnn { exsheets } { grade-parse } +\msg_new:nnn {exsheets} {grade-parse} { I~cannot~calculate~the~points~for~grade~`#1'~since~you're~using~the~option~ `points/parse=false'. } -\msg_new:nnn { exsheets } { variations } +\msg_new:nnn {exsheets} {variations} { The~number~of~variations~must~at~least~be~`2'.~You~chose~`#1'~hence~I'm~ doing~nothing. } -\msg_new:nnn { exsheets } { variant } +\msg_new:nnn {exsheets} {variant} { You~must~choose~an~integer~between~`1'~and~`#1'.~You~chose~`#2'~hence~ I'm~doing~nothing. @@ -152,11 +152,11 @@ \cs_new_protected:Npn \exsheets_depr_cmd:nn #1#2 { \cs_new:Npn #1 - { \msg_warning:nnnn { exsheets } { deprecated-command } { #1 } { #2 } #2 } + { \msg_warning:nnnn {exsheets} { deprecated-command } {#1} {#2} #2 } } \cs_new_protected:Npn \exsheets_option_dropped:n #1 - { \msg_warning:nnn { exsheets } { dropped-option } { #1 } } + { \msg_warning:nnn {exsheets} { dropped-option } {#1} } % ---------------------------------------------------------------------------- \RequirePackage @@ -172,7 +172,7 @@ % ---------------------------------------------------------------------------- % write to aux file: \cs_new_protected:Npn \exsheets_write_to_aux_x:n #1 - { \if@filesw \iow_now:Nx \@auxout { #1 } \fi } + { \if@filesw \iow_now:Nx \@auxout {#1} \fi } % prevent compilatin errors when exsheets is removed from a document: \AtBeginDocument{ @@ -215,8 +215,6 @@ % ---------------------------------------------------------------------------- % (also) package options: -\bool_new:N \l__exsheets_load_headings_bool -\bool_new:N \l__exsheets_load_tasks_bool \bool_new:N \l__exsheets_solutions_by_ref_bool \bool_new:N \l__exsheets_questions_totoc_bool \bool_new:N \l__exsheets_solutions_totoc_bool @@ -237,28 +235,27 @@ \tl_new:N \l__exsheets_solutions_pre_hook_tl \tl_new:N \l__exsheets_solutions_post_hook_tl -\AtBeginDocument{ - \cs_if_exist:NF \phantomsection - { \cs_new:Npn \phantomsection {} } -} -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { color .code:n = - \exsheets_option_dropped:n { color } , + \exsheets_option_dropped:n {color} , counter-format .code:n = \SaveCounterPattern [ exsheets ] \l__exsheets_qu_counter_pattern_tl \l__exsheets_qu_counter_interpretation_tl - { #1 } , + {#1} , counter-within .code:n = \@addtoreset{question}{#1} , headings .tl_set:N = \l__exsheets_heading_instance_tl , - load-headings .bool_set:N = \l__exsheets_load_headings_bool , + load-headings .code:n = + \exsheets_option_dropped:n {load-headings} , +% .bool_set:N = \l__exsheets_load_headings_bool , headings-format .tl_set:N = \l_exsheets_heading_title_user_format_tl , subtitle-format .tl_set:N = \l_heading_exsheets_subtitle_user_format_tl , - load-tasks .bool_set:N = \l__exsheets_load_tasks_bool , + load-tasks .code:n = + \exsheets_option_dropped:n {load-tasks} , use-ref .bool_set:N = \l__exsheets_solutions_by_ref_bool , totoc .choice: , totoc / true .code:n = @@ -271,16 +268,16 @@ questions-totoc .bool_set:N = \l__exsheets_questions_totoc_bool , solutions-totoc .bool_set:N = \l__exsheets_solutions_totoc_bool , toc-level .code:n = - \tl_set:Nn \l__exsheets_questions_toclevel_tl { #1 } - \tl_set:Nn \l__exsheets_solutions_toclevel_tl { #1 } , + \tl_set:Nn \l__exsheets_questions_toclevel_tl {#1} + \tl_set:Nn \l__exsheets_solutions_toclevel_tl {#1} , questions-toc-level .tl_set:N = \l__exsheets_questions_toclevel_tl , solutions-toc-level .tl_set:N = \l__exsheets_solutions_toclevel_tl , auto-label .bool_set:N = \l__exsheets_auto_label_bool } -\keys_set:nn { exsheets} { counter-format = qu. } +\keys_set:nn {exsheets} { counter-format = qu. } % process package options: -\ProcessKeysOptions { exsheets } +\ProcessKeysOptions {exsheets} % ---------------------------------------------------------------------------- % points for exercises @@ -322,50 +319,50 @@ \cs_new_protected_nopar:Npn \exsheets_set_points_name:n #1 { - \tl_if_in:nnTF { #1 } { / } + \tl_if_in:nnTF {#1} { / } { \__exsheets_set_points_name_aux:nn #1 \q_stop } { \__exsheets_set_points_name_aux:nn #1 / \q_stop } } \cs_new_protected_nopar:Npn \__exsheets_set_points_name_aux:nn #1/#2 \q_stop { - \tl_set:Nn \l__exsheets_points_name_tl { #1 } + \tl_set:Nn \l__exsheets_points_name_tl {#1} \tl_set:Nn \l__exsheets_points_name_plural_tl { #1#2 } } \cs_new_protected_nopar:Npn \exsheets_set_bonus_name:n #1 { - \tl_if_in:nnTF { #1 } { / } + \tl_if_in:nnTF {#1} { / } { \__exsheets_set_bonus_name_aux:nn #1 \q_stop } { \__exsheets_set_bonus_name_aux:nn #1 / \q_stop } } \cs_new_protected_nopar:Npn \__exsheets_set_bonus_name_aux:nn #1/#2 \q_stop { - \tl_set:Nn \l__exsheets_bonus_name_tl { #1 } + \tl_set:Nn \l__exsheets_bonus_name_tl {#1} \tl_set:Nn \l__exsheets_bonus_name_plural_tl { #1#2 } } % FIXME: \fp_add will deprecate! \cs_new_protected_nopar:Npn \exsheets_add_points:n #1 { - \fp_gadd:Nn \g__exsheets_points_sum_fp { #1 } - \fp_gadd:Nn \g__exsheets_this_question_points_fp { #1 } + \fp_gadd:Nn \g__exsheets_points_sum_fp {#1} + \fp_gadd:Nn \g__exsheets_this_question_points_fp {#1} } \cs_generate_variant:Nn \exsheets_add_points:n { V } \cs_new_protected_nopar:Npn \exsheets_add_bonus:n #1 { - \fp_gadd:Nn \g__exsheets_bonus_sum_fp { #1 } - \fp_gadd:Nn \g__exsheets_this_question_bonus_fp { #1 } + \fp_gadd:Nn \g__exsheets_bonus_sum_fp {#1} + \fp_gadd:Nn \g__exsheets_this_question_bonus_fp {#1} } \cs_generate_variant:Nn \exsheets_add_bonus:n { V } \cs_new_protected_nopar:Npn \exsheets@sum@of@points #1 - { \fp_gset:Nn \g_exsheets_total_points_fp { #1 } } + { \fp_gset:Nn \g_exsheets_total_points_fp {#1} } \cs_new_protected_nopar:Npn \exsheets@sum@of@bonus #1 - { \fp_gset:Nn \g_exsheets_total_bonus_fp { #1 } } + { \fp_gset:Nn \g_exsheets_total_bonus_fp {#1} } \cs_new_nopar:Npn \exsheets_parse_points:n #1 { @@ -373,8 +370,8 @@ \tl_use:N \l__exsheets_points_number_format_tl { \bool_if:NTF \l__exsheets_parse_points_bool - { \exsheets_num:n { \fp_to_decimal:n { #1 } } } - { \use:n { #1 } } + { \exsheets_num:n { \fp_to_decimal:n {#1} } } + { \use:n {#1} } } \group_end: } @@ -386,8 +383,8 @@ \tl_use:N \l__exsheets_bonus_number_format_tl { \bool_if:NTF \l__exsheets_parse_points_bool - { \exsheets_num:n { \fp_to_decimal:n { #1 } } } - { \use:n { #1 } } + { \exsheets_num:n { \fp_to_decimal:n {#1} } } + { \use:n {#1} } } \group_end: } @@ -396,7 +393,7 @@ \cs_new_protected_nopar:Npn \exsheets_num:n #1 { \group_begin: - \fp_set:Nn \l__exsheets_tmpa_tl { #1 } + \fp_set:Nn \l__exsheets_tmpa_tl {#1} \fp_to_tl:N \l__exsheets_tmpa_tl \group_end: } @@ -411,7 +408,7 @@ { \bool_if:NTF \l__exsheets_parse_points_bool { - \tl_if_eq:nnTF { #1 } { ?? } + \tl_if_eq:nnTF {#1} { ?? } { \tl_use:N \l__exsheets_points_name_plural_tl } { \fp_compare:nTF { #1 <= 1 } @@ -434,7 +431,7 @@ { \bool_if:NTF \l__exsheets_parse_points_bool { - \tl_if_eq:nnTF { #1 } { ?? } + \tl_if_eq:nnTF {#1} { ?? } { \tl_use:N \l__exsheets_bonus_name_plural_tl } { \fp_compare:nTF { #1 <= 1 } @@ -452,34 +449,34 @@ { \bool_if:NTF \l__exsheets_inside_question_bool { - \exsheets_add_points:n { #2 } - \IfBooleanF { #1 } { \exsheets_print_points:n { #2 } } + \exsheets_add_points:n {#2} + \IfBooleanF {#1} { \exsheets_print_points:n {#2} } } - { \msg_error:nnn { exsheets } { only-inside-question } { \addpoints } } + { \msg_error:nnn {exsheets} {only-inside-question} {\addpoints} } } \NewDocumentCommand \addbonus { sm } { \bool_if:NTF \l__exsheets_inside_question_bool { - \exsheets_add_bonus:n { #2 } - \IfBooleanF { #1 } { \exsheets_print_bonus:n { #2 } } + \exsheets_add_bonus:n {#2} + \IfBooleanF {#1} { \exsheets_print_bonus:n {#2} } } - { \msg_error:nnn { exsheets } { only-inside-question } { \addbonus } } + { \msg_error:nnn {exsheets} {only-inside-question} {\addbonus} } } \NewDocumentCommand \points { sm } { - \IfBooleanTF { #1 } - { \exsheets_parse_points:n { #2 } } - { \exsheets_print_points:n { #2 } } + \IfBooleanTF {#1} + { \exsheets_parse_points:n {#2} } + { \exsheets_print_points:n {#2} } } \NewDocumentCommand \bonus { sm } { - \IfBooleanTF { #1 } - { \exsheets_parse_bonus:n { #2 } } - { \exsheets_print_bonus:n { #2 } } + \IfBooleanTF {#1} + { \exsheets_parse_bonus:n {#2} } + { \exsheets_print_bonus:n {#2} } } \cs_new_protected_nopar:Npn \exsheets_print_points:n #1 @@ -487,8 +484,8 @@ \group_begin: \tl_use:N \l__exsheets_points_format_tl { - \exsheets_parse_points:n { #1 } - \exsheets_points_name:n { #1 } + \exsheets_parse_points:n {#1} + \exsheets_points_name:n {#1} } \group_end: } @@ -496,8 +493,8 @@ \cs_new_protected_nopar:Npn \exsheets_print_bonus:n #1 { - \exsheets_parse_bonus:n { #1 } - \exsheets_bonus_name:n { #1 } + \exsheets_parse_bonus:n {#1} + \exsheets_bonus_name:n {#1} } \cs_generate_variant:Nn \exsheets_print_bonus:n { V } @@ -505,44 +502,44 @@ { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_points:n { \g_exsheets_total_points_fp } } { \exsheets_print_points:n { \g_exsheets_total_points_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \pointssum } } + { \msg_warning:nnn {exsheets} {parse-points} {\pointssum} } } \NewDocumentCommand \bonussum { s } { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_bonus:n { \g_exsheets_total_bonus_fp } } { \exsheets_print_bonus:n { \g_exsheets_total_bonus_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \bonussum } } + { \msg_warning:nnn {exsheets} {parse-points} {\bonussum} } } \NewDocumentCommand \currentpointssum { s } { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_points:n { \g__exsheets_points_sum_fp } } { \exsheets_print_points:n { \g__exsheets_points_sum_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \currentpointssum } } + { \msg_warning:nnn {exsheets} {parse-points} {\currentpointssum} } } \NewDocumentCommand \currentbonussum { s } { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_bonus:n { \g__exsheets_bonus_sum_fp } } { \exsheets_print_bonus:n { \g__exsheets_bonus_sum_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \currentbonussum } } + { \msg_warning:nnn {exsheets} {parse-points} {\currentbonussum} } } \NewDocumentCommand \totalpoints { s } @@ -551,7 +548,7 @@ \tl_use:N \l__exsheets_points_format_tl { \exsheets_totalpoints: - \IfBooleanF { #1 } + \IfBooleanF {#1} { \bool_if:nT { @@ -561,7 +558,7 @@ { \exsheets_points_name:n { \g_exsheets_total_points_fp } } } \exsheets_totalbonus: - \IfBooleanF { #1 } + \IfBooleanF {#1} { \fp_compare:nF { \g_exsheets_total_bonus_fp = 0 } { @@ -590,7 +587,7 @@ { \g_exsheets_total_points_fp } } } - { \msg_warning:nn { exsheets } { totalpoints } } + { \msg_warning:nn {exsheets} {totalpoints} } } \cs_new_nopar:Npn \exsheets_totalbonus: @@ -610,12 +607,12 @@ \keys_define:nn { exsheets / points } { name .code:n = - \exsheets_set_points_name:n { #1 } - \exsheets_set_bonus_name:n { #1 } , + \exsheets_set_points_name:n {#1} + \exsheets_set_bonus_name:n {#1} , name-plural .code:n = - \tl_set:Nn \l__exsheets_points_name_plural_tl { #1 } - \tl_set:Nn \l__exsheets_bonus_name_plural_tl { #1 } , - bonus-name .code:n = \exsheets_set_bonus_name:n { #1 } , + \tl_set:Nn \l__exsheets_points_name_plural_tl {#1} + \tl_set:Nn \l__exsheets_bonus_name_plural_tl {#1} , + bonus-name .code:n = \exsheets_set_bonus_name:n {#1} , bonus-plural .tl_set:N = \l__exsheets_bonus_name_plural_tl , pre-bonus .tl_set:N = \l__exsheets_points_pre_bonus_marker_tl , post-bonus .tl_set:N = \l__exsheets_points_post_bonus_marker_tl , @@ -634,10 +631,10 @@ \cs_new_protected:Npn \exsheets_set_variations:n #1 { - \int_compare:nNnTF { #1 } < { 2 } - { \msg_warning:nnn { exsheets } { variations } { #1 } } + \int_compare:nNnTF {#1} < { 2 } + { \msg_warning:nnn {exsheets} {variations} {#1} } { - \int_set:Nn \l__exsheets_variations_int { #1 } + \int_set:Nn \l__exsheets_variations_int {#1} \int_zero:N \l__exsheets_tmpa_int \int_do_while:nNnn { \l__exsheets_tmpa_int } < { \l__exsheets_variations_int } @@ -658,8 +655,8 @@ { \bool_if:nTF { - \int_compare_p:nNn { #1 } > { 0 } && - \int_compare_p:nNn { #1 } < { \l__exsheets_variations_int + 1 } + \int_compare_p:nNn {#1} > { 0 } && + \int_compare_p:nNn {#1} < { \l__exsheets_variations_int + 1 } } { \int_zero:N \l__exsheets_tmpa_int @@ -670,7 +667,7 @@ \__exsheets_reset_variation_auxiliary:x { \int_use:N \l__exsheets_tmpa_int } } - \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } ##1 + \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } ##1 { ##1 \cs_set:Npn \exsheets_last_variant: { ##1 } @@ -678,8 +675,8 @@ } } { - \msg_warning:nnxx { exsheets } { variant } - { \int_use:N \l__exsheets_variations_int } { #1 } + \msg_warning:nnxx {exsheets} {variant} + { \int_use:N \l__exsheets_variations_int } {#1} } } @@ -690,23 +687,23 @@ \cs_new_protected:Npn \__exsheets_generate_variation_auxiliary:n #1 { - \cs_if_exist:cTF { __exsheets_variation_ \int_to_roman:n { #1 } :n } - { \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } { } } - { \cs_new:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } { } } + \cs_if_exist:cTF { __exsheets_variation_ \int_to_roman:n {#1} :n } + { \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } { } } + { \cs_new:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } { } } } \cs_new_protected:Npn \__exsheets_reset_variation_auxiliary:n #1 { - \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } ##1 + \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } ##1 { \use:c { __exsheets_variation_ \int_to_roman:n { #1 + 1 } :n } } } \cs_generate_variant:Nn \__exsheets_reset_variation_auxiliary:n { x } \NewDocumentCommand \SetVariations { m } - { \exsheets_set_variations:n { #1 } } + { \exsheets_set_variations:n {#1} } \NewDocumentCommand \variant { m } - { \exsheets_variant:n { #1 } } + { \exsheets_variant:n {#1} } \NewDocumentCommand \vary { } { \exsheets_vary:w } @@ -742,19 +739,19 @@ \cs_new:Npn \exsheets_strip_braces:N #1 { \exp_after:wN \__exsheets_strip_braces:w \exp_after:wN #1#1 \q_stop } \cs_new_protected:Npn \__exsheets_strip_braces:w #1#2 \q_stop - { \tl_set:Nn #1 { #2 } } + { \tl_set:Nn #1 {#2} } \cs_new_protected:Npn \__exsheets_declare_relgrades:n #1 { - \clist_set:Nn \l__exsheets_tmpa_clist { #1 } + \clist_set:Nn \l__exsheets_tmpa_clist {#1} \clist_map_inline:Nn \l__exsheets_tmpa_clist { \__exsheets_declare_relgrade:w ##1 \q_stop } } \cs_new_protected:Npn \__exsheets_declare_relgrade:w #1 = #2 \q_stop { - \tl_set:Nn \l__exsheets_tmpa_tl { #1 } - \tl_set:Nn \l__exsheets_tmpb_tl { #2 } + \tl_set:Nn \l__exsheets_tmpa_tl {#1} + \tl_set:Nn \l__exsheets_tmpb_tl {#2} \tl_trim_spaces:N \l__exsheets_tmpa_tl \exsheets_strip_braces:N \l__exsheets_tmpa_tl \tl_trim_spaces:N \l__exsheets_tmpb_tl @@ -765,12 +762,12 @@ } \NewDocumentCommand \DeclareRelGrades { m } - { \__exsheets_declare_relgrades:n { #1 } } + { \__exsheets_declare_relgrades:n {#1} } \@onlypreamble \DeclareRelGrades \cs_new_protected:Npn \__exsheets_grade:nn #1#2 { - \prop_get:NnNTF \l__exsheets_relgrades_prop { #2 } \l__exsheets_tmpa_fp + \prop_get:NnNTF \l__exsheets_relgrades_prop {#2} \l__exsheets_tmpa_fp { \bool_if:NTF \l__exsheets_parse_points_bool { @@ -782,16 +779,16 @@ { min( \__exsheets_grade_rounded: , \g_exsheets_total_points_fp ) } } } - { \msg_warning:nnn { exsheets } { grade-parse } { #1 } \textbf{??} } + { \msg_warning:nnn {exsheets} {grade-parse} {#1} \textbf{??} } } - { \msg_warning:nnn { exsheets } { grade-missing } { #1 } \textbf{??} } + { \msg_warning:nnn {exsheets} {grade-missing} {#1} \textbf{??} } } \NewDocumentCommand \grade { sm } { - \IfBooleanTF { #1 } - { \__exsheets_grade:nn { 0 } { #2 } } - { \__exsheets_grade:nn { 1 } { #2 } } + \IfBooleanTF {#1} + { \__exsheets_grade:nn { 0 } {#2} } + { \__exsheets_grade:nn { 1 } {#2} } } \keys_define:nn { exsheets / grades } @@ -821,11 +818,11 @@ \cs_new_nopar:Npn \exsheets_glue:N #1 { \cleaders \vbox:n {} \skip_vertical:N #1 } -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { skip-below .code:n = - \dim_set:Nn \l__exsheets_questions_skip_below_dim { #1 } - \dim_set:Nn \l__exsheets_solutions_skip_below_dim { #1 } + \dim_set:Nn \l__exsheets_questions_skip_below_dim {#1} + \dim_set:Nn \l__exsheets_solutions_skip_below_dim {#1} } % Einteilung in Klassen, Themen und andere Gruppierungen: @@ -835,7 +832,7 @@ \cs_new_protected:Npn \exsheets_new_question_class:nn #1#2 { - \prop_put:Nnn \l__exsheets_class_prop { #2 } { #1 } + \prop_put:Nnn \l__exsheets_class_prop {#2} {#1} \prop_new:c { g__exsheets_questions_#1_prop } \prop_new:c { g__exsheets_#2_prop } \prop_new:c { g__exsheets_#2_active_prop } @@ -843,7 +840,7 @@ \bool_new:c { g__exsheets_use_#2_bool } \bool_new:c { l__exsheets_#1_active_bool } \tl_new:c { l__exsheets_questions_#1_tl } - \keys_define:nn { exsheets } + \keys_define:nn {exsheets} { use-#2 .code:n = { @@ -926,13 +923,13 @@ \cs_new_protected:Npn \exsheets_declare_question_class:nn #1#2 { - \prop_if_in:NnTF \l__exsheets_class_prop { #2 } + \prop_if_in:NnTF \l__exsheets_class_prop {#2} {} - { \exsheets_new_question_class:nn { #1 } { #2 } } + { \exsheets_new_question_class:nn {#1} {#2} } } \NewDocumentCommand \DeclareQuestionClass { mm } - { \exsheets_declare_question_class:nn { #1 } { #2 } } + { \exsheets_declare_question_class:nn {#1} {#2} } \@onlypreamble \DeclareQuestionClass \cs_new:Npn \exsheets_get_question_class:n #1 @@ -942,28 +939,28 @@ } \DeclareExpandableDocumentCommand \GetQuestionClass { m } - { \exsheets_get_question_class:n { #1 } } + { \exsheets_get_question_class:n {#1} } \cs_new_protected:Npn \exsheets_print_question_class:nTF #1#2#3 { \group_begin: \tl_set:Nx \l__exsheets_tmpa_tl - { \exsheets_get_question_class:n { #1 } } + { \exsheets_get_question_class:n {#1} } \tl_if_blank:VTF \l__exsheets_tmpa_tl - { #3 } + {#3} { - \cs_set_protected:Npn \__exsheets_print_question_class:n ##1 { #2 } + \cs_set_protected:Npn \__exsheets_print_question_class:n ##1 {#2} \__exsheets_print_question_class:n - { \exsheets_get_question_class:n { #1 } } + { \exsheets_get_question_class:n {#1} } } \group_end: } \NewDocumentCommand \PrintQuestionClassTF { mmm } - { \exsheets_print_question_class:nTF { #1 } { #2 } { #3 } } + { \exsheets_print_question_class:nTF {#1} {#2} {#3} } \NewDocumentCommand \PrintQuestionClassT { mm } - { \exsheets_print_question_class:nTF { #1 } { #2 } { } } + { \exsheets_print_question_class:nTF {#1} {#2} { } } \NewDocumentCommand \PrintQuestionClassF { mm } - { \exsheets_print_question_class:nTF { #1 } { } { #2 } } + { \exsheets_print_question_class:nTF {#1} { } {#2} } % ---------------------------------------------------------------------------- % die 'question' Umgebung @@ -1089,10 +1086,10 @@ \cs_new_protected:Npn \__exsheets_read_points:w #1 ! #2 ! #3 \q_stop { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \bool_set_true:N \l__exsheets_only_print_points_bool - \tl_set:Nn \l__exsheets_questions_points_tl { #2 } + \tl_set:Nn \l__exsheets_questions_points_tl {#2} } { \bool_set_false:N \l__exsheets_only_print_points_bool @@ -1102,22 +1099,22 @@ \cs_new_protected:Npn \__exsheets_read_points_aux:w #1+#2+#3 \q_stop { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \fp_zero:N \l__exsheets_question_points_fp } - { \fp_set:Nn \l__exsheets_question_points_fp { #1 } } - \tl_if_blank:nTF { #2 } + { \fp_set:Nn \l__exsheets_question_points_fp {#1} } + \tl_if_blank:nTF {#2} { \fp_zero:N \l__exsheets_question_bonus_fp } { - \tl_if_blank:nTF { #3 } + \tl_if_blank:nTF {#3} { \fp_zero:N \l__exsheets_question_bonus_fp } - { \fp_set:Nn \l__exsheets_question_bonus_fp { #2 } } + { \fp_set:Nn \l__exsheets_question_bonus_fp {#2} } } } \cs_new_protected:Npn \__exsheets_read_points:n #1 { \bool_if:NTF \l__exsheets_parse_points_bool { \__exsheets_read_points:w #1!! \q_stop } - { \tl_set:Nn \l__exsheets_questions_points_tl { #1 } } + { \tl_set:Nn \l__exsheets_questions_points_tl {#1} } } \cs_new:Npn \exsheets_label_format:n #1 { qu:#1 } @@ -1132,7 +1129,7 @@ \cs_new_protected:Npn \exsheets_update_referencing_command:NN #1#2 { \cs_set:Npx #1 ##1 - { \exp_not:o { #2 } { \exsheets_label_format:n { ##1 } } } + { \exp_not:o {#2} { \exsheets_label_format:n { ##1 } } } } \cs_new_protected:Npn \exsheets_update_referencing_commands: @@ -1146,25 +1143,25 @@ { \exsheets_set_question_properties:x { - ref = \exp_not:o { \exsheets_ref:n { #1 } } , - pageref = \exp_not:o { \exsheets_pageref:n { #1 } } + ref = \exp_not:o { \exsheets_ref:n {#1} } , + pageref = \exp_not:o { \exsheets_pageref:n {#1} } } } \cs_generate_variant:Nn \exsheets_set_ref_properties:n { V } -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { label-format .code:n = - \cs_set:Npn \exsheets_label_format:n ##1 { #1 } + \cs_set:Npn \exsheets_label_format:n ##1 {#1} \exsheets_update_referencing_commands: , label-cmd .code:n = - \cs_set:Npn \__exsheets_label:n { #1 } + \cs_set:Npn \__exsheets_label:n {#1} \exsheets_update_referencing_commands: , ref-cmd .code:n = - \cs_set:Npn \__exsheets_ref:n { #1 } + \cs_set:Npn \__exsheets_ref:n {#1} \exsheets_update_referencing_commands: , page-ref-cmd .code:n = - \cs_set:Npn \__exsheets_pageref:n { #1 } + \cs_set:Npn \__exsheets_pageref:n {#1} \exsheets_update_referencing_commands: } @@ -1176,7 +1173,7 @@ \bool_if:NT \l__exsheets_questions_use_bool { \bool_gset_true:N \g__exsheets_questions_use_bool } % Optionen: - \IfNoValueF { #1 } { \keys_set:nn { exsheets / question } { #1 } } + \IfNoValueF {#1} { \keys_set:nn { exsheets / question } {#1} } % ID: \bool_if:nT { @@ -1221,7 +1218,7 @@ % Punktevergabe: \fp_gzero:N \g__exsheets_this_question_points_fp \fp_gzero:N \g__exsheets_this_question_bonus_fp - \IfNoValueTF { #2 } + \IfNoValueTF {#2} { \__exsheets_read_points:n { 0 } \bool_if:NT \l__exsheets_points_questions_default_bool @@ -1241,7 +1238,7 @@ \fp_gset_eq:NN \g__exsheets_this_question_bonus_fp \l__exsheets_question_bonus_fp - \__exsheets_read_points:n { #2 } + \__exsheets_read_points:n {#2} % check if moving this to a later point has negative effects... % \exsheets_set_question_properties:n { points = #2 } } @@ -1374,8 +1371,8 @@ \cs_new_protected:Npn \__exsheets_save_number_in_aux_x:Nnn #1#2#3 { - \prop_gput:Nfx #1 { #2 } { #3 } - \exsheets_write_to_aux_x:n { \exsheets@save@number { #2 } { #3 } } + \prop_gput:Nfx #1 {#2} {#3} + \exsheets_write_to_aux_x:n { \exsheets@save@number {#2} {#3} } } \cs_new_protected:Npn \__exsheets_save_number_in:N #1 @@ -1411,7 +1408,7 @@ \cs_new_protected:Npn \__exsheets_restore_number_from_and_do:Nnn #1#2#3 { - \prop_get:NnN #1 { #2 } \l__exsheets_tmpc_tl + \prop_get:NnN #1 {#2} \l__exsheets_tmpc_tl \tl_if_eq:NNF \l__exsheets_tmpc_tl \q_no_value { \exp_after:wN @@ -1424,11 +1421,11 @@ \cs_generate_variant:Nn \__exsheets_restore_number_from_and_do:Nnn { NV } \NewDocumentCommand \QuestionNumber { m } - { \exsheets_question_number:n { #1 } } + { \exsheets_question_number:n {#1} } \cs_new_protected:Npn \exsheets_question_number:n #1 { - \prop_get:NnNTF \g__exsheets_questions_id_prop { #1 } \l__exsheets_tmpa_tl + \prop_get:NnNTF \g__exsheets_questions_id_prop {#1} \l__exsheets_tmpa_tl { \__exsheets_question_number:c { exsheets@question@\l__exsheets_tmpa_tl } } { \textbf{??} } } @@ -1447,9 +1444,9 @@ \cs_new_protected:Npn \__exsheets_get_question_number:w #1-#2-#3 \q_stop { \cs_if_exist:NT \thechapter - { \int_set:Nn \l__exsheets_counter_ch_int { #1 } } - \int_set:Nn \l__exsheets_counter_sec_int { #2 } - \int_set:Nn \l__exsheets_counter_qu_int { #3 } + { \int_set:Nn \l__exsheets_counter_ch_int {#1} } + \int_set:Nn \l__exsheets_counter_sec_int {#2} + \int_set:Nn \l__exsheets_counter_qu_int {#3} } % map ID's to number of used questions @@ -1465,9 +1462,12 @@ % ---------------------------------------------------------------------------- % title of a question: -\input { exsheets_headings.def } -\bool_if:NT \l__exsheets_load_headings_bool - { \input { exsheets_headings.cfg } } +\cs_if_exist:NF \exsheets_headings_files_loaded: + { + \file_input:n {exsheets_headings.def} + \file_input:n {exsheets_headings.cfg} + } + % #1: instance % #2: title % #3: number @@ -1476,13 +1476,13 @@ % #6: id \cs_new:Npn \exsheets_use_heading:nnnnnn #1#2#3#4#5#6 { - \IfInstanceExistTF { exsheets-heading } { #1 } - { \UseInstance { exsheets-heading } { #1 } } + \IfInstanceExistTF {exsheets-heading} {#1} + { \UseInstance {exsheets-heading} {#1} } { - \msg_warning:nnx { exsheets} { headings } { #1 } - \UseInstance { exsheets-heading } { block } + \msg_warning:nnx {exsheets} {headings} {#1} + \UseInstance {exsheets-heading} {block} } - { #2 } { #3 } { #4 } { #5 } { #6 } + {#2} {#3} {#4} {#5} {#6} } \cs_generate_variant:Nn \exsheets_use_heading:nnnnnn { V , VVVnnV , VVVVnV } @@ -1503,8 +1503,8 @@ type / exercise .code:n = \bool_set_false:N \l__exsheets_exam_bool , name .code:n = - \tl_set:Nn \l__exsheets_exercise_name_tl { #1 } - \tl_set:Nn \l__exsheets_questions_name_tl { #1 } , + \tl_set:Nn \l__exsheets_exercise_name_tl {#1} + \tl_set:Nn \l__exsheets_questions_name_tl {#1} , headings .tl_set:N = \l__exsheets_question_heading_instance_tl , subtitle .tl_set:N = \l__exsheets_questions_subtitle_tl , print .bool_set:N = \l__exsheets_questions_print_bool , @@ -1531,28 +1531,38 @@ { \prop_new:c { g__exsheets_question_property_#1_prop } \keys_define:nn { question / meta } - { #1 .code:n = \__exsheets_question_set_property:nn { #1 } { ##1 } } + { #1 .code:n = \__exsheets_question_set_property:nn {#1} { ##1 } } } \NewDocumentCommand \DeclareQuestionProperty { m } - { \exsheets_declare_question_property:n { #1 } } + { \exsheets_declare_question_property:n {#1} } \@onlypreamble \DeclareQuestionProperty \cs_new_protected:Npn \exsheets_set_question_properties:n #1 { \@bsphack \bool_if:NTF \l__exsheets_inside_question_bool - { \keys_set:nn { question / meta } { #1 } } - { - \msg_error:nnn { exsheets } { only-inside-question } - { \SetQuestionProperties } - } + { \keys_set:nn { question / meta } {#1} } + { \msg_error:nnn {exsheets} {only-inside-question} {\SetQuestionProperties} } \@esphack } \cs_generate_variant:Nn \exsheets_set_question_properties:n { x } -\NewDocumentCommand \SetQuestionProperties { m } - { \exsheets_set_question_properties:n { #1 } } +\prg_new_conditional:Npnn \exsheets_if_question_property:nn #1#2 {T,F,TF} + { + \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } {#2} + { \prg_return_true: } + { \prg_return_false: } + } +\DeclareExpandableDocumentCommand \IfQuestionPropertyTF { } + { \exsheets_if_question_property:nnTF } +\DeclareExpandableDocumentCommand \IfQuestionPropertyT { } + { \exsheets_if_question_property:nnT } +\DeclareExpandableDocumentCommand \IfQuestionPropertyF { } + { \exsheets_if_question_property:nnF } + +\NewDocumentCommand \SetQuestionProperties { +m } + { \exsheets_set_question_properties:n {#1} } % #1: ID % #2: property @@ -1560,7 +1570,7 @@ \cs_new:Npn \exsheets@question@property #1#2#3 { \prop_gput:cnn { g__exsheets_question_property_#2_prop } - { #1 } { #3 } + {#1} {#3} } % #1: property @@ -1568,7 +1578,7 @@ \cs_new_protected:Npn \__exsheets_question_set_property:nn #1#2 { \prop_gput:cVn { g__exsheets_question_property_#1_prop } - \CurrentQuestionID { #2 } + \CurrentQuestionID {#2} % watch if this has negativ effects: \exsheets_write_to_aux_x:n { @@ -1582,12 +1592,12 @@ % #1: property % #2: ID \DeclareExpandableDocumentCommand \GetQuestionProperty { mm } - { \exsheets_get_question_property:no { #1 } { #2 } } + { \exsheets_get_question_property:no {#1} {#2} } \cs_new:Npn \exsheets_get_question_property:nn #1#2 { - \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } { #2 } - { \prop_get:cn { g__exsheets_question_property_#1_prop } { #2 } } + \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } {#2} + { \prop_get:cn { g__exsheets_question_property_#1_prop } {#2} } { ?? } } \cs_generate_variant:Nn \exsheets_get_question_property:nn { no } @@ -1632,7 +1642,7 @@ \group_begin: \normalfont\normalsize\normalcolor \colorbox { exsheetsdebugcolor } - { \parbox { \dim_eval:n { #1 - 2 \fboxsep } } { #2 } } + { \parbox { \dim_eval:n { #1 - 2 \fboxsep } } {#2} } \group_end: \par } @@ -1690,7 +1700,7 @@ \int_zero:N \l__exsheets_include_random_int \cs_new:Npn \exsheets_file_input_if_exist:n #1 - { \file_if_exist:nT { #1 } { \file_input:n { #1 } } } + { \file_if_exist:nT {#1} { \file_input:n {#1} } } \cs_new_protected:Npn \exsheets_prop_count:N #1 { @@ -1708,9 +1718,9 @@ \NewDocumentCommand \includequestions { om } { \group_begin: - \IfNoValueF { #1 } - { \keys_set:nn { exsheets / include } { #1 } } - \exsheets_include_questions:n { #2 } + \IfNoValueF {#1} + { \keys_set:nn { exsheets / include } {#1} } + \exsheets_include_questions:n {#2} \group_end: } @@ -1721,7 +1731,7 @@ { \bool_set_true:N \l__exsheets_select_questions_bool \clist_gclear:N \questionsincludedlast - \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } { #1 } + \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } {#1} \seq_map_inline:Nn \l__exsheets_tmpa_seq { \bool_set_true:N \l__exsheets_questions_deactivate_bool @@ -1776,7 +1786,7 @@ \bool_set_false:N \l__exsheets_include_all_bool \bool_set_false:N \l__exsheets_include_random_bool \bool_set_true:N \l__exsheets_include_by_id_bool - \clist_set:Nn \l__exsheets_include_id_clist { #1 } , + \clist_set:Nn \l__exsheets_include_id_clist {#1} , % the `exclude' option does _not_ set \l__exsheets_include_random_bool , % \l__exsheets_include_by_id_bool or \l__exsheets_include_all_bool so % it can be combined with the other options: @@ -1785,7 +1795,7 @@ \bool_set_false:N \l__exsheets_include_all_bool \bool_set_true:N \l__exsheets_include_random_bool \bool_set_false:N \l__exsheets_include_by_id_bool - \int_set:Nn \l__exsheets_include_random_int { #1 } + \int_set:Nn \l__exsheets_include_random_int {#1} } \int_new:N \g__exsheets_selection_number_int @@ -1802,11 +1812,11 @@ \bool_if:NTF \l__exsheets_include_random_bool { \prop_gput:Nxn \g__exsheets_included_questions_prop - { \int_use:N \g__exsheets_selection_number_int } { #1 } + { \int_use:N \g__exsheets_selection_number_int } {#1} } { \prop_gput:Nxn \g__exsheets_included_questions_prop - { \int_use:N \g__exsheets_questions_id_int } { #1 } + { \int_use:N \g__exsheets_questions_id_int } {#1} } } } @@ -1841,44 +1851,44 @@ {% parsing list of excluded IDs \clist_if_in:NnTF \l__exsheets_exclude_id_clist - { #1 } + {#1} { \bool_gset_false:N \g__exsheets_questions_use_bool } { \bool_gset_true:N \g__exsheets_questions_use_bool - \clist_gput_right:Nn \questionsincludedlast { #1 } + \clist_gput_right:Nn \questionsincludedlast {#1} \int_gincr:N \g__exsheets_questions_used_int \__exsheets_mark_as_used_x:nn { \int_use:N \g__exsheets_questions_used_int } - { #1 } + {#1} % \prop_gput:NnV \g__exsheets_questions_used_prop - % { #1 } + % {#1} % \g__exsheets_questions_id_int \prop_gput:NnV \g__exsheets_questions_id_prop - { #1 } + {#1} \g__exsheets_questions_id_int } } {% parsing list of included IDs \clist_if_in:NnTF \l__exsheets_include_id_clist - { #1 } + {#1} { \clist_if_in:NnTF \l__exsheets_exclude_id_clist - { #1 } + {#1} { \bool_gset_false:N \g__exsheets_questions_use_bool } { \bool_gset_true:N \g__exsheets_questions_use_bool - \clist_gput_right:Nn \questionsincludedlast { #1 } + \clist_gput_right:Nn \questionsincludedlast {#1} % \prop_gput:NnV \g__exsheets_questions_used_prop - % { #1 } + % {#1} % \g__exsheets_questions_id_int \int_gincr:N \g__exsheets_questions_used_int \__exsheets_mark_as_used_x:nn { \int_use:N \g__exsheets_questions_used_int } - { #1 } + {#1} \prop_gput:NnV \g__exsheets_questions_id_prop - { #1 } + {#1} \g__exsheets_questions_id_int } } @@ -1921,9 +1931,9 @@ \int_compare:nTF { \l__exsheets_include_random_int >= \l__exsheets_tmpa_int } { % not enough questions available: - \msg_warning:nnxxx { exsheets } { random-file } + \msg_warning:nnxxx {exsheets} {random-file} { \int_use:N \l__exsheets_include_random_int } - { #1 } + {#1} { \int_use:N \l__exsheets_tmpa_int } \bool_set_true:N \l__exsheets_include_all_bool } @@ -1937,9 +1947,9 @@ } { % not enough questions selectable: - \msg_warning:nnxxxx { exsheets } { random-selectable } + \msg_warning:nnxxxx {exsheets} {random-selectable} { \int_use:N \l__exsheets_include_random_int } - { #1 } + {#1} { \int_use:N \l__exsheets_tmpa_int } { \int_use:N \l__exsheets_tmpb_int } \bool_set_true:N \l__exsheets_include_all_bool @@ -1989,7 +1999,7 @@ } \NewDocumentCommand \PrintIfIncludeActiveTF { mm } - { \bool_if:NTF \l__exsheets_questions_deactivate_bool { #2 } { #1 } } + { \bool_if:NTF \l__exsheets_questions_deactivate_bool {#2} {#1} } \NewDocumentCommand \PrintIfIncludeActiveT { } { \bool_if:NF \l__exsheets_questions_deactivate_bool } @@ -2027,7 +2037,7 @@ { \int_set_eq:NN \l__exsheets_tmpe_int \g__exsheets_questions_id_int } \prop_gput:Nxn \g__exsheets_solutions_content_prop { \int_use:N \g__exsheets_questions_id_int } - { #1 } + {#1} \prop_gput:NxV \g__exsheets_solutions_questions_id_prop { \int_use:N \g__exsheets_questions_id_int } \g__exsheets_questions_current_id_tl @@ -2046,7 +2056,7 @@ \l__exsheets_qu_counter_interpretation_tl \l__exsheets_solutions_name_tl \g__exsheets_questions_current_id_tl - \use:n { #1 } + \use:n {#1} \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim } } @@ -2093,7 +2103,7 @@ \bool_if:NT \l__exsheets_solutions_use_bool { \bool_set_true:N \l__exsheets_inside_solution_bool - \IfNoValueF { #1 } { \keys_set:nn { exsheets / solution } { #1 } } + \IfNoValueF {#1} { \keys_set:nn { exsheets / solution } {#1} } % \tl_use:N \l__exsheets_solutions_pre_hook_tl } \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl @@ -2123,7 +2133,7 @@ } \exsheets_use_heading:Vnnnnn \l__exsheets_solution_heading_instance_tl - { #2 } { #1 } { 0 } { 0 } { #3 } + {#2} {#1} { 0 } { 0 } {#3} } \cs_generate_variant:Nn \__exsheets_solutions_name:nnn { VV , VVV } @@ -2163,14 +2173,14 @@ { \cs_new_eq:NN \__exsheets_saved_label:n \label \cs_set:Npn \label #1 - { \__exsheets_saved_label:n { #1 } \__exsheets_exlabel:n { #1 } } + { \__exsheets_saved_label:n {#1} \__exsheets_exlabel:n {#1} } } % this is like \ref from latex.ltx \cs_new:Npn \__exsheets_exref:n #1 { \cs_if_exist:cTF { r@#1 } - { \__exsheets_exref_aux:n { #1 } } + { \__exsheets_exref_aux:n {#1} } { 1\relax \protect\G@refundefinedtrue @@ -2185,7 +2195,7 @@ % user command: \NewDocumentCommand \printsolutions { O{all} } - { \exsheets_print_solutions:n { #1 } } + { \exsheets_print_solutions:n {#1} } % internal command: \cs_new_protected:Npn \exsheets_print_solutions:n #1 @@ -2195,21 +2205,21 @@ \bool_set_true:N \l__exsheets_inside_solution_bool \cs_set:Npn \S ##1 { \exref { exse:##1 } } \cs_set:Npn \C ##1 { \exref { exch:##1 } } - \keys_set:nn { exsheets / exsheets_print_solutions } { #1 } + \keys_set:nn { exsheets / exsheets_print_solutions } {#1} \group_end: } -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { exsheets_print_solutions .choice: , exsheets_print_solutions / section .code:n = - { \exsheets_print_solutions_section:n { #1 } } , + { \exsheets_print_solutions_section:n {#1} } , exsheets_print_solutions / chapter .code:n = - { \exsheets_print_solutions_chapter:n { #1 } } , + { \exsheets_print_solutions_chapter:n {#1} } , exsheets_print_solutions / all .code:n = { \exsheets_print_solutions_all: } , exsheets_print_solutions / byID .code:n = - { \exsheets_print_solutions_byID:n { #1 } } , + { \exsheets_print_solutions_byID:n {#1} } , chapter-hook .tl_set:N = \l__exsheets_new_chapter_hook_tl , section-hook .tl_set:N = \l__exsheets_new_section_hook_tl } @@ -2230,16 +2240,16 @@ \cs_new_protected:Npn \__exsheets_print_solution_if:nn #1#2 { - \bool_if:nT { #2 } + \bool_if:nT {#2} { \prop_get:NnN \g__exsheets_solutions_names_prop - { #1 } \l__exsheets_tmpa_tl + {#1} \l__exsheets_tmpa_tl \prop_get:NnN \g__exsheets_solutions_content_prop - { #1 } \l__exsheets_tmpb_tl + {#1} \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop - { #1 } \l__exsheets_tmpc_tl + {#1} \l__exsheets_tmpc_tl \prop_get:NnN \g__exsheets_solutions_counter_prop - { #1 } \l__exsheets_tmpd_tl + {#1} \l__exsheets_tmpd_tl \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl @@ -2256,7 +2266,7 @@ % print by section: \cs_new:Npn \exsheets_print_solutions_section:n #1 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \prop_map_inline:Nn \g__exsheets_question_number_prop { @@ -2268,7 +2278,7 @@ } } { - \clist_map_inline:nn { #1 } + \clist_map_inline:nn {#1} { \__exsheets_print_solutions_by_section:w ##1-- \q_stop } } } @@ -2276,12 +2286,12 @@ \cs_new_protected:Npn \__exsheets_print_solutions_by_section:w #1-#2-#3 \q_stop { % wenn #3=-, dann range-Input - \tl_if_eq:nnTF { #3 } { - } + \tl_if_eq:nnTF {#3} { - } { \int_zero:N \l__exsheets_tmpa_int \int_set_eq:NN \l__exsheets_tmpb_int \c_ten_thousand - \tl_if_blank:nF { #1 } { \int_set:Nn \l__exsheets_tmpa_int { #1 } } - \tl_if_blank:nF { #2 } { \int_set:Nn \l__exsheets_tmpb_int { #2 } } + \tl_if_blank:nF {#1} { \int_set:Nn \l__exsheets_tmpa_int {#1} } + \tl_if_blank:nF {#2} { \int_set:Nn \l__exsheets_tmpb_int {#2} } \int_do_while:nn { \l__exsheets_tmpa_int <= \l__exsheets_tmpb_int } { \prop_map_inline:Nn \g__exsheets_question_number_prop @@ -2299,7 +2309,7 @@ \prop_map_inline:Nn \g__exsheets_question_number_prop { \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 } - { \__exsheets_print_solutions_section:nnn { ##1 } { ##2 } { #1 } } + { \__exsheets_print_solutions_section:nnn { ##1 } { ##2 } {#1} } } } } @@ -2307,14 +2317,14 @@ \cs_new:Npn \__exsheets_print_solutions_section:nnn #1#2#3 { \__exsheets_read_number:w #2 \q_stop - \__exsheets_print_solution_if:nn { #1 } + \__exsheets_print_solution_if:nn {#1} { \int_compare_p:n { \l__exsheets_counter_sec_int = #3 } } } % print by chapter: \cs_new:Npn \exsheets_print_solutions_chapter:n #1 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \prop_map_inline:Nn \g__exsheets_question_number_prop { @@ -2326,7 +2336,7 @@ } } { - \clist_map_inline:nn { #1 } + \clist_map_inline:nn {#1} { \__exsheets_print_solutions_by_chapter:w ##1-- \q_stop } } } @@ -2334,12 +2344,12 @@ \cs_new_protected:Npn \__exsheets_print_solutions_by_chapter:w #1-#2-#3 \q_stop { % wenn #3=-, dann range-Input - \tl_if_eq:nnTF { #3 } { - } + \tl_if_eq:nnTF {#3} { - } { \int_zero:N \l__exsheets_tmpa_int \int_set_eq:NN \l__exsheets_tmpb_int \c_ten_thousand - \tl_if_blank:nF { #1 } { \int_set:Nn \l__exsheets_tmpa_int { #1 } } - \tl_if_blank:nF { #2 } { \int_set:Nn \l__exsheets_tmpb_int { #2 } } + \tl_if_blank:nF {#1} { \int_set:Nn \l__exsheets_tmpa_int {#1} } + \tl_if_blank:nF {#2} { \int_set:Nn \l__exsheets_tmpb_int {#2} } \int_do_while:nn { \l__exsheets_tmpa_int <= \l__exsheets_tmpb_int } { \prop_map_inline:Nn \g__exsheets_question_number_prop @@ -2357,7 +2367,7 @@ \prop_map_inline:Nn \g__exsheets_question_number_prop { \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 } - { \__exsheets_print_solutions_chapter:nnn { ##1 } { ##2 } { #1 } } + { \__exsheets_print_solutions_chapter:nnn { ##1 } { ##2 } {#1} } } } } @@ -2365,7 +2375,7 @@ \cs_new:Npn \__exsheets_print_solutions_chapter:nnn #1#2#3 { \__exsheets_read_number:w #2 \q_stop - \__exsheets_print_solution_if:nn { #1 } + \__exsheets_print_solution_if:nn {#1} { \int_compare_p:n { \l__exsheets_counter_ch_int = #3 } } } @@ -2389,7 +2399,7 @@ !\int_compare_p:n { \use:c { l__exsheets_counter_#1_int } = 0 } } - { #2 } + {#2} } \cs_generate_variant:Nn \__exsheets_sectioning_hook:nn { nV } @@ -2403,15 +2413,15 @@ \l__exsheets_counter_ch_int \__exsheets_read_number:w #2 \q_stop \prop_get:NnNT \g__exsheets_solutions_names_prop - { #1 } \l__exsheets_tmpa_tl + {#1} \l__exsheets_tmpa_tl { \tl_set_eq:NN \l__exsheets_solutions_name_tl \l__exsheets_tmpa_tl \prop_get:NnN \g__exsheets_solutions_content_prop - { #1 } \l__exsheets_tmpb_tl + {#1} \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop - { #1 } \l__exsheets_tmpc_tl + {#1} \l__exsheets_tmpc_tl \prop_get:NnN \g__exsheets_solutions_counter_prop - { #1 } \l__exsheets_tmpd_tl + {#1} \l__exsheets_tmpd_tl \group_begin: \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpc_tl \__exsheets_sectioning_hook:nV { ch } @@ -2436,7 +2446,7 @@ \seq_new:N \l__exsheets_solutions_byID_seq \cs_new_protected:Npn \exsheets_print_solutions_byID:n #1 { - \seq_set_split:Nnn \l__exsheets_solutions_byID_seq { , } { #1 } + \seq_set_split:Nnn \l__exsheets_solutions_byID_seq { , } {#1} \seq_clear:N \l__exsheets_tmpa_seq \seq_map_inline:Nn \l__exsheets_solutions_byID_seq { @@ -2491,22 +2501,22 @@ \int_zero:N \l__exsheets_counter_ch_int \int_zero:N \l__exsheets_counter_sec_int \int_zero:N \l__exsheets_counter_qu_int - \tl_if_in:nnF { #1 } { @@@ } + \tl_if_in:nnF {#1} { @@@ } { - \tl_if_blank:nF { #1 } - { \int_set:Nn \l__exsheets_counter_ch_int { #1 } } + \tl_if_blank:nF {#1} + { \int_set:Nn \l__exsheets_counter_ch_int {#1} } } - \int_set:Nn \l__exsheets_counter_sec_int { #2 } - \int_set:Nn \l__exsheets_counter_qu_int { #3 } + \int_set:Nn \l__exsheets_counter_sec_int {#2} + \int_set:Nn \l__exsheets_counter_qu_int {#3} } \cs_new_protected_nopar:Npn \exsheets_solutions_print_name:nnn #1#2#3 { \tl_set_rescan:Nnn \l__exsheets_tmpa_tl - { \char_set_catcode_letter:N \@ } { #1 } - \tl_if_in:nnTF { #1 } { @@@ } - { \__exsheets_solutions_name:nnn { } { #2 } { #3 } } - { \__exsheets_solutions_name:nnn { #1 } { #2 } { #3 } } + { \char_set_catcode_letter:N \@ } {#1} + \tl_if_in:nnTF {#1} { @@@ } + { \__exsheets_solutions_name:nnn { } {#2} {#3} } + { \__exsheets_solutions_name:nnn {#1} { #2 } {#3} } \tex_penalty:D \c_ten_thousand } \cs_generate_variant:Nn \exsheets_solutions_print_name:nnn { VVV } @@ -2549,43 +2559,42 @@ % create question/solution pairs \cs_new_protected:Npn \__exsheets_new_qu_sol_pair:nnnnnn #1#2#3#4#5#6 { - \NewDocumentEnvironment { #1 } { O{}G{} } - { \keys_set:nn { exsheets } { #3 } \__exsheets_question: {#2,##1} {##2} } + \NewDocumentEnvironment {#1} { O{}G{} } + { \keys_set:nn {exsheets} {#3} \__exsheets_question: {#2,##1} {##2} } { \end__exsheets_question: } - \NewDocumentEnvironment { #4 } { O{} } - { \keys_set:nn { exsheets } { #6 } \__exsheets_solution: {#5,##1} } + \NewDocumentEnvironment {#4} { O{} } + { \keys_set:nn {exsheets} {#6} \__exsheets_solution: {#5,##1} } { \end__exsheets_solution: } } \cs_new_protected:Npn \__exsheets_renew_qu_sol_pair:nnnnnn #1#2#3#4#5#6 { - \RenewDocumentEnvironment { #1 } { O{}G{} } - { \keys_set:nn { exsheets } { #3 } \__exsheets_question: {#2,##1} {##2} } + \RenewDocumentEnvironment {#1} { O{}G{} } + { \keys_set:nn {exsheets} {#3} \__exsheets_question: {#2,##1} {##2} } { \end__exsheets_question: } - \RenewDocumentEnvironment { #4 } { O{} } - { \keys_set:nn { exsheets } { #6 } \__exsheets_solution: {#5,##1} } + \RenewDocumentEnvironment {#4} { O{} } + { \keys_set:nn {exsheets} {#6} \__exsheets_solution: {#5,##1} } { \end__exsheets_solution: } } \NewDocumentCommand \NewQuSolPair { mO{}O{}mO{}O{} } - { \__exsheets_new_qu_sol_pair:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { \__exsheets_new_qu_sol_pair:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} } \@onlypreamble \NewQuSolPair \NewDocumentCommand \RenewQuSolPair { mO{}O{}mO{}O{} } - { \__exsheets_renew_qu_sol_pair:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { \__exsheets_renew_qu_sol_pair:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} } \@onlypreamble \RenewQuSolPair % ---------------------------------------------------------------------------- % the `tasks' list -\bool_if:NTF \l__exsheets_load_tasks_bool - { \RequirePackage [ more ] { tasks } } - { \RequirePackage { tasks } } -\AddCounterPattern* [ tasks ] { question } { qu } -\ReadCounterFrom [ tasks ] { question } \l__exsheets_counter_qu_int +\RequirePackage {tasks} [2014/07/03] +\AddCounterPattern* [tasks] {question} {qu} +\ReadCounterFrom [tasks] {question} \l__exsheets_counter_qu_int % ---------------------------------------------------------------------------- % the \blank{} command -\RequirePackage { ulem } \normalem +\RequirePackage {ulem} \normalem + \dim_new:N \l__exsheets_blank_dim \tl_new:N \l__exsheets_blank_linespread_tl \tl_set:Nn \l__exsheets_blank_linespread_tl { 1 } @@ -2595,7 +2604,7 @@ \bool_new:N \l__exsheets_blank_width_bool \bool_new:N \l__exsheets_blank_linespread_bool -\cs_new:Npn \exsheets_write_blank:n #1 { #1 } +\cs_new:Npn \exsheets_write_blank:n #1 {#1} \cs_set_eq:NN \exsheets_write_blank:n \uline \keys_define:nn { exsheets / blank } @@ -2615,29 +2624,29 @@ width .code:n = { \bool_set_true:N \l__exsheets_blank_width_bool - \dim_set:Nn \l__exsheets_blank_dim { #1 } + \dim_set:Nn \l__exsheets_blank_dim {#1} } , linespread .code:n = \bool_set_true:N \l__exsheets_blank_linespread_bool - \tl_set:Nn \l__exsheets_blank_linespread_tl { #1 } + \tl_set:Nn \l__exsheets_blank_linespread_tl {#1} } \NewDocumentCommand \blank { som } { \group_begin: - \IfNoValueF { #2 } { \keys_set:nn { exsheets / blank } { #2 } } + \IfNoValueF {#2} { \keys_set:nn { exsheets / blank } {#2} } \mode_if_vertical:TF { - \IfBooleanF { #1 } { \noindent } - \exsheets_blank:n { #3 } - \IfBooleanF { #1 } + \IfBooleanF {#1} { \noindent } + \exsheets_blank:n {#3} + \IfBooleanF {#1} { \bool_if:NT \l__exsheets_blank_linespread_bool { \linespread { \l__exsheets_blank_linespread_tl } \selectfont } \par } } - { \exsheets_blank:n { #3 } } + { \exsheets_blank:n {#3} } \group_end: } @@ -2646,9 +2655,9 @@ \box_clear:N \l__exsheets_blank_box \mode_if_math:TF { \hbox_set:Nn \l__exsheets_blank_box { $ \m@th \mathpalette{}{#1} $ } } - { \hbox_set:Nn \l__exsheets_blank_box { #1 } } + { \hbox_set:Nn \l__exsheets_blank_box {#1} } \bool_if:NTF \l__exsheets_inside_solution_bool - { \exsheets_write_blank:n { #1 } } + { \exsheets_write_blank:n {#1} } { \bool_if:NTF \l__exsheets_blank_width_bool { \__exsheets_blank_skip:N \l__exsheets_blank_dim } @@ -2662,10 +2671,10 @@ \cs_new_protected:Npn \__exsheets_blank_skip:N #1 { \bool_if:NTF \l__exsheets_blank_width_bool - { \dim_set:Nn \l__exsheets_tmpa_dim { #1 } } + { \dim_set:Nn \l__exsheets_tmpa_dim {#1} } { \fp_set:Nn \l__exsheets_tmpa_fp - { \dim_to_fp:n { #1 } * \l__exsheets_blank_scale_tl } + { \dim_to_fp:n {#1} * \l__exsheets_blank_scale_tl } \dim_set:Nn \l__exsheets_tmpa_dim { \fp_to_dim:N \l__exsheets_tmpa_fp } } \dim_compare:nTF { \l__exsheets_tmpa_dim > 2em } @@ -2725,13 +2734,13 @@ { \par \tex_penalty:D -100 \scan_stop: - \dim_set:Nn \l__exsheets_tmpa_dim { #2 } + \dim_set:Nn \l__exsheets_tmpa_dim {#2} \dim_set:Nn \l__exsheets_tmpb_dim { \pagegoal - \pagetotal - \baselineskip } \dim_compare:nTF { \l__exsheets_tmpa_dim > \l__exsheets_tmpb_dim } { \dim_compare:nT { \l__exsheets_tmpb_dim > 0pt } { \vfil } \break - \IfBooleanF { #1 } + \IfBooleanF {#1} { \dim_sub:Nn \l__exsheets_tmpa_dim { \l__exsheets_tmpb_dim } \vspace* { \l__exsheets_tmpa_dim } @@ -2740,15 +2749,15 @@ { \skip_vertical:N \l__exsheets_tmpa_dim } } \NewDocumentCommand \examspace { sm } - { \__exsheets_examspace:nn { #1 } { #2 } } + { \__exsheets_examspace:nn {#1} {#2} } % ---------------------------------------------------------------------------- % SETUP \NewDocumentCommand \SetupExSheets { o +m } { - \IfNoValueTF { #1 } - { \keys_set:nn { exsheets } { #2 } } - { \keys_set:nn { exsheets / #1 } { #2 } } + \IfNoValueTF {#1} + { \keys_set:nn {exsheets} {#2} } + { \keys_set:nn { exsheets / #1 } {#2} } } % ---------------------------------------------------------------------------- @@ -2852,12 +2861,12 @@ % ---------------------------------------------------------------------------- % load custom configuration -\file_if_exist:nT { exsheets_configurations.cfg } +\file_if_exist:nT {exsheets_configurations.cfg} { \AtBeginDocument { - \msg_info:nn { exsheets } { loading-configurations } - \file_input:n { exsheets_configurations.cfg } + \msg_info:nn {exsheets} {loading-configurations} + \file_input:n {exsheets_configurations.cfg} } } @@ -3055,6 +3064,12 @@ HISTORY: - \ForEachQuestion, \numberofquestions and \iflastquestion are now available before any questions have been typeset +2014/07/20 v0.15 - remove `tasks' from the bundle and into a package of + its own + - remove `cntformats' from the bundle and into a package of + its own + - drop options `load-headings' and `load-tasks' + - new command \IfQuestionPropertyTF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg index 19f8ebfc137..058ac8f46e7 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg @@ -29,6 +29,8 @@ \ProvidesFile{exsheets_headings.cfg} [\exsheets@date\space v\exsheets@version\space ExSheets headings instances] +\cs_new:Npn \exsheets_headings_files_loaded: {} + % EMPTY: \DeclareInstance { exsheets-heading } { empty } { default } { diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index 770f8593248..83fe81bf4d1 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -378,7 +378,7 @@ \bool_if:nT { \l__exsheets_questions_totoc_bool && \l__exsheets_inside_question_bool } { - \phantomsection + \use:c {phantomsection} \addcontentsline { toc } { \l__exsheets_questions_toclevel_tl } { \bool_if:NTF \l__exsheets_heading_toc_reversed_bool @@ -389,7 +389,7 @@ \bool_if:nT { \l__exsheets_solutions_totoc_bool && !\l__exsheets_inside_question_bool } { - \phantomsection + \use:c {phantomsection} \addcontentsline { toc } { \l__exsheets_solutions_toclevel_tl } { \bool_if:NTF \l__exsheets_heading_toc_reversed_bool diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.cfg b/Master/texmf-dist/tex/latex/exsheets/tasks.cfg deleted file mode 100644 index 5ac789f91d0..00000000000 --- a/Master/texmf-dist/tex/latex/exsheets/tasks.cfg +++ /dev/null @@ -1,55 +0,0 @@ -% -------------------------------------------------------------------------- -% the TASKS package -% -% Horizontal columned lists. -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger -% -% 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 Clemens Niederberger. -% -------------------------------------------------------------------------- -% The tasks package consists of the files -% - tasks.sty, tasks.cfg -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -% further instances for the `tasks' environment -\ProvidesFile{tasks.cfg} - [\@tasks@date\space v\@tasks@version\space tasks instances] - -\cs_new:Npn \tasks_config_file_loaded: {} - -% ITEMIZE: -\DeclareInstance { tasks } { itemize } { default } - { - enumerate = false , - label-width = 1.125em - } - -% ENUMERATE: -\DeclareInstance { tasks } { enumerate } { default } - { counter-format = tsk. } - -% MULTIPLECHOICE -\DeclareInstance { tasks } { multiplechoice } { default } - { - enumerate = false , - label = \choicebox - } - -\tex_endinput:D \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.sty b/Master/texmf-dist/tex/latex/exsheets/tasks.sty deleted file mode 100644 index 8985933e0ad..00000000000 --- a/Master/texmf-dist/tex/latex/exsheets/tasks.sty +++ /dev/null @@ -1,601 +0,0 @@ -% -------------------------------------------------------------------------- -% the TASKS package -% -% Horizontal columned lists. -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2014 Clemens Niederberger -% -% 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 Clemens Niederberger. -% -------------------------------------------------------------------------- -% The tasks package consists of the files -% - tasks.sty, tasks.cfg -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\def\@tasks@date{2014/05/11} -\def\@tasks@version{0.9c} - -\RequirePackage { expl3 , xparse , l3keys2e } -\ProvidesExplPackage - {tasks} - {\@tasks@date} - {\@tasks@version} - {Horizontal columned lists.} - -% -------------------------------------------------------------------------- -% check expl3 version: -\@ifpackagelater { expl3 } { 2012/11/21 } - { } - { - \PackageError { tasks } { Support~package~expl3~too~old } - { - You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ - 'l3packages'.\MessageBreak - Loading~tasks~will~abort! - } - \tex_endinput:D - } - -% -------------------------------------------------------------------------- -% requirements: -\RequirePackage { epic , cntformats , xtemplate , environ } - -% -------------------------------------------------------------------------- -% variables: -\seq_new:N \l__tasks_seq - -\int_new:N \l__tasks_depth_int -\int_new:N \g__tasks_int -\int_new:N \g__tasks_total_items_int -\int_new:N \l__tasks_columns_int -\int_new:N \l__tasks_rows_int - -\bool_new:N \l__tasks_enumerate_bool -\bool_new:N \l__tasks_resume_bool -\bool_new:N \l__tasks_load_tasks_bool -\bool_new:N \l__tasks_label_width_bool -\bool_new:N \l__tasks_item_indent_bool -\bool_new:N \l__tasks_label_offset_bool -\bool_new:N \l__tasks_custom_label_bool -\bool_new:N \l__tasks_custom_after_item_skip_bool - -\tl_new:N \l__tasks_instance_tl -\tl_new:N \l__tasks_label_tl -\tl_new:N \l__tasks_custom_label_tl -\tl_new:N \l__tasks_label_pattern_tl -\tl_new:N \l__tasks_custom_label_pattern_tl -\tl_new:N \l__tasks_label_format_tl -\tl_new:N \l__tasks_custom_label_format_tl -\tl_new:N \l__tasks_item_fill_left_tl -\tl_new:N \l__tasks_item_fill_right_tl -\tl_new:N \l__tasks_label_align_tl -% \tl_new:N \task -\tl_new:N \l__tasks_item_tl -\tl_new:N \l__tasks_tmp_label_tl - -\dim_new:N \l__tasks_item_indent_dim -\dim_new:N \l__tasks_item_default_indent_dim -\dim_new:N \l__tasks_item_width_dim -\dim_new:N \l__tasks_label_width_dim -\dim_new:N \l__tasks_label_default_width_dim -\dim_new:N \l__tasks_label_offset_dim -\dim_new:N \l__tasks_label_default_offset_dim - -\skip_new:N \l__tasks_after_item_skip -\skip_new:N \l__tasks_custom_after_item_skip -\skip_new:N \l__tasks_before_list_skip -\skip_new:N \l__tasks_after_list_skip - -\NewCounterPattern* [ tasks ] { task } { tsk } -\ReadCounterFrom [ tasks ] { task } \g__tasks_int - -% temporary variables: -\tl_new:N \l__tasks_tmpa_tl -\int_new:N \g__tasks_tmpa_int -\int_new:N \l__tasks_tmpb_int -\coffin_new:N \l__tasks_tmpa_coffin -\coffin_new:N \l__tasks_tmpb_coffin -\coffin_new:N \l__tasks_tmpc_coffin - -\cs_new_eq:NN \__tasks_debug:n \use:n - -% -------------------------------------------------------------------------- -% collect the tasks: -\cs_new_protected:Npn \__tasks_collect_tasks:nw #1#2 \end #3 - { - \tl_put_right:Nn \l__tasks_body_tl { #1 } - \end { #3 } - \tl_if_eq:nnF { #1 } { #3 } - { \__tasks_collect_tasks:nw { #1 } } - } - -% #1: instance -% #2: number of columns -% #3: item separator -% #4: environment body -\cs_new_protected:Npn \__tasks:nnnn #1#2#3#4 - { - \seq_set_split:Nnn \l__tasks_seq { #3 } { #4 } - % remove the first (empty) item: - \seq_pop_left:NN \l__tasks_seq \l__tasks_tmpa_tl - \tl_if_blank:VF \l__tasks_tmpa_tl - { \tl_show:N \l__tasks_tmpa_tl \@noitemerr } - \int_gset:Nn \g__tasks_total_items_int - { \seq_count:N \l__tasks_seq } - \UseInstance { tasks } { #1 } - { \g__tasks_total_items_int } - { #2 } - { \l__tasks_custom_label_pattern_tl } - % just to be sure: - \seq_clear:N \l__tasks_seq - } -\cs_generate_variant:Nn \__tasks:nnnn { VnnV } - -\cs_new_protected:Npn \__tasks_task:nnw #1#2[#3,#4][#5,#6](#7,#8) - { - \dim_set:Nn \l__tasks_item_width_dim - { - \linewidth / \l__tasks_columns_int - - \l__tasks_depth_int \l__tasks_item_indent_dim - } - \int_gincr:N \g__tasks_tmpa_int - \__tasks_gset_rows_num:NN - \g__tasks_total_items_int - \l__tasks_columns_int - \int_compare:nT { \g__tasks_tmpa_int > \l__tasks_columns_int } - { - \int_gset:Nn \g__tasks_tmpa_int { 1 } - \int_incr:N \l__tasks_tmpb_int - } - % the item: - \hcoffin_set:Nn \l__tasks_tmpa_coffin - { - \vcoffin_set:Nnn \l__tasks_tmpc_coffin - { \l__tasks_item_width_dim } - { \__tasks_setup: #2 } - \coffin_typeset:Nnnnn \l__tasks_tmpc_coffin - { l } { T } { 0pt } { 0pt } - } - % the label: - \hcoffin_set:Nn \l__tasks_tmpb_coffin - { - \vcoffin_set:Nnn \l__tasks_tmpc_coffin - { \l__tasks_label_width_dim } - { - \noindent - \tl_use:N \l__tasks_item_fill_left_tl - \strut #1 - \tl_use:N \l__tasks_item_fill_right_tl - } - \__tasks_debug:n - { - \coffin_typeset:Nnnnn \l__tasks_tmpc_coffin - { l } { T } { 0pt } { 0pt } - } - } - \coffin_attach:NnnNnnnn - \l__tasks_tmpa_coffin { l } { T } - \l__tasks_tmpb_coffin { l } { T } - { - \l__tasks_label_width_dim - \l__tasks_label_offset_dim } { 0pt } - % typeset label & item: - % need this when a new row starts: - \int_compare:nT { \g__tasks_tmpa_int = 1 } - { \skip_vertical:N \c_zero_skip } - \noindent - \skip_horizontal:N \l__tasks_item_indent_dim - \__tasks_debug:n - { - \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin - { l } { T } { 0pt } { 0pt } - } - % need this before a new row starts: - \bool_if:nT - { - ( \int_compare_p:n { \g__tasks_tmpa_int = \l__tasks_columns_int } ) - && - ( \int_compare_p:n { \l__tasks_tmpb_int != \l__tasks_rows_int } ) - } - { \skip_vertical:N \l__tasks_after_item_skip } - \coffin_clear:N \l__tasks_tmpa_coffin - \coffin_clear:N \l__tasks_tmpb_coffin - \coffin_clear:N \l__tasks_tmpc_coffin - } -\cs_generate_variant:Nn \__tasks_task:nnw { VV } - -\cs_new_protected:Npn \__tasks_setup: - { - \dim_set:Nn \parskip { 0pt } - \skip_set:Nn \parfillskip { 0pt plus 1fil } - \dim_set_eq:NN \parskip \parsep - \dim_set_eq:NN \parindent \listparindent - \noindent - \strut - } - -\cs_new_protected:Npn \__tasks_gset_rows_num:NN #1#2 - { - \int_gset:Nn \l__tasks_rows_int { \int_div_truncate:nn { #1 } { #2 } } - \int_compare:nNnT { \int_mod:nn { #1 } { #2 } } > { 0 } - { \int_gincr:N \l__tasks_rows_int } - } - -\cs_new_protected:Npn \__tasks_label_align:n #1 - { - \clist_if_in:nnTF { left , center , right } { #1 } - { - \tl_if_eq:nnT { #1 } { left } - { - \tl_clear:N \l__tasks_item_fill_left_tl - \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill - } - \tl_if_eq:nnT { #1 } { right } - { - \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill - \tl_clear:N \l__tasks_item_fill_right_tl - } - \tl_if_eq:nnT { #1 } { center } - { - \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill - \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill - } - } - { - \tl_clear:N \l__tasks_item_fill_left_tl - \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill - } - } -\cs_generate_variant:Nn \__tasks_label_align:n { V } -\__tasks_label_align:n { left } - -% -------------------------------------------------------------------------- -% the `tasks' object: -% #1: number of items -% #2: number of columns -% #3: label-format -\DeclareObjectType { tasks } { 3 } -% the `default' template interface: -\DeclareTemplateInterface { tasks } { default } { 3 } - { - enumerate : boolean = true , - label : tokenlist , - indent : length = 2.5em , - counter-format : tokenlist = tsk[a]) , - label-format : tokenlist , - label-width : length = 1em , - label-offset : length = .3333em , - after-item-skip : skip = 1ex plus 1ex minus 1ex - } - -% in the next three commands we want a really unlikely to occurr marker; for -% this we use $ with unusual catcode in ``$tasks$default$label$'': -\char_set_catcode_alignment:N \$ - -% the `default' template code: -\DeclareTemplateCode { tasks } { default } { 3 } - { - enumerate = \l__tasks_enumerate_bool , - label = \l__tasks_label_tl , - indent = \l__tasks_item_default_indent_dim , - counter-format = \l__tasks_label_pattern_tl , - label-format = \l__tasks_label_format_tl , - label-width = \l__tasks_label_default_width_dim , - label-offset = \l__tasks_label_default_offset_dim , - after-item-skip = \l__tasks_after_item_skip - } - { - \AssignTemplateKeys - \bool_if:NF \l__tasks_label_width_bool - { - \dim_set_eq:NN - \l__tasks_label_width_dim - \l__tasks_label_default_width_dim - } - \bool_if:NF \l__tasks_item_indent_bool - { - \dim_set_eq:NN - \l__tasks_item_indent_dim - \l__tasks_item_default_indent_dim - } - \bool_if:NF \l__tasks_label_offset_bool - { - \dim_set_eq:NN - \l__tasks_label_offset_dim - \l__tasks_label_default_offset_dim - } - \bool_if:NT \l__tasks_custom_after_item_skip_bool - { - \skip_set_eq:NN - \l__tasks_after_item_skip - \l__tasks_custom_after_item_skip - } - \bool_if:NT \l__tasks_custom_label_bool - { - \tl_set_eq:NN - \l__tasks_label_tl - \l__tasks_custom_label_tl - \bool_set_false:N \l__tasks_enumerate_bool - } - \__tasks_label_align:V \l__tasks_label_align_tl - % need this for enumerate list: - \bool_if:nT { !\l__tasks_resume_bool && \l__tasks_enumerate_bool } - { \int_gzero:N \g__tasks_int } - \int_set:Nn \l__tasks_columns_int { #2 } - % set all the items in their own coffins and join with the ground: - \int_gzero:N \g__tasks_tmpa_int - \int_set:Nn \l__tasks_tmpb_int { 1 } - \tl_if_blank:VF \l__tasks_custom_label_pattern_tl - { - \tl_set_eq:NN - \l__tasks_label_pattern_tl - \l__tasks_custom_label_pattern_tl - } - \tl_if_blank:VF \l__tasks_custom_label_format_tl - { - \tl_set_eq:NN - \l__tasks_label_format_tl - \l__tasks_custom_label_format_tl - } - \seq_map_inline:Nn \l__tasks_seq - { - \__tasks_read_item:w ##1 \q_stop - \bool_if:NTF \l__tasks_enumerate_bool - { - \tl_if_eq:VnT \l__tasks_tmp_label_tl { $tasks$default$label$ } - { - \int_gincr:N \g__tasks_int - \SaveCounterPatternFrom [ tasks ] - \l__tasks_tmpa_tl - \l__tasks_label_tl - \l__tasks_label_pattern_tl - \cs_gset:Npx \@currentlabel { \l__tasks_label_tl } - } - } - { - \tl_if_blank:VT \l__tasks_label_tl - { \tl_set_eq:NN \l__tasks_label_tl \labelitemi } - } - \tl_put_left:NV \l__tasks_label_tl \l__tasks_label_format_tl - \tl_if_eq:VnTF \l__tasks_tmp_label_tl { $tasks$default$label$ } - { - \__tasks_task:VVw - \l__tasks_label_tl - \l__tasks_item_tl - [ l , b ] [ l , t ] ( 0pt , 0pt ) - } - { - \__tasks_task:VVw - \l__tasks_tmp_label_tl - \l__tasks_item_tl - [ l , b ] [ l , t ] ( 0pt , 0pt ) - \tl_clear:N \l__tasks_tmp_label_tl - } - } - } -\cs_generate_variant:Nn \tl_if_eq:nnTF { V } -\cs_generate_variant:Nn \tl_if_eq:nnT { V } - -\cs_new:Npn \__tasks_read_item:w - { - \peek_meaning:NTF [ - { \__tasks_read_item_aux:w } - { \__tasks_read_item_aux:w[$tasks$default$label$] } - } - -\cs_new_protected:Npn \__tasks_read_item_aux:w [#1]#2 \q_stop - { - \tl_set:Nn \l__tasks_tmp_label_tl { #1 } - \tl_if_eq:nnF { #1 } { $tasks$default$label$ } - { \tl_put_left:NV \l__tasks_tmp_label_tl \l__tasks_label_format_tl } - \tl_set:Nn \l__tasks_item_tl { \ignorespaces #2 } - } - -\char_set_catcode_math_toggle:N \$ - -% -------------------------------------------------------------------------- -% choice box: -\bool_new:N \l__tasks_choice_checked_bool -\dim_new:N \l__tasks_choice_width_dim -\dim_set:Nn \l__tasks_choice_width_dim { 1.25ex } -\dim_new:N \l__tasks_choice_linewidth_dim -\dim_set:Nn \l__tasks_choice_linewidth_dim { .3pt } -\dim_new:N \l__tasks_choice_checkwidth_dim -\dim_set:Nn \l__tasks_choice_checkwidth_dim { .5pt } -\dim_new:N \l__tasks_choice_raise_dim -\dim_set:Nn \l__tasks_choice_raise_dim { .1ex } - -\cs_new_protected:Npn \tasks_choice: - { - \leavevmode - \group_begin: - \bool_set_false:N \l__tasks_choice_checked_bool - \box_move_up:nn - { \l__tasks_choice_raise_dim } - { \hbox:n { \__tasks_choice: } } - \group_end: - } - -\cs_new_protected:Npn \tasks_choice_checked: - { - \leavevmode - \group_begin: - \bool_set_true:N \l__tasks_choice_checked_bool - \box_move_up:nn - { \l__tasks_choice_raise_dim } - { \hbox:n { \__tasks_choice: } } - \group_end: - } - -\cs_new_protected:Npn \__tasks_choice: - {% - \dim_set:Nn \unitlength { .1\l__tasks_choice_width_dim } - \begin{picture}(10,0) - \linethickness \l__tasks_choice_linewidth_dim - \drawline(0,0)(0,10)(10,10)(10,0)(0,0) - \linethickness \l__tasks_choice_checkwidth_dim - \bool_if:NT \l__tasks_choice_checked_bool - { - \drawline(2,2)(8,8) - \drawline(2,8)(8,2) - } - \end{picture}% - } - -\providecommand* \choicebox { \tasks_choice: } -\providecommand* \checkedchoicebox { \tasks_choice_checked: } - -% -------------------------------------------------------------------------- -% base instance: -% ALPHABETIZE: a) b) c) -\DeclareInstance { tasks } { alphabetize } { default } { } - -\keys_define:nn { tasks / list } - { - style .tl_set:N = \l__tasks_instance_tl , - counter-format .tl_set:N = \l__tasks_custom_label_pattern_tl , - label .code:n = - \bool_set_true:N \l__tasks_custom_label_bool - \tl_set:Nn \l__tasks_custom_label_tl { #1 } , - label-format .tl_set:N = \l__tasks_custom_label_format_tl , - label-width .code:n = - \dim_set:Nn \l__tasks_label_width_dim { #1 } - \bool_set_true:N \l__tasks_label_width_bool , - label-offset .code:n = - \dim_set:Nn \l__tasks_label_offset_dim { #1 } - \bool_set_true:N \l__tasks_label_offset_bool , - label-align .tl_set:N = \l__tasks_label_align_tl , - item-indent .code:n = - \dim_set:Nn \l__tasks_item_indent_dim { #1 } - \bool_set_true:N \l__tasks_item_indent_bool , - before-skip .skip_set:N = \l__tasks_before_list_skip , - after-skip .skip_set:N = \l__tasks_after_list_skip , - after-item-skip .code:n = - \bool_set_true:N \l__tasks_custom_after_item_skip_bool - \skip_set:Nn \l__tasks_custom_after_item_skip { #1 } , - resume .bool_set:N = \l__tasks_resume_bool - } - -% -------------------------------------------------------------------------- -% the generic environment: -\NewEnviron { __tasks_env: } [ 3 ] - { - \keys_set:nn { tasks / list } { #2 } - \tl_if_blank:VT \l__tasks_instance_tl - { \keys_set:nn { tasks / list } { style = alphabetize } } - \skip_vertical:N \l__tasks_before_list_skip - \skip_vertical:N \c_zero_skip - \list {} - { - \dim_set:Nn \leftmargin { 0pt } - \dim_set:Nn \rightmargin { 0pt } - } - \item \scan_stop: - \int_incr:N \l__tasks_depth_int - \__tasks:VnnV \l__tasks_instance_tl { #3 } { #1 } \BODY - \endlist - \skip_vertical:N \l__tasks_after_list_skip - } - -% -------------------------------------------------------------------------- -% command to start a new row: -\cs_new_protected:Npn \tasks_new_row: - { - \int_gset:Nn \g__tasks_total_items_int - { \g__tasks_total_items_int + \l__tasks_columns_int - \g__tasks_tmpa_int } - \__tasks_gset_rows_num:NN - \g__tasks_total_items_int - \l__tasks_columns_int - \int_gset_eq:NN \g__tasks_tmpa_int \l__tasks_columns_int - } - -\NewDocumentCommand \startnewitemline {} - { \tasks_new_row: } - -% -------------------------------------------------------------------------- -% the user environment: -\NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} } - { - \NewDocumentEnvironment { #2 } { O{}D(){#4} } - { \__tasks_env: { #3 } { #1,##1 } { ##2 } } - { \end__tasks_env: } - } - -\NewDocumentCommand \RenewTasks { O{}mO{\task}D(){1} } - { - \RenewDocumentEnvironment { #2 } { O{}D(){#4} } - { \__tasks_env: { #3 } { #1,##1 } { ##2 } } - { \end__tasks_env: } - } - -% -------------------------------------------------------------------------- -% default list: -\NewTasks { tasks } - -% -------------------------------------------------------------------------- -% package options: -\keys_define:nn { tasks / options } - { - more .bool_set:N = \l__tasks_load_tasks_bool - } - -\ProcessKeysOptions { tasks / options } - -\bool_if:NT \l__tasks_load_tasks_bool - { - \cs_if_exist:NF \tasks_config_file_loaded: - { \input { tasks.cfg } } - } - -% -------------------------------------------------------------------------- -% setup: -\cs_new_protected:Npn \tasks_setup:n #1 - { \keys_set:nn { tasks / list } { #1 } } - -\NewDocumentCommand \settasks { m } - { \tasks_setup:n { #1 } } - -% -------------------------------------------------------------------------- -\tex_endinput:D - -% HISTORY: -2013/01/19 v0.7 - extracted from `exsheets' package; this also lead to a - slightly new syntax and a few new options for it -2013/04/04 v0.8a - corrected \seq_length:N => \seq_count:N -2013/04/07 v0.9 - protected internal commands where appropriate - - made enumerated item referenceable with \label{} - and \ref{}; this introduced new options: - * the former `label-format' is now `counter-format' - * new: `label-format' - - changed defaults for `label-width' and `label-offset' - - ensure that the `after-item-skip' is only - inserted in between rows - - new option `after-item-skip' - - improvements when label are set with optional argument: - * a provided but empty argument is now correctly recognized - * the counter is _not_ stepped anymore for enumerated - lists when the optional argument is provided - - new command \startnewitemline that forces the next item to - be put at the beginning of a row -2013/04/22 v0.9a - new option `item-indent' - - synchronized version number with `exsheets' until now but - won't any more -2013/12/03 v0.9b - add missing \noindent for the case when \listparindent is - non-zero, fixes http://tex.stackexchange.com/q/148082/5049 -2014/05/11 v0.9c - remove definition of the \task macro: it is not necessary - for `tasks' to function but it conflicts e.g. with `ltxdoc' - class -- cgit v1.2.3