diff options
author | Karl Berry <karl@freefriends.org> | 2013-10-25 21:58:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-10-25 21:58:37 +0000 |
commit | 478b4d04587698beca915fbed7329dbb77f6fde1 (patch) | |
tree | 75afc01d98227e70137d39cea3127343c205ef8b | |
parent | dff6d5d76d6ad664ee2dced8151b59ec3c0ac021 (diff) |
exsheets (25oct13)
git-svn-id: svn://tug.org/texlive/trunk@31997 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/README | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf | bin | 423275 -> 416464 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex | 555 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf | bin | 638882 -> 690202 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex | 2592 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf | bin | 430673 -> 443041 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exsheets/tasks_en.tex | 783 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/cntformats.sty | 241 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty | 146 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 230 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg | 66 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def | 145 |
12 files changed, 2407 insertions, 2363 deletions
diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README index c679481cec6..8869c5c2001 100644 --- a/Master/texmf-dist/doc/latex/exsheets/README +++ b/Master/texmf-dist/doc/latex/exsheets/README @@ -1,14 +1,15 @@ -------------------------------------------------------------------------- -EXSHEETS 2013/06/28 +EXSHEETS 2013/10/24 bundled packages: -the EXSHEETS package v0.9h +the EXSHEETS package v0.10 Yet another package for the creation of exercise sheets -the CNTFORMATS package v0.5 +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.9d Horizontal columned lists. -All mentioned packages are described in exsheets_en.pdf -------------------------------------------------------------------------- Clemens Niederberger Web: https://bitbucket.org/cgnieder/exsheets/ @@ -29,7 +30,8 @@ This work has the LPPL maintenance status `maintained'. The Current Maintainer of this work is Clemens Niederberger. -------------------------------------------------------------------------- The exsheets bundle consists of the files - - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg, + - exsheets.sty, exsheets-listings.sty, + exsheets_headings.def, exsheets_headings.cfg, exsheets_configurations.cfg, exsheets_en.tex, exsheets_en.pdf diff --git a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf Binary files differindex 8af9557974d..bcb1bc621b0 100644 --- a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf +++ b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf diff --git a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex index 98a1605aa48..8fa6ed82b38 100644 --- a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex @@ -1,11 +1,11 @@ % arara: pdflatex -% arara: biber -% arara: pdflatex +% !arara: biber +% !arara: pdflatex % arara: pdflatex % -------------------------------------------------------------------------- -% the TRANSLATIONS package +% the CNTFORMATS package % -% +% A different way to read counters % % -------------------------------------------------------------------------- % Clemens Niederberger @@ -31,94 +31,50 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -% -% if you want to compile this documentation you'll need the document class -% `cnpkgdoc' which you can get here: -% https://bitbucket.org/cgnieder/cnpkgdoc/ -% the class is licensed LPPL 1.3 or later -% -% use `pdflatex' and `biber' for compilation -% -\PassOptionsToPackage{supstfm=libertinesups}{superiors} -\documentclass[toc=index,toc=bib,numbers=noendperiod]{cnpkgdoc} -% ---------------------------------------------------------------------------- -% document layout and typographic features -\docsetup{ - pkg = {cntformats} , +\documentclass[load-preamble+]{cnltx-doc} +\usepackage{cntformats} + +\setcnltx{ + package = {cntformats} , + authors = Clemens Niederberger , + email = {contact@mychemistry.eu} , url = {https://bitbucket.org/cgnieder/exsheets/} , - subtitle = {{\small part of the \href{exsheets_en.pdf}{\ExSheets} bundle}\\[\baselineskip]a different way to read counters} , - language = en , - modules = true , - code-box = { - backgroundcolor = gray!7!white , - skipbelow = .6\baselineskip plus .5ex minus .5ex , - skipabove = .6\baselineskip plus .5ex minus .5ex + info = {% + {\small part of the \href{exsheets_en.pdf}{\ExSheets} + bundle}\\[\baselineskip] + a different way to read counters% } , - gobble = 1 + 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 + } } -\usepackage{libertinehologopatch} -\cnpkgusecolorscheme{friendly} + +\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{microtype} -\usepackage[multiple]{fnpct} - -\renewcommand*\othersectionlevelsformat[3]{\textcolor{main}{#3\autodot}\enskip} -\renewcommand*\partformat{\textcolor{main}{\partname~\thepart\autodot}} - -\pagestyle{headings} - -\setcapindent{1.5em} -\setkomafont{caption}{\normalfont\footnotesize\sffamily} -\setkomafont{captionlabel}{\normalfont\footnotesize\sffamily\scshape} \usepackage{booktabs,array,ragged2e} - -% ---------------------------------------------------------------------------- -% code examples -\addcmds{ - @cntfmts@parsed@pattern, AddCounterPattern, alphalph, - cs, eSaveCounterPattern, ExplSyntaxOff, ExplSyntaxOn, int, - myoddnumber, NewCounterPattern, NewPatternFormat, numexpr, ordinalnum, - ReadCounterFrom, ReadCounterPattern, ReadCounterPatternFrom, relax, - SaveCounterPattern, somesetupcommand, - tmpa, tmpb, the -} - -% ---------------------------------------------------------------------------- -% 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{imakeidx} -\begin{filecontents*}{\jobname.ist} - heading_prefix "{\\bfseries " - heading_suffix "\\hfil}\\nopagebreak\n" - headings_flag 1 - delim_0 "\\dotfill\\hyperpage{" - delim_1 "\\dotfill\\hyperpage{" - delim_2 "\\dotfill\\hyperpage{" - delim_r "}\\textendash\\hyperpage{" - delim_t "}" - suffix_2p "\\nohyperpage{\\,f.}" - suffix_3p "\\nohyperpage{\\,ff.}" -\end{filecontents*} -\indexsetup{othercode=\footnotesize} -\makeindex[options={-s \jobname.ist},intoc,columns=3,columnsep=1em] - -\usepackage{csquotes} -\usepackage[backend=biber,style=alphabetic]{biblatex} - +\usepackage{subcaption} % ---------------------------------------------------------------------------- % example definitions that have to be done in the preamble: @@ -130,278 +86,225 @@ \NewPatternFormat{x}{\myoddnumber} \NewCounterPattern{testa}{ta} -% ---------------------------------------------------------------------------- -% custom commands -\newcommand*\ExSheets{{\scshape\textcolor{main}{ExSheets}}\xspace} - -\newcommand*\Default[1]{% - \hfill\llap - {% - \ifblank{#1}% - {(initially~empty)}% - {Default:~\code{#1}}% - }% - \newline -} -\newcommand*\required{\hfill\llap{required}\newline} -\newcommand*\optional{\hfill\llap{optional}\newline} - -\newcommand*\nooption[2]{\item[\code{\textcolor{key}{#1} = #2}] \cnpkgdocarrow\ } - -\newcommand*\unexpsign{$\RHD$} -\newcommand*\expsign{\textcolor{red}{$\rhd$}} -\renewcommand*\cnpkgdoctriangle{\unexpsign} -\newcommand*\expandable{% - \def\cnpkgdoctriangle{% - \expsign - \gdef\cnpkgdoctriangle{\unexpsign}}} - -\usepackage{marginnote} -\makeatletter -\newcommand*\sinceversion[1]{% - \@bsphack - \marginnote{% - \footnotesize\sffamily\RaggedRight - \textcolor{black!75}{Introduced in version~#1}}% - \@esphack} -\newcommand*\changedversion[1]{% - \@bsphack - \marginnote{% - \footnotesize\sffamily\RaggedRight - \textcolor{black!75}{Changed in version~#1}}% - \@esphack} -\makeatother - -\pdfstringdefDisableCommands{\def\llap#1{#1\space}\def\bigstar{*}} - -% ---------------------------------------------------------------------------- -% title page -% \TitlePicture{% -% \parbox{.8\linewidth}{% -% }% -% } - \begin{document} -\section{Motivation}\secidx{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 \cmd*{the<counter>} nor is it affected by the redefinition of them. +\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 +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. Anyway, here we are. -\secidx*{Motivation} +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}\secidx{Requirements} -\cntformats is placed under the terms of the \LaTeX{} Project Public License, -version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). It has the -status ``maintained.'' +\section{License and Requirements}\label{sec:license} +\license -\cntformats requires the \paket{etoolbox} package. -\secidx*{Requirements} +\cntformats\ requires the \needpackage{etoolbox} package~\cite{pkg:etoolbox} +and the \pkg*{cnltx-base}\footnote{\CTANurl{cnltx}} package~\cite{bnd:cnltx}. -\section{Example}\secidx{Example} +\section{Example} A use case typically looks as follows: -\begin{beispiel} - \ReadCounterPattern{se.sse} -\end{beispiel} -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{beispiel} - \stepcounter{subsection} - \ReadCounterPattern{se[A](sse[r])} -\end{beispiel} -\code{A} stands for \cmd{Alph} and \code{r} for \cmd{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{beispiel} - \ReadCounterPattern{{se[A](sse[r])}} -\end{beispiel} - -I would imagine that the argument to \cmd{ReadCounterPattern} is usually +\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{beispiel}[code only] - \somesetupcommand{ - counter-format = se[A](sse[r]) - } -\end{beispiel} +\begin{sourcecode} + \somesetupcommand{ + counter-format = se[A](sse[r]) + } +\end{sourcecode} \ldots{} and then internally used by the corresponding package or class. -\secidx*{Example} -\section{Usage}\secidx{Usage} -In the following description of the available commands the symbol \expsign{} -means that the command is expandable, \unexpsign{} means that it isn't. -In order to make counters known to \cntformats the following commands are used: -\begin{beschreibung} - \Befehl{AddCounterPattern}*[<module>]{<counter>}\ma{<pattern>}\newline - This command will make the (existing) counter \code{<counter>} known to - \cntformats and assign the pattern \code{<pattern>} to it. - \Befehl{NewCounterPattern}*[<module>]{<counter>}\ma{<pattern>}\newline - This command will create a new counter \code{<counter>}, make it known to - \cntformats and assign the pattern \code{<pattern>} to it. - \Befehl{ReadCounterFrom}[<module>]{<counter>}\ma{<internal cmd>}\newline - If you use one of the commands above with the starred version the number for - the pattern is not automatically fetched from the internal \cmd*{c@<counter>}. - This can now be assigned with \cmd{ReadCounterFrom} where \code{<internal cmd>} - is the macro that holds the number. -\end{beschreibung} +\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{beschreibung} - \Befehl{ReadCounterPattern}[<module>]{<pattern>}\newline - Reads, interprets and prints a pattern. - \expandable\Befehl{@cntfmts@parsed@pattern}\newline - After \cmd{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. - \Befehl{ReadCounterPatternFrom}[<module>]{<macro that holds pattern>}\newline - Reads, interprets and prints a pattern that's stored in a macro.\\ - Otherwise the same as \cmd{ReadCounterPattern}. - \Befehl{SaveCounterPattern}{<cmd a>}\ma{<cmd b>}\ma{<pattern>}\newline - Saves the \code{<pattern>} in \code{<cmd a>} and the interpreted pattern in - \code{<cmd b>}. - \Befehl{eSaveCounterPattern}[<module>]{<cmd a>}\ma{<cmd b>}\ma{<pattern>}\newline - Saves the \code{<pattern>} in \code{<cmd a>} and the expanded pattern in - \code{<cmd b>}. - \Befehl{SaveCounterPatternFrom}[<module>]{<cmd a>}\ma{<cmd b>}\ma{<macro that - holds pattern>}\newline - Like \cmd{SaveCounterPattern} but reads the pattern from a macro. - \Befehl{eSaveCounterPatternFrom}[<module>]{<cmd a>}\ma{<cmd b>}\ma{<macro that - holds pattern>}\newline - Like \cmd{eSaveCounterPattern} but reads the pattern from a macro. -\end{beschreibung} - -The optional argument \code{<module>} should be specific for a package, say, so +\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. +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}. +The \ExSheets\ packages uses the commands with the module \code{exsheets}. You can find the following lines in \ExSheets' code: -\begin{beispiel}[code only] - \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{beispiel} +\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{beispiel} - % 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{beispiel} -You can see that somehow additional (empty) groups and a \cmd*{relax} found their -way into the interpreted and thus the expanded pattern. This is due to the fact -that reading optional arguments expandably isn't easy and must have some safety -net. -\secidx*{Usage} - -\section{Predefined and New Patterns and Format Keys}\secidx{Predefined Patterns} +\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 +\cntformats\ predefines a number of pattern keys. These are listed in table~\ref{tab:predefined:patterns}. -\begin{multicols}{2} -\begin{center} - \centering - \captionof{table}{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} - - \captionof{table}{Predefined Format Keys}\label{tab:predefined:formats} - \begin{tabular}{>{\ttfamily}ll} - \toprule - \normalfont\bfseries key & \normalfont\bfseries format \\ - \midrule - 1 & \cmd{arabic} \\ - a & \cmd{alph} \\ - A & \cmd{Alph} \\ - r & \cmd{roman} \\ - R & \cmd{Roman} \\ - \bottomrule - \end{tabular} -\end{center} -\end{multicols} - \subsection{New Patterns and Format Keys} -Table~\ref{tab:predefined:formats} lists the predefined formats. If you want you -can add own formats. -\begin{beschreibung} - \Befehl{NewPatternFormat}{<pattern>}\ma{<format>}\newline - \code{<format>} is a number presentation command like \cmd{@alph}, \textit{i.e.}, - it needs a mandatory argument that takes a number. It is used in \code{<format>} - \emph{without} its argument. This command can only be used in the preamble. -\end{beschreibung} +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{beispiel}[code only] - \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{beispiel} - -Then we can use the new pattern and the new formats as follows:\setcounter{testa}{4} -\begin{beispiel} - \ReadCounterPattern{ta[aa]} - \ReadCounterPattern{ta[o]} - \ReadCounterPattern{ta[x]} -\end{beispiel} -\secidx*{Predefined Patterns} - -\section{Implementation} -In the following code the lines 1--30 have been omitted. They only repeat the -license statement which has already been mentioned in section~\ref{sec:license}. - -\implementation[linerange={31-1000},firstnumber=31] - -\indexprologue{\noindent Section titles are indicated \textbf{bold}, packages -\textsf{sans serif}, commands \code{\textbackslash\textcolor{code}{brown}} - and options \textcolor{key}{\code{yellow}}.\par\bigskip} - -\printindex - -\end{document}
\ No newline at end of file +\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 Binary files differindex 43e3d50d569..ac91edfbcfc 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex index 338a78b0912..547d7257865 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex @@ -1,6 +1,7 @@ % arara: pdflatex % !arara: biber % !arara: pdflatex +% !arara: pdflatex % arara: pdflatex % -------------------------------------------------------------------------- % the EXSHEETS package @@ -26,119 +27,137 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -% The exsheets bundle consists of the files -% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg, -% 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 % feel free to contact me. % -------------------------------------------------------------------------- -% -% if you want to compile this documentation you'll need the document class -% `cnpkgdoc' which you can get here: -% https://bitbucket.org/cgnieder/cnpkgdoc/ -% the class is licensed LPPL 1.3 or later -% -% use `pdflatex' and `biber' for compilation -% -\PassOptionsToPackage{supstfm=libertinesups}{superiors} -\documentclass[DIV10,toc=index,toc=bib,numbers=noendperiod]{cnpkgdoc} -% ---------------------------------------------------------------------------- -% document layout and typographic features -\docsetup{ - pkg = {[load-headings,load-tasks]exsheets} , +\documentclass[load-preamble+,scrartcl={DIV10}]{cnltx-doc} +\usepackage[load-headings,load-tasks]{exsheets} +\setcnltx{ + package = {exsheets} , + authors = Clemens Niederberger , + email = contact@mychemistry.eu , url = {https://bitbucket.org/cgnieder/exsheets/} , - title = the ExSheets bundle , - subtitle = {% - the packages \ExSheets, \href{tasks_en.pdf}{\Tasks} and + title = the \ExSheets\ bundle , + info = {% + the packages \ExSheets, \ExSheetslistings, \href{tasks_en.pdf}{\Tasks} and \href{cntformats_en.pdf}{\cntformats}\\ \emph{or}\\ Yet another package for the creation of exercise sheets and exams.% } , - name = ExSheets , - language = en , - modules = true , - code-box = { - backgroundcolor = gray!7!white , - skipbelow = .6\baselineskip plus .5ex minus .5ex , - skipabove = .6\baselineskip plus .5ex minus .5ex , - innerleftmargin = 1.5em , - innerrightmargin = 2.5em + module-sep = {\,>>\,} , + index-setup = { othercode=\footnotesize,level=\section} , + abstract = {% + \ExSheets\ provides means to create exercises or questions and their + corresponding solutions. The questions can be divided into classes and + can be printed selectively. Meta-data to questions can be added and + recovered. + \par + The solutions may be printed where they are, can be collected and printed + at a later point in the document alltogether or section-wise or + selectively by \acs{id}.\par + \ExSheets\ provides a comprehensive interface for styling the headings of + questions and solutions.% + } , + add-cmds = { + % exsheets: + addpoints, + blank, + C, + checkedchoicebox,choice,choicebox, + correct, + DebugExSheets, + DeclareQuestionClass,DeclareQuestionProperty, + examspace, + exlabel, + ForEachQuestion, + GetQuestionProperty, + grade, + includequestions,iflastquestion, + lastvariant, + NewQuSolPair,NewLstQuSolPair, + numberofquestions, + points,pointssum, + PrintIfIncludeActiveF,PrintIfIncludeActiveT,PrintIfIncludeActiveTF, + printsolutions, + PrintSolutionsF,PrintSolutionsTF,PrintSolutionsT, + questionsincludedlast,QuestionNumber,RenewQuSolPair, + S, + SetQuestionProperties, + SetupExSheets, + SetVariations, + startnewitemline, + sumpoints, + totalpoints, + variant,vary, + % cntformats: + @cntfmts@parsed@pattern, + AddCounterPattern, + eSaveCounterPattern, + NewCounterPattern, + ReadCounterFrom, + ReadCounterPattern,ReadCounterPatternFrom, + SaveCounterPattern, + % tasks: + NewTasks, + settasks, + task } , - gobble = 1 + add-envs = { + question, + solution, + tasks + } , + add-silent-cmds = { + acs, + bigstar,bottomrule, + citetitle,cs,color, + DeclareInstance,DeclareTemplateInterface, + endspacing, + keyis, + leftthumbsup, + midrule, + rightarrow,rlap, + s,sample,setlength, + spacing,square, + tabcolsep, + textcite, + textcolor, + tmpa,tmpb, + toprule + } } -\makeatletter -\edef\cntfmtsversion{\@cntfmts@version} -\edef\tasksversion{v\@tasks@version} -\makeatother +\usepackage{exsheets-listings} + +\edef\exsheetslistingsverion{v\csname exsheets@listings@version\endcsname} +\edef\cntfmtsversion{\csname @cntfmts@version\endcsname} +\edef\tasksversion{v\csname @tasks@version\endcsname} -\usepackage{libertinehologopatch} +\microtypesetup{tracking=scshape} -\cnpkgusecolorscheme{friendly} +\defbibheading{bibliography}[\bibname]{\section{#1}} \usepackage[biblatex]{embrac}[2012/06/29] \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] -\usepackage{microtype} -\usepackage[multiple]{fnpct} - -\renewcommand*\othersectionlevelsformat[3]{\textcolor{main}{#3\autodot}\enskip} -\renewcommand*\partformat{\textcolor{main}{\partname~\thepart\autodot}} - -\pagestyle{headings} - -\setcapindent{1.5em} -\setkomafont{caption}{\normalfont\footnotesize\sffamily} -\setkomafont{captionlabel}{\normalfont\footnotesize\sffamily\scshape} - \usepackage{booktabs,array,ragged2e} -% ---------------------------------------------------------------------------- -% code examples -% ExSheets: -\addcmds{ - acs, addpoints, - blank, bigstar, bottomrule, - checkedchoicebox, choice, choicebox, citetitle, cmd, color, correct, - DebugExSheets, DeclareInstance, DeclareQuestionClass, DeclareQuestionProperty, - DeclareTemplateInterface, - endspacing, examspace, ForEachQuestion, - GetQuestionProperty, grade, - includequestions, iflastquestion, - lastvariant, midrule, NewQuSolPair, numberofquestions, - points, PrintIfIncludeActiveF, PrintIfIncludeActiveT, PrintIfIncludeActiveTF, - printsolutions, PrintSolutionsF, PrintSolutionsTF, PrintSolutionsT, - questionsincludedlast, QuestionNumber, RenewQuSolPair, rightarrow, rlap, - s, sample, setlength, SetQuestionProperties, SetupExSheets, SetVariations, - spacing, square, startnewitemline, sumpoints, - tabcolsep, textcite, textcolor, toprule, totalpoints, - variant, vary -} - -% cntformats: -\newcommand*\cntformats{{\scshape\textcolor{main}{cntformats}}\xspace} -\addcmds{ - @cntfmts@parsed@pattern, AddCounterPattern, eSaveCounterPattern, - NewCounterPattern, ReadCounterFrom, ReadCounterPattern, - ReadCounterPatternFrom, SaveCounterPattern, tmpa, tmpb -} +\newpackagename\ExSheets{ExSheets} +\newpackagename\ExSheetslistings{ExSheets-listings} +\newpackagename\cntformats{cntformats} +\newpackagename\Tasks{tasks} -% tasks: -\newcommand*\Tasks{{\scshape\textcolor{main}{tasks}}\xspace} -\addcmds{ - leftthumbsup, NewTasks, settasks, task -} % ---------------------------------------------------------------------------- % other packages, bibliography, index -\usepackage{xcoffins,wasysym,enumitem,booktabs,siunitx} +\usepackage{xcoffins,wasysym,enumitem,siunitx} + \usepackage[accsupp]{acro} +\DeclareAcronym{faq}{ + short = faq , + long = Frequently Asked Questions , + format = \scshape , + pdfstring = FAQ , + accsupp = FAQ +} \DeclareAcronym{id}{ short = id , long = Identifier , @@ -155,98 +174,28 @@ } \usepackage{filecontents} -\usepackage{imakeidx} -\begin{filecontents*}{\jobname.ist} - heading_prefix "{\\bfseries " - heading_suffix "\\hfil}\\nopagebreak\n" - headings_flag 1 - delim_0 "\\dotfill\\hyperpage{" - delim_1 "\\dotfill\\hyperpage{" - delim_2 "\\dotfill\\hyperpage{" - delim_r "}\\textendash\\hyperpage{" - delim_t "}" - suffix_2p "\\nohyperpage{\\,f.}" - suffix_3p "\\nohyperpage{\\,ff.}" -\end{filecontents*} -\indexsetup{othercode=\footnotesize} -\makeindex[options={-s \jobname.ist},intoc,columns=3] \usepackage{csquotes} -\usepackage[backend=biber,style=alphabetic]{biblatex} + \addbibresource{biblatex-examples.bib} \addbibresource{\jobname.bib} \begin{filecontents}{\jobname.bib} -@package{answers, - title = {answers}, - author = {Mike Piff}, - maintainer = {Joseph Wright}, - date = {2010-10-11}, - version = {2.13}, - url = {http://mirror.ctan.org/macros/latex/contrib/answers/} -} -@package{enumitem, - title = {enumitem}, - author = {Javier Bezos}, - date = {2011-09-28}, - version = {3.5.2}, - url = {http://mirror.ctan.org/macros/latex/contrib/enumitem/} -} -@package{eqexam, - title = {eqexam}, - author = {D. P. Story}, - date = {2011-09-01}, - version = {3.0k}, - url = {http://mirror.ctan.org/macros/latex/contrib/eqexam/} -} -@package{esami, - title = {esami}, - author = {Grazia Messineo and Salvatore Vassallo}, - date = {2013-03-08}, - version = {1.0}, - url = {http://mirror.ctan.org/macros/latex/contrib/esami/} -} -@package{exam, - title = {exam}, - author = {Philip Hirschhorn}, - date = {2011-05-22}, - version = {2.4}, - url = {http://mirror.ctan.org/macros/latex/contrib/exam/} -} -@package{examdesign, - title = {examdesign}, - author = {Jason Alexander}, - date = {2001-03-26}, - version = {1.1}, - url = {http://mirror.ctan.org/macros/latex/contrib/examdesign/} -} -@package{exercise, - title = {exercise}, - author = {Paul Pichaureau}, - date = {2012-05-08}, - version = {1.58}, - url = {http://mirror.ctan.org/macros/latex/contrib/exercise/} +@online{tex.sx:131546, + title = {Fixing lstlisting inside \ExSheets\ \code{question} and + \code{solution} environments} , + author = {Stefano Bragaglia} , + url = {http://tex.stackexchange.com/q/131546/5049} , + date = {2013-09-04} , + urldate = {2013-09-22} } -@package{exsol, - title = {exsol}, - author = {Walter Daems}, - date = {2013-05-12}, - version = {0.6}, - url = {http://mirror.ctan.org/macros/latex/contrib/exsol/} -} -@package{multienum, - title = {multienum}, - author = {Dennis Kletzing}, - date = {2005-05-19}, - version = {n.n.}, - url = {http://mirror.ctan.org/macros/latex/contrib/multienum/} -} -@package{probsoln, - title = {probsoln}, - author = {Nicola L. C. Talbot}, - date = {2012-08-23}, - version = {3.04}, - url = {http://mirror.ctan.org/macros/latex/contrib/probsoln/} +@online{tex.sx:133907, + title = {How do I extract repeated functionality (\ExSheets\ workaround) to + make it reusable?} , + author = {Forkrul Assail} , + url = {http://tex.stackexchange.com/q/133907/5049} , + date = {2013-09-18} , + urldate = {2013-09-22} } \end{filecontents} @@ -271,75 +220,48 @@ \let\checkmark\relax \usepackage{dingbat} +\DeclareRobustCommand*\questionstar{\texorpdfstring{\bonusquestionsign}{* }} +\DeclareRobustCommand*\bonusquestionsign{\llap{$\bigstar$\space}} + \NewQuSolPair - {question*}[name=\protect\llap{$\bigstar$\space}Bonus Question] - {solution*}[name=\protect\llap{$\bigstar$\space}Solution] + {question*}[name=\questionstar Bonus Question] + {solution*}[name=\questionstar Solution] -\NewTasks[style=multiplechoice]{choices}[\choice](3) +\NewTasks[style=multiplechoice]{multiplechoice}[\choice](3) \newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} \usepackage{alphalph} \NewPatternFormat{aa}{\alphalph} \NewCounterPattern{testa}{ta} -\usepackage{etoolbox} -\robustify\code - -% ---------------------------------------------------------------------------- -\newcommand*\required{\hfill\llap{required}\newline} -\newcommand*\optional{\hfill\llap{optional}\newline} - -\newcommand*\nooption[2]{\item[\code{\textcolor{key}{#1} = #2}] \cnpkgdocarrow\ } - -\newcommand*\unexpsign{$\RHD$} -\newcommand*\expsign{\textcolor{red}{$\rhd$}} -\renewcommand*\cnpkgdoctriangle{\unexpsign} -\newcommand*\expandable{% - \def\cnpkgdoctriangle{% - \expsign - \gdef\cnpkgdoctriangle{\unexpsign}}} - -\pdfstringdefDisableCommands{\def\llap#1{#1\space}\def\bigstar{*}} - -% ---------------------------------------------------------------------------- -% title page -\TitlePicture{% - \parbox{.8\linewidth}{% - \ExSheets provides means to create exercises or questions and their - corresponding solutions. The questions can be divided into classes and - can be printed selectively. Meta-data to questions can be added and - recovered. - \par - The solutions may be printed where they are, can be collected and printed - at a later point in the document alltogether or section-wise or - selectively by \acs{id}.\par - \ExSheets provides a comprehensive interface for styling the headings of - questions and solutions.}} +% \AfterPackage!{hyperref}{% +% \pdfstringdefDisableCommands{\def\questionstar{* }}% +% } \begin{document} -\part{Preliminary}\secidx{Preliminary} +\part{Preliminaries} \section{Licence and Requirements} -\secidx[Licence]{Preliminary}\secidx[Requirements]{Preliminary} -\ExSheets is placed under the terms of the \LaTeX{} Project Public License, -version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). It has -the status ``maintained.'' - -\ExSheets loads and needs the following packages: \paket*{l3kernel}, -\paket{xparse}, \paket{xtemplate}, \paket{l3sort}, \paket{l3keys2e}, -\paket{xcolor}, \paket{ulem}, \paket{etoolbox}, \paket{environ}, and -\paket{pgfcore}. \ExSheets calls \cmd{normalem} (from the \paket{ulem} -package). - -\section{Motivation}\secidx[Motivation]{Preliminary} +\license + +\ExSheets\ loads and needs the following packages: +\needpackage{l3kernel}~\cite{pkg:l3kernel}, \pkg{xparse}, \pkg{xtemplate}, +\pkg{l3keys2e}\footnote{all three \CTANurl{l3packages}}~\cite{pkg:l3packages}, +\pkg{l3sort}\footnote{\CTANurl{l3experimental}}~\cite{pkg:l3experimental}, +\needpackage{xcolor}~\cite{pkg:xcolor}, \needpackage{ulem}~\cite{pkg:ulem}, +\needpackage{etoolbox}~\cite{pkg:etoolbox}, +\needpackage{environ}~\cite{pkg:environ}, and +\pkg{pgfcore}\footnote{\CTANurl[graphics]{pgf}}~\cite{pkg:pgf}. \ExSheets\ +calls \cs*{normalem} (from the \pkg{ulem} package). + +\section{Motivation} There are already quite a number of packages that allow the creation of exercise sheets or written exams. Just to name the most common ones: -\paket*{eqexam}~\cite{eqexam}, \paket*{exam}~\cite{exam}, -\paket*{examdesign}~\cite{examdesign}, \paket*{exercise}~\cite{exercise}, -\paket*{probsoln}~\cite{probsoln}, \paket*{answers}~\cite{answers}, -\paket*{esami}~\cite{esami}, \paket*{exsol}~\cite{exsol} (and many -more\footnote{see - \url{http://www.ctan.org/characterization/primary/document-types/exams-exercise-sets-and-answers/}}). +\pkg{eqexam}~\cite{pkg:eqexam}, \pkg{exam}~\cite{pkg:exam}, +\pkg{examdesign}~\cite{pkg:examdesign}, \pkg{exercise}~\cite{pkg:exercise}, +\pkg{probsoln}~\cite{pkg:probsoln}, \pkg{answers}~\cite{pkg:answers}, +\pkg{esami}~\cite{pkg:esami}, \pkg{exsol}~\cite{pkg:exsol} (and many +more \ldots). One thing I missed in all packages that I've tried out\footnote{Well, probably I didn't try hard enough\ldots} was a high flexibility in choosing which @@ -356,51 +278,55 @@ 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 part~\ref{part:tasks}). +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 \paket*{multienum} package~\cite{multienum}.}. + at the \pkg{multienum} package~\cite{pkg:multienum}.}. -On the other hand \ExSheets doesn't --~and probably won't~-- offer a real +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 -\paket{examdesign}~\cite{examdesign}, for example. Or exploit the -possibilities \paket{enumitem}~\cite{enumitem} gives you. +\pkg{examdesign}~\cite{pkg:examdesign}, for example. Or exploit the +possibilities \pkg{enumitem}~\cite{pkg:enumitem} gives you. 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 -able to realize it without all the l3 packages like \paket*{l3kernel} and -\paket*{l3packages}. I actively began to develop \ExSheets in spring~2011 but +able to realize it without all the l3 packages like \pkg{l3kernel} and +\pkg{l3packages}. I actively began to develop \ExSheets\ in spring~2011 but it wasn't until now (September~2012) that I consider it stable enough for 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 three packages: \ExSheets, \Tasks\ and \cntformats. -\Tasks is described in part~\ref{part:tasks} and \cntformats in -part~\ref{part:cntformats}. These packages provide functionality that is used -by \ExSheets. They can, however, be used independently from \ExSheets. +\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. -\changedversion{0.9i}\ExSheets\ used to bundle the \paket*{translations} -package, too, but doesn't any more. You can find the \paket*{translations} +\changedversion{0.9i}\ExSheets\ used to bundle the \pkg{translations} +package, too, but doesn't any more. You can find the \pkg{translations} package as a package of it's own on the \ac{ctan}. -\section{Installation and Documentation}\secidx[Installation]{Preliminary} -If you install \ExSheets manually beware to put the files +\section{Installation and Documentation} +If you install \ExSheets\ manually beware to put the files \begin{itemize} \item[]\verb+exsheets_headings.def+ \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. +\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. @@ -409,13 +335,29 @@ 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 \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*{translations} Package} +The \pkg{translations} package~\cite{pkg:translations} used to be part of the +\ExSheets\ bundle but is a package of its own now\changedversion{0.9i} and +released independently. You can find it as every other package on \ctan\ and +in a full \TeX~Live or \hologo{MiKTeX} installation. + \section{News} +\subsection{Version 0.7} With version~0.7 there has been a potentially breaking change: the -\code{tasks} environment previously provided by \ExSheets has been extracted +\code{tasks} environment previously provided by \ExSheets\ has been extracted into a package of its own. This does not change any syntax \emph{per se}. However, if you used custom settings then you'll probably run into some problems. The options for the environment are no longer set with -\cmd{SetupExSheets} but with \cmd{settasks}. Also the object that is used for +\cs{SetupExSheets} but with \cs{settasks}. Also the object that is used for the list template and its instances has been renamed from \code{exsheets-tasks} into \code{tasks}. @@ -423,12 +365,12 @@ What's probably even more of a breaking change is a syntax difference of the \code{tasks} environment: the optional argument for the number of columns is \emph{no longer set in braces but parentheses}. This is deliberate as it reflects the optional nature of the argument better and is consistent with the -syntax of \cmd{NewTasks}, too. +syntax of \cs{NewTasks}, too. Additionally the labels of the list got an additional offset of \code{1ex} from the items which will lead to slightly different output. In some cases this might actually lead to the most annoying changes. In this case say -\cmd{settasks}{label-offset=0pt} which should cure things again. +\cs{settasks}\Marg{label-offset=0pt} which should cure things again. I am very sorry for any inconvenience! I am trying to keep such changes as minimal and rare as possibly. However, it is not always avoidable when a @@ -437,333 +379,346 @@ package is new and still a child. It will grow up eventually. \ExSheets' other packages -- \href{tasks_en.pdf}{\Tasks} and \href{cntformats_en.pdf}{\cntformats} -- have gotten their own documentation which are essentially extracted from this very document you're reading now. -They still will be documented in the main documentation (this document), -though. Right now (April~25th~2013) the separate documentations do not -contain much more information than is written here but they might, in time, -get more details about the corresponding package. +This manual contains links to the respective manuals. + +\subsection{Version v0.9i} +The \pkg{translations} package~\cite{pkg:translations} is no longer part of +the \ExSheets\ bundle. From now on (July~17.\@ 2013) it is provided as a +package of its own. + +\subsection{Version 0.10} +The \ExSheets\ family has got a new member: \ExSheetslistings. This package +proposes a solution for the problem of using verbatim material in \ExSheets' +\env{question} and \env{solution} environments. It is presented in +part~\ref{part:listings}. \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 +this shows me that \ExSheets\ is useful to people. It also led to many improvements like new features and countless bug fixes. -\secidx*{Preliminary} -\part{The \ExSheets package}\label{part:exsheets}\secidx{\ExSheets}[ExSheets] -\section{Setup}\secidx{Setup} -The \ExSheets package has three different types of options, kind of. The +\part{The \ExSheets\ package}\label{part:exsheets} +\section{Setup} +The \ExSheets\ package has three different types of options, kind of. The first type are the classic package options which are used when you load \ExSheets: -\begin{beispiel}[code only] - \usepackage[<options>]{exsheets} -\end{beispiel} +\begin{sourcecode} + \usepackage[<options>]{exsheets} +\end{sourcecode} These options are described in section~\ref{sec:options}. The second type are options that belong to a specific environment or command. These options are either used directly with the environment/command -\begin{beispiel}[code only] - \begin{env}[<options>] - ... - \end{env} -\end{beispiel} +\begin{sourcecode} + \begin{env}[<options>] + ... + \end{env} +\end{sourcecode} or can be set with the setup command: -\begin{beschreibung} - \Befehl{SetupExSheets}[<module>]{<options>} -\end{beschreibung} -The options of the second type all belong to -\textcolor{module}{\code{modules}}. Let's say you want to specify some -options of the \code{question} environment. You can then say the following: -\begin{beispiel}[code only] - \SetupExSheets[question]{option1,option2=value2} - % or: - \SetupExSheets{question/option1,question/option2=value2} -\end{beispiel} -The \textcolor{module}{\code{module}} an option belongs to is written in the -left margin next to the when the option is described. +\begin{commands} + \command{SetupExSheets}[\oarg{module}\marg{options}] +\end{commands} +The options of the second type all belong to \module*{modules}. Let's say you +want to specify some options of the \env{question} environment. You can then +say the following: +\begin{sourcecode} + \SetupExSheets[question]{option1,option2=value2} + % or: + \SetupExSheets{question/option1,question/option2=value2} +\end{sourcecode} +The \module*{module} an option belongs to is written in the left margin next +to the when the option is described. The third type aren't options at all, actually. However, thanks to the great -\paket{xtemplate} package you are able to define your own instances of some of +\pkg{xtemplate} package you are able to define your own instances of some of the objects used by \ExSheets. This is explained in a little more detail in part~\ref{part:style} on page~\pageref{part:style}\,ff. This third type, -however, brings in a possible instability: the \paket{xtemplate} package is in +however, brings in a possible instability: the \pkg{xtemplate} package is in an experimental and developping state. This means that the sytax of the package may and possibly will change sometime in the future. I cannot foresee what any consequences of that will be for \ExSheets. -\secidx*{Setup} -\section{Package Options}\label{sec:options}\secidx{Package Options} -The package \ExSheets has some options, namely the following ones: -\begin{beschreibung} +\section{Package Options}\label{sec:options} +The package \ExSheets\ has some options, namely the following ones: +\begin{options} %% color - \Option{color}{<colour>}\Default{exsheetsblue} + \keyval{color}{colour}\Default{exsheetsblue} A custom colour that is used in certain but very rare circumstances. %% counter-format - \Option{counter-format}{<counter-format>}\Default{qu.} + \keyval{counter-format}{counter-format}\Default{qu.} Formatting of the counter of the questions. This option takes a special kind of string that is described in section~\ref{ssec:counter}. - \Option{counter-within}{<counter>}\Default{} + \keyval{counter-within}{counter}\Default Resets the \code{question} counter with every step of \code{<counter>}. %% auto-label - \Option{auto-label}{\default{true}|false}\Default{false} - If set to true \ExSheets will automatically place a \cmd*{label}{qu:<id>} - for each question. It will also create the question properties \code{ref} - and \code{pageref}, see section~\ref{sec:additional_info} for more on - this. + \keybool{auto-label}\Default{false} + If set to \code{true} \ExSheets\ will automatically place a + \cs*{label}\Marg{qu:\meta{id}} for each question. It will also create the + question properties \code{ref} and \code{pageref}, see + section~\ref{sec:additional_info} for more on this. %% headings - \Option{headings}{<instance>}\Default{block} + \keyval{headings}{instance}\Default{block} Choose the style of the questions' and solutions' headings. There are two predefined styles: \code{block} and \code{runin}. %% headings-format - \Option{headings-format}{<code>}\Default{\cmd{normalsize}\cmd{bfseries}} + \keyval{headings-format}{code}\Default{\cs*{normalsize}\cs*{bfseries}} This code is placed immediately before the headings of the questions and solutions. + \keyval{subtitle-format}{code}\Default{\cs*{normalsize}\cs*{bfseries}\cs*{itshape}} + 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 - \Option{load-headings}{\default{true}|false}\Default{false} + \keybool{load-headings}\Default{false} Loads additional styles for the headings. More on this is described in section~\ref{sec:exsheets-headings}. %% load-tasks - \Option{load-tasks}{\default{true}|false}\Default{false} - Loads additional styles for the \code{tasks} environment. See - part~\ref{part: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 - \Option{totoc}{\default{true}|false}\Default{false} + \keybool{totoc}\Default{false} This option adds the questions and solutions with their names and numbers to the table of contents. %% questions-totoc - \Option{questions-totoc}{\default{true}|false}\Default{false} + \keybool{questions-totoc}\Default{false} This option adds the questions with their names and numbers to the table of contents. %% solutions-totoc - \Option{solutions-totoc}{\default{true}|false}\Default{false} + \keybool{solutions-totoc}\Default{false} This option adds the solutions with their names and numbers to the table of contents. %% toc-level - \Option{toc-level}{<toc level>}\Default{subsection} + \keyval{toc-level}{toc level}\Default{subsection} This option sets the level in which questions and solutions should appear in the table of contents. %% questions-toc-level - \Option{questions-toc-level}{<toc level>}\Default{subsection} + \keyval{questions-toc-level}{toc level}\Default{subsection} This option sets the level in which questions should appear in the table of contents. %% solutions-toc-level - \Option{solutions-toc-level}{<toc level>}\Default{subsection} + \keyval{solutions-toc-level}{toc level}\Default{subsection} This option sets the level in which solutions should appear in the table of contents. %% use-ref - \Option{use-ref}{\default{true}|false}\Default{false} + \keybool{use-ref}\Default{false} enable referencing to sections and chapters in a way that the references - can be used with \cmd{printsolutions}, see + can be used with \cs{printsolutions}, see section~\ref{sssec:print_specific_section} for details. -\end{beschreibung} +\end{options} The \code{toc} options are demonstrated with section~\ref{sec:solutions:list} and the solutions printed there being listed in the table of contents. -\secidx*{Package Options} \section{Create Questions/Exercises and their Solutions} Now, let's start with the most important part: the questions and (possibly) their respective solutions. -\subsection{The \code{question} Environment}\label{ssec:questions} -Questions are written inside the \code{question} environment: -\begin{beschreibung} - \Umg{question}[<options>]{\unskip\ma{<points>} ... } -\end{beschreibung} -\begin{beispiel} - \begin{question} - This is our very first very difficult to solve question! - \end{question} -\end{beispiel} +\subsection{The \env*{question} Environment}\label{ssec:questions} +Questions are written inside the \env{question} environment: +\begin{environments} + \environment{question}[\oarg{options}\marg{points}] + The main environment: creates a new exercise/question. Both arguments are + optionial! +\end{environments} +\begin{example} + \begin{question} + This is our very first very difficult to solve question! + \end{question} +\end{example} As you can see a heading is automatically created and the question is numbered. You can of course change both the numbering and the naming, but more on that later. -The \code{question} environment takes an optional argument \ma{<points>} that +The \env{question} environment takes an optional argument \marg{points} that can be used to assign points to the question (as is common in written exams): -\begin{beispiel} - \begin{question}{3} - This is our first difficult question that is worth 3 points! - \end{question} -\end{beispiel} +\begin{example} + \begin{question}{3} + This is our first difficult question that is worth 3 points! + \end{question} +\end{example} These points are saved internally (see section~\ref{sec:points} for reasons why) and are written to the right margin next to the question heading in the default setting. -You can also assign bonus points by inserting \code{<point>+<bonus points>} as -argument. -\begin{beispiel} - \begin{question}{1+1} - This question is worth 1 point and 1 bonus point. - \end{question} - \begin{question}{+3} - This question is a bonus question. It is worth 3 bonus points. - \end{question} -\end{beispiel} +You can also assign bonus points by inserting \code{\meta{point}+\meta{bonus + points}} as argument. +\begin{example} + \begin{question}{1+1} + This question is worth 1 point and 1 bonus point. + \end{question} + \begin{question}{+3} + This question is a bonus question. It is worth 3 bonus points. + \end{question} +\end{example} \sinceversion{0.3}On additional thing: you might want to define custom commands that should behave differently if they're inside or outside of the -\code{question} environment. In this case you can use these commands: -\begin{beschreibung} - \expandable\Befehl{IfInsideQuestionTF}{<true code>}\ma{<false code>} - \expandable\Befehl{IfInsideQuestionT}{<true code>} - \expandable\Befehl{IfInsideQuestionF}{<false code>} -\end{beschreibung} - -\subsection{Options to the \code{question} Environment}\secidx[options]{questions} -The \code{question} environment takes one or more of the following options: -\begin{beschreibung} - \Option[question]{type}{exam|exercise}\Default{exercise} - determines the type of question and changes the default name of a question +\env{question} environment. In this case you can use these commands: +\begin{commands} + \expandable\command{IfInsideQuestionTF}[\marg{true code}\marg{false code}] + Check if inside of a question and either leave \meta{true code} or + \meta{false code} in the input stream. + \expandable\command{IfInsideQuestionT}[\marg{true code}] + Check if inside of a question and either leave \meta{true code} in the + input stream if true. + \expandable\command{IfInsideQuestionF}[\marg{false code}] + Check if inside of a question and either leave \meta{false code} in the + input stream if not. +\end{commands} + +\subsection{Options to the \env*{question} Environment} +The \env{question} environment takes one or more of the following options: +\begin{options} + \keychoice{type}{exam,exercise}\Module{question}\Default{exercise} + Determines the type of question and changes the default name of a question from ``Exercise'' to ``Question''. These default names are language - dependent. - - If you use \cmd*{usepackage}[ngerman]{babel}, for example, then the names - are ``\"Ubung and ``Aufgabe''. - \Option[question]{name}{<name>}\Default{} - sets a custom name. All predefined names are discarded. - \Option[question]{print}{\default{true}|false}\Default{true} - prints or hides the question. - \Option[question]{ID}{<id>}\Default{} - assigns a custom \acs{id} to the question. See section~\ref{ssec:ids} for - further information. - \Option[question]{label}{<label>}\Default{} - Places a \cmd*{label}{<label>} for the question. This will overwrite any - label that is placed by the \key{auto-label} option. - \Option[question]{class}{<class>}\Default{} - assigns a class to the question. See section~\ref{sec:classes} for + dependent.\par + If you use \cs*{usepackage}\oarg{ngerman}\marg{babel}, for example, then + the names are ``\"Ubung and ``Aufgabe''. + \keyval{name}{name}\Module{question}\Default + Sets a custom name. All predefined names are discarded. + \keyval{subtitle}{subtitle}\Module{question}\Default + Adds a subtitle \meta{subtitle} for the question that is used by headings + instances that make use of the subtitle coffin, see + section~\ref{sec:exsheets-headings}. + \keybool{print}\Module{question}\Default{true} + Prints or hides the question. + \keyval{ID}{id}\Module{question}\Default + Assigns a custom \acs{id} to the question. See section~\ref{ssec:ids} for further information. - \Option[question]{topic}{<topic>}\Default{} - assigns a topic to the question. See section~\ref{sec:topics} for further - information. - \Option[question]{use}{\default{true}|false}\Default{true} - discards the question. Or not. -\end{beschreibung} -\begin{beispiel} - \begin{question}[type=exam] - This question has the type \texttt{exam}. The default name has changed from - ``Exercise'' to ``Question''. - \end{question} - \begin{question}[name=Fancy name] - This question has a custom name. - \end{question} - \begin{question}[print=false] - This question is not printed. - \end{question} -\end{beispiel} - -The difference between \key{print} and \key{use} lies behind the scenes: with -\key{print}{false} the question is not printed, but it still gets an + \keyval{label}{label}\Module{question}\Default + Places a \cs*{label}\marg{label} for the question. This will overwrite + any label that is placed by the \option{auto-label} option. + \keyval{class}{class}\Module{question}\Default + Assigns a class \meta{class} to the question. See + section~\ref{sec:classes} for further information. + \keyval{topic}{topic}\Module{question}\Default + Assigns a topic \meta{topic} to the question. See + section~\ref{sec:topics} for further information. + \keybool{use}\Module{question}\Default{true} + Discards the question. Or not. +\end{options} + +\begin{example} + \begin{question}[type=exam] + This question has the type \keyis{type}{exam}. The default name has changed + from ``Exercise'' to ``Question''. + \end{question} + \begin{question}[name=Fancy name] + This question has a custom name. + \end{question} + \begin{question}[print=false] + This question is not printed. + \end{question} +\end{example} + +The difference between \option{print} and \option{use} lies behind the scenes: +with \keyis{print}{false} the question is not printed, but it still gets an individual \ac{id}, is numbered, and a possible solution is saved. This is for example useful when you want to print a sample solution for an exam. With -\key{use}{false} it is fully discarded which means it is not accessible +\keyis{use}{false} it is fully discarded which means it is not accessible through an \acs{id} and a possible solution will not be saved. -\secidx*{questions} - -\subsection{The \code{solution} Environment}\secidx{solutions} +\subsection{The \env*{solution} Environment} If you want to save/print (more on the exact usage in -section~\ref{sec:solutions}) a solution you have to use the \code{solution} +section~\ref{sec:solutions}) a solution you have to use the \env{solution} environment \emph{after} the question it belongs to and \emph{before} the next question. -\begin{beschreibung} - \Umg{solution}[<options>]{...} -\end{beschreibung} -\begin{beispiel} - \begin{question}[ID=first]\label{qu:question_with_solution} - This is our first question that gets a solution! - \end{question} - \begin{solution} - This is the solution to exercise~\ref{qu:question_with_solution}! - \end{solution} -\end{beispiel} +\begin{environments} + \environment{solution}[\oarg{options}] + The main environment for adding solutions to exercises/questions. +\end{environments} +\begin{example} + \begin{question}[ID=first]\label{qu:question_with_solution} + This is our first question that gets a solution! + \end{question} + \begin{solution} + This is the solution to exercise~\ref{qu:question_with_solution}! + \end{solution} +\end{example} You can see that in the default settings the solution is \emph{not} written to the document. It has been saved, though, for possible later usage. We will see the solution later! -\subsection{Options to the \code{solution} Environment}\secidx[options]{solutions} -The \code{solutions} environment also has options, namely these: -\begin{beschreibung} - \Option[solution]{name}{<name>}\Default{} - sets a custom name. - \Option[solution]{print}{\default{true}|false}\Default{false} - prints or hides the solution. -\end{beschreibung} +\subsection{Options to the \env*{solution} Environment} +The \env{solutions} environment also has options, namely these: +\begin{options} + \keyval{name}{name}\Module{solution}\Default + Sets a custom name. + \keybool{print}\Module{solution}\Default{false} + Prints or hides the solution. +\end{options} Their meaning is the same as those for the \code{question} environment. -\begin{beispiel} - \begin{question}{5} - The solution to this questions gets printed where it is. - \end{question} - \begin{solution}[print] - See? This solution gets printed where you have put it in the code of - your document. - \end{solution} - \begin{question}{2.5} - The solution to this questions gets printed where it is \emph{and} - has a fancy name. Have you noticed that you can assign partial - points? - \end{question} - \begin{solution}[print,name=Fancy name] - See? This solution gets printed where you have put it and has a fancy - name! - \end{solution} -\end{beispiel} -\secidx*{solutions} - -\subsection{Setting the Counter}\label{ssec:counter}\secidx{Setting the Counter} -The package option \key{counter-format} allows you to specify how the question -counter is formatted. +\begin{example} + \begin{question}{5} + The solution to this questions gets printed where it is. + \end{question} + \begin{solution}[print] + See? This solution gets printed where you have put it in the code of + your document. + \end{solution} + \begin{question}{2.5} + The solution to this questions gets printed where it is \emph{and} + has a fancy name. Have you noticed that you can assign partial + points? + \end{question} + \begin{solution}[print,name=Fancy name] + See? This solution gets printed where you have put it and has a fancy + name! + \end{solution} +\end{example} + +\subsection{Setting the Counter}\label{ssec:counter} +The package option \option{counter-format} allows you to specify how the question +counter (a counter unsurprisingly name \code{question}) is formatted. The input is an arbitrary string which means you can have anything as counter number. However, the letter combinations \code{ch}, \code{se}, \code{qu} and \code{tsk} are replaced with the counters for the chapter, section, question -or tasks (see part~\ref{part:tasks}), respectively. While the last one is not +or tasks (see the \Tasks\ package), respectively. While the last one is not really useful in this case the others allow for a combined numbering. Each of these letter combinations can have an optional argument that specifies the -format of the respective counter. \code{1}: \cmd{arabic}, \code{a}: -\cmd{alph}, \code{A}: \cmd{Alph}, \code{r}: \cmd{roman} and \code{R}: -\cmd{Roman}. -\begin{beispiel} - \SetupExSheets{counter-format=Nr~se~(qu[a])} - \begin{question} - A question with a differently formatted number. - \end{question} -\end{beispiel} +format of the respective counter. \code{1}: \cs*{arabic}, \code{a}: +\cs*{alph}, \code{A}: \cs*{Alph}, \code{r}: \cs*{roman} and \code{R}: +\cs*{Roman}. +\begin{example} + \SetupExSheets{counter-format=Nr~se~(qu[a])} + \begin{question} + A question with a differently formatted number. + \end{question} +\end{example} Since the strings associated with the counters are replaced one has to hide them if they are actually wanted in the counter format. The easiest way would to hide them in braces. -\begin{beispiel} - \SetupExSheets{counter-format={section}\,se~{question}\,(qu[a])} - \begin{question} - A question with a yet differently formatted number. - \end{question} -\end{beispiel} -\secidx*{Setting the Counter} - -\subsection{Language Settings}\secidx{Language Settings} +\begin{example} + \SetupExSheets{counter-format={section}\,se~{question}\,(qu[a])} + \begin{question} + A question with a yet differently formatted number. + \end{question} +\end{example} + +\subsection{Language Settings} The names of the questions and solutions are language dependent. If you use -\paket{babel} or \paket{polyglossia} \ExSheets will adapt to the document -language. \ExSheets has a number of translations but surely not all! If you -miss a language please drop me a line in an +\pkg{babel} or \pkg{polyglossia} \ExSheets\ will adapt to the document language. +\ExSheets\ has a number of translations but surely not all! If you miss a +language please drop me a line in an email\footnote{\href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu}} -containing the \paket{babel} language name and the correct translations for +containing the \pkg{babel} language name and the correct translations for questions (possibly distinguishing between exercises and exam questions) and solutions. Until I implement it you can add something like this to your preamble (example for Danish) and try if it works: -\begin{beispiel}[code only] - \DeclareTranslation{Danish}{exsheets-exercise-name} - {\O{}velse} - \DeclareTranslation{Danish}{exsheets-question-name} - {Opgave} - \DeclareTranslation{Danish}{exsheets-solution-name} - {Opl\o{}sning} -\end{beispiel} +\begin{sourcecode} + \DeclareTranslation{Danish}{exsheets-exercise-name}{\O{}velse} + \DeclareTranslation{Danish}{exsheets-question-name}{Opgave} + \DeclareTranslation{Danish}{exsheets-solution-name}{Opl\o{}sning} +\end{sourcecode} If this isn't working it means that the language you're using is unknown to -the \paket*{translations} package. In this case please notify me, too. You -then can still use the \key{name} options. - -\secidx*{Language Settings} +the \pkg{translations} package. In this case please notify me, too. You then +can still use the \option{name} options. -\section{Counting Points}\label{sec:points}\secidx{Counting Points} +\section{Counting Points}\label{sec:points} \subsection{The Commands} You have seen in section~\ref{ssec:questions} that you can assign points to a question. If you do so these points are printed into the @@ -771,616 +726,619 @@ margin\footnote{Well, not necessarily. It depends on the heading style you have chosen.} and are counted internally. But there are additional commands to assign points or bonus points and a number of commands to retrieve the sum of points and/or bonus points. -\begin{beschreibung} - \Befehl{addpoints}*{<num>}\newline +\begin{commands} + \command{addpoints}[\sarg\marg{num}] This command can be used to add points assigned to subquestions. - \cmd{addpoints} will print the points (with ``unit'') \emph{and} add them - to the sum of all points, \cmd{addpoints}* will only add them but print + \cs{addpoints} will print the points (with ``unit'') \emph{and} add them + to the sum of all points, \cs{addpoints}\sarg\ will only add them but print nothing. - \Befehl{points}*{<num>}\newline + \command{points}[\sarg\marg{num}] This command will only print the points (with ``unit'') but won't add them to the sum of points. - \Befehl{addbonus}*{<num>}\newline + \command{addbonus}[\sarg\marg{num}] This command can be used to add bonus points assigned to subquestions. - \cmd{addbonus} will print the points (with ``unit'') \emph{and} add them - to the sum of all bonus points, \cmd{addbonus}* will only add them but + \cs{addbonus} will print the points (with ``unit'') \emph{and} add them + to the sum of all bonus points, \cs{addbonus}\sarg\ will only add them but print nothing. - \Befehl{bonus}*{<num>}\newline + \command{bonus}[\sarg\marg{num}] This command will only print the bonus points (with ``unit'') but won't add them to the sum of bonus points. - \Befehl{pointssum}*\newline + \command{pointssum}[\sarg] Prints the sum of all points with or without (starred version) ``unit'': \pointssum - \Befehl{currentpointssum}*\newline + \command{currentpointssum}[\sarg] Prints the current sum of points with or without (starred version) ``unit'': \currentpointssum - \Befehl{bonussum}*\newline + \command{bonussum}[\sarg] Prints the sum of all bonus points with or without (starred version) ``unit'': \bonussum - \Befehl{currentbonussum}*\newline + \command{currentbonussum}[\sarg] Prints the current sum of bonus points with or without (starred version) ``unit'': \currentbonussum - \Befehl{totalpoints}*\newline + \command{totalpoints}[\sarg] prints the sum of the points \emph{and} the sum of the bonus points with ``unit'': \totalpoints\space The starred version prints the sum of the points without ``unit'': \totalpoints*. -\end{beschreibung} -The commands \cmd{pointssum}, \cmd{bonussum} and \cmd{totalpoints} need at +\end{commands} +The commands \cs{pointssum}, \cs{bonussum} and \cs{totalpoints} need at least \emph{two} \LaTeX\ runs to get the sum right. Suppose you have an exercise worth \points{4} which consists of four questions -listed with an \code{enumerate} environment that are all worth \points{1} +listed with an \env{enumerate} environment that are all worth \points{1} each. You have two possibilities to display and count them: -\begin{beispiel} - % uses package `enumitem' - \begin{question}{4} - \begin{enumerate}[label=\alph*)] - \item blah (\points{1}) - \item blah (\points{1}) - \item blah (\points{1}) - \item blah (\points{1}) - \end{enumerate} - \end{question} - \begin{question} - \begin{enumerate}[label=\alph*)] - \item blah (\addpoints{1}) - \item blah (\addpoints{1}) - \item blah (\addpoints{1}) - \item blah (\addpoints{1}) - \end{enumerate} - \end{question} -\end{beispiel} - -\subsection{Options}\secidx[options]{Counting Points} -\begin{beschreibung} - \Option[points]{name}{<name>}\Default{P.} +\begin{example} + % uses package `enumitem' + \begin{question}{4} + \begin{enumerate}[label=\alph*)] + \item blah (\points{1}) + \item blah (\points{1}) + \item blah (\points{1}) + \item blah (\points{1}) + \end{enumerate} + \end{question} + \begin{question} + \begin{enumerate}[label=\alph*)] + \item blah (\addpoints{1}) + \item blah (\addpoints{1}) + \item blah (\addpoints{1}) + \item blah (\addpoints{1}) + \end{enumerate} + \end{question} +\end{example} + +\subsection{Options} +\begin{options} + \keyval{name}{name}\Module{points}\Default{P.} Choose the ``unit'' for the points. If you like to differentiate between a single point and more than one point you can give a plural ending - separated with a slash: \key{name}{point/s}. This sets also the name of + separated with a slash: \keyis{name}{point/s}. This sets also the name of the bonus points. - \Option[points]{name-plural}{<plural form of name>}\Default{} + \keyval{name-plural}{plural form of name}\Module{points}\Default Instead of forming the plural form with an ending to the singular form this option allows to set an extra word for it. This sets also the plural form for the bonus points. - \Option[points]{bonus-name}{<name>}\Default{P.} + \keyval{bonus-name}{name}\Module{points}\Default{P.} Choose the ``unit'' for the bonus points. If you like to differentiate between a single point and more than one point you can give a plural ending separated with a slash: \key{bonus-name}{point/s}. - \Option[points]{bonus-plural}{<plural form of name>}\Default{} + \keyval{bonus-plural}{plural form of name}\Module{points}\Default Instead of forming the plural form with an ending to the singular form this option allows to set an extra word for it. - \Option[points]{use-name}{\default{true}|false}\Default{true} + \keybool{use-name}\Module{points}\Default{true} Don't display the name at all. Or do. - \Option[points]{format}{<code>}\Default{\cmd*{@firtsofone}} + \keyval{format}{code}\Module{points}\Default{\cs*{@firtsofone}} \sinceversion{0.9d}Format number plus name as a whole. Ideally - \code{<code>} would end with a command that takes an argument. Else + \meta{code} would end with a command that takes an argument. Else number plus name will be braced. - \Option[points]{number-format}{<any code>}\Default{} - This option allows formatting of the number, \eg italics: - \key{number-format}{\cmd{textit}}. - \Option[points]{bonus-format}{<any code>}\Default{} - This option allows formatting of the number of the bonus points, \eg - italics: \key{bonus-format}{\cmd{textit}}. - \Option[points]{parse}{\default{true}|false}\Default{true} + \keyval{number-format}{any code}\Module{points}\Default + This option allows formatting of the number, \eg, italics: + \keyis{number-format}{\cs*{textit}}. + \keyval{bonus-format}{any code}\Module{points}\Default + This option allows formatting of the number of the bonus points, \eg, + italics: \keyis{bonus-format}{\cs*{textit}}. + \keybool{parse}\Module{points}\Default{true} If set to \code{false} the points are not counted and the - \cmd{totalpoints}, \cmd{pointssum} and \cmd{bonussum} commands won't know + \cs{totalpoints}, \cs{pointssum} and \cs{bonussum} commands won't know their value. - \Option[points]{separate-bonus}{\default{true}|false}\Default{false} + \keybool{separate-bonus}\Module{points}\Default{false} This option determines whether points and bonus points each get their own - unit when they appear together (in the margin or with \cmd{totalpoints}). - \Option[points]{pre-bonus}{<tokens>}\Default{(+} + unit when they appear together (in the margin or with \cs{totalpoints}). + \keyval{pre-bonus}{tokens}\Module{points}\Default{(+} Code to be inserted before the bonus points when they follow normal points. - \Option[points]{post-bonus}{<tokens>}\Default{)} + \keyval{post-bonus}{tokens}\Module{points}\Default{)} Code to be inserted after the bonus points when they follow normal points. -\end{beschreibung} -\begin{beispiel} - \SetupExSheets[points]{name=point/s,number-format=\color{red}} - \begin{question}{1} - This one's easy so only 1 point can be earned. - \end{question} - \begin{question}{7.5} - But this one's hard! 7.5 points are in there for you! - \end{question} -\end{beispiel} -\secidx*{Counting Points} - -\section{Printing Solutions}\label{sec:solutions}\secidx[print]{solutions} +\end{options} + +\begin{example} + \SetupExSheets[points]{name=point/s,number-format=\color{red}} + \begin{question}{1} + This one's easy so only 1 point can be earned. + \end{question} + \begin{question}{7.5} + But this one's hard! 7.5 points are in there for you! + \end{question} +\end{example} + +\section{Printing Solutions}\label{sec:solutions} You have already seen that you can print solutions where they are using the -\key[solution]{print} option. But \ExSheets offers you quite more +\option{print} option. But \ExSheets\ offers you quite more possibilities. -In the next subsections the usage of the command -\begin{beschreibung} - \Befehl{printsolutions}[<setting>] -\end{beschreibung} -is discussed. +In the next subsections the usage of the following command is discussed. +\begin{commands} + \command{printsolutions}[\oarg{setting}] + Print solutions of questions(exercises. +\end{commands} Before we do that a hint: remember that you can set the option \key{print} globally: -\begin{beispiel}[code only] - % in the preamble - \SetupExSheets{solution/print=true} -\end{beispiel} +\begin{sourcecode} + % in the preamble + \SetupExSheets{solution/print=true} +\end{sourcecode} Now if you want to typeset some text depending on the option being true or not you can use the following commands: -\begin{beschreibung} - \expandable\Befehl{PrintSolutionsTF}{<true code>}\ma{<false code>} - \expandable\Befehl{PrintSolutionsT}{<true code>} - \expandable\Befehl{PrintSolutionsF}{<false code>} -\end{beschreibung} +\begin{commands} + \expandable\command{PrintSolutionsTF}[\marg{true code}\marg{false code}] + Checks if inside of a \env{solution} environment and either leaves the + \meta{true code} or the \meta{false code} in the input stream. + \expandable\command{PrintSolutionsT}[\marg{true code}] + Checks if inside of a \env{solution} environment and either leaves the + \meta{true code} in the input stream if yes. + \expandable\command{PrintSolutionsF}[\marg{false code}] + Checks if inside of a \env{solution} environment and either leaves the + \meta{false code} in the input stream if not. +\end{commands} They might come in handy if you want two versions of an exercise sheet, one with the exercises and one with the solutions, and you want to add different titles to these versions, for instance. -\subsection{Print all}\secidx[print!all]{solutions} -The first and easiest usage of \cmd{printsolutions} is the following: -\begin{beispiel}[code only] - \printsolutions -\end{beispiel} +\subsection{Print all} +The first and easiest usage of \cs{printsolutions} is the following: +\begin{sourcecode} + \printsolutions +\end{sourcecode} There is nothing more to say, really. It prints all solutions you have -specified except those belonging to a question with option \key{use}{false}. -Yes, there's one more point: \cmd{printsolutions} only knows the solutions +specified except those belonging to a question with option \keyis{use}{false}. +Yes, there's one more point: \cs{printsolutions} only knows the solutions that have been set \emph{before} its usage! This is also true for every usage explained in the next sections. -\begin{beispiel}[below] - \printsolutions -\end{beispiel} +\begin{example} + \printsolutions +\end{example} -\subsection{Print per chapter/section}\secidx[print!per section/chapter]{solutions} +\subsection{Print per chapter/section} \minisec{Current chapter/section} If you are not creating an exercise sheet or an exam but are writing a textbook you maybe want a section at the end of each chapter showing the solution to the exercises presented in that chapter. In this case use the command as follows: -\begin{beispiel}[code only] - \printsolutions[section] - % or - \printsolutions[chapter] -\end{beispiel} +\begin{sourcecode} + \printsolutions[section] + % or + \printsolutions[chapter] +\end{sourcecode} Again, this is pretty much self-explaining. The solutions to the questions of the current chapter\footnote{Only if the document class you're using \emph{has} chapters, of course!} or section are printed. -\begin{beispiel} - \begin{question} - This is the first and only question in this section. - \end{question} - \begin{solution} - This will be one of a few solutions printed by the following call of - \cmd{printsolutions}. - \end{solution} - And now: - \printsolutions[section] -\end{beispiel} +\begin{example} + \begin{question} + This is the first and only question in this section. + \end{question} + \begin{solution} + This will be one of a few solutions printed by the following call of + \cs{printsolutions}. + \end{solution} + And now: + \printsolutions[section] +\end{example} \minisec{Specific chapter/section}\label{sssec:print_specific_section} You can also print only the solutions from chapters or sections other than the current ones. The syntax is fairly easy: -\begin{beispiel}[below] - \printsolutions[section={1-7,10}] - % the same for chapters: - % \printsolutions[chapter={1-7,10}] -\end{beispiel} -Don't forget that \cmd{printsolutions} cannot know the solutions from +\begin{example} + \printsolutions[section={1-7,10}] + % the same for chapters: + % \printsolutions[chapter={1-7,10}] +\end{example} +Don't forget that \cs{printsolutions} cannot know the solutions from section~10 yet. It is just used to demonstrate the syntax. You can also use -an open range, \eg something like -\begin{beispiel}[code only] - \printsolutions[section={-4,10-}] -\end{beispiel} +an open range, \eg, something like +\begin{sourcecode} + \printsolutions[section={-4,10-}] +\end{sourcecode} This would print the solutions from sections~1--4 and from all sections with -number 10\footnote{Or rather where \cmd{value}{section} is 10 or greater -- +number 10\footnote{Or rather where \cs*{value}\Marg{section} is 10 or greater -- the actual counter formatting is irrelevant.} and greater. There is an obvious disadvantage: you have to know the section numbers! But -there is a solution: use the package option \key{use-ref}{true}. Then you can -do something like -\begin{beispiel}[code only] - % in the preamble: - \usepackage[use-ref]{exsheets} - % somewhere in your code after \section{A really cool section title}: - \label{sec:ReallyCool} - % somewhere later in your code: - \printsolutions[section={-\S{sec:ReallyCool}}] - % which will print all solutions from questions up to and - % including the really cool section -\end{beispiel} -With the package option \key{use-ref}{true} each usage of \cmd{label} will +there is a solution: use the package option \keyis{use-ref}{true}. Then you +can do something like +\begin{sourcecode} + % in the preamble: + \usepackage[use-ref]{exsheets} + % somewhere in your code after \section{A really cool section title}: + \label{sec:ReallyCool} + % somewhere later in your code: + \printsolutions[section={-\S{sec:ReallyCool}}] + % which will print all solutions from questions up to and + % including the really cool section +\end{sourcecode} +With the package option \keyis{use-ref}{true} each usage of \cs*{label} will create additional labels (one preceded with \code{exse:} and another one with \code{exch:}) which store the section number and the chapter number, -respectively. These are used internally by two commands \cmd{S} and \cmd{C} +respectively. These are used internally by two commands \cs{S} and \cs{C} which refer to the section number and the chapter number the label was created in. \emph{These commands are only available as arguments of} -\cmd{printsolutions}. - -Since some packages like the well known \paket{hyperref} for example redefine -\cmd{label} \key{use-ref} won't work in together with it. In this case don't -use \key{use-ref} and set \cmd{exlabel}{<label>} instead to remember the -section/the chapter number. Its usage is just like \cmd{label}. So the -safest way is as follows: -\begin{beispiel}[code only] - % in the preamble: - \usepackage{exsheets} - % somewhere in your code after \section{A really cool section title}: - \exlabel{sec:ReallyCool} - % somewhere later in your code: - \printsolutions[section={-\S{sec:ReallyCool}}] - % which will print all solutions from questions up to and - % including the really cool section -\end{beispiel} +\cs{printsolutions}. + +Since some packages like the well known \pkg{hyperref} for example redefine +\cs*{label} \option{use-ref} won't work in together with it. In this case +don't use \option{use-ref} and set \cs{exlabel}\marg{label} instead to +remember the section/the chapter number. Its usage is just like \cs*{label}. +So the safest way is as follows: +\begin{sourcecode} + % in the preamble: + \usepackage{exsheets} + % somewhere in your code after \section{A really cool section title}: + \exlabel{sec:ReallyCool} + % somewhere later in your code: + \printsolutions[section={-\S{sec:ReallyCool}}] + % which will print all solutions from questions up to and + % including the really cool section +\end{sourcecode} Please be aware that the labels must be processed in a previous \LaTeX\ run -before \cmd{S} and \cmd{C} can pass them on to \cmd{printsolutions}. +before \cs{S} and \cs{C} can pass them on to \cs{printsolutions}. -\subsection{Print by \acs{id}}\label{ssec:ids}\secidx[print!by ID]{solutions} +\subsection{Print by \acs{id}}\label{ssec:ids} Now comes the best part: you can also print selected solutions! Every question has an \acs{id}. To see which \acs{id} a question has you can call the following command: -\begin{beschreibung} - \Befehl{DebugExSheets}{true|false} - \Befehl{CurrentQuestionID}\newline\sinceversion{0.4a}% - expands to the current question \acs{id} (after two expansions). -\end{beschreibung} +\begin{commands} + \command{DebugExSheets}[\Marg{\choices{true,false}}] + Enable or disable visual \ExSheets' debugging. + \command{CurrentQuestionID} + \sinceversion{0.4a}Expands to the current question \acs{id} (after two + expansions). +\end{commands} Let's create some more questions and take a look what this command does: -\begin{beispiel} - \DebugExSheets{true} - \begin{question}[ID=nice!] - A question with a nice \acs{id}! - \end{question} - \begin{solution} - The solution to the question with the nice \acs{id}. - \end{solution} - \begin{question}{3.75} - Yet another question. But this time with quarter points! - \end{question} - \begin{solution} - Yet another solution. - \end{solution} -\end{beispiel} +\begin{example} + \DebugExSheets{true} + \begin{question}[ID=nice!] + A question with a nice \acs{id}! + \end{question} + \begin{solution} + The solution to the question with the nice \acs{id}. + \end{solution} + \begin{question}{3.75} + Yet another question. But this time with quarter points! + \end{question} + \begin{solution} + Yet another solution. + \end{solution} +\end{example} So now we can call some specific solutions: -\begin{beispiel} - \printsolutions[byID={first,nice!,10,14}] -\end{beispiel} -This makes use of the \paket{l3sort} package which at the time of writing is +\begin{example} + \printsolutions[byID={first,nice!,10,14}] +\end{example} +This makes use of the \pkg{l3sort} package which at the time of writing is still considered experimental. In case you wonder where solution~14 is: question~14 has no solution given. If you don't want that the solutions are sorted automatically but appear in the order given you can use the option -\begin{beschreibung} - \Option[solution]{sorted}{\default{true}|false}\Default{true} +\begin{options} + \keybool{sorted}\Module{solution}\Default{true} Sort solutions given by \acs{id} or don't. -\end{beschreibung} +\end{options} \section{Dividing Questions into Classes}\label{sec:dividing-concepts} -\subsection{Using Classes}\label{sec:classes}\secidx{Classes} -\secidx[Classes]{Dividing Concepts} +\subsection{Using Classes}\label{sec:classes} For creating different variants of a written exam or different difficulty levels of an exercise sheet it comes in handy if one can assign certain -classes to questions and then tell \ExSheets only to use one ore more specific -classes. -\begin{beschreibung} - \Option{use-classes}{<list of classes>}\Default{} +classes to questions and then tell \ExSheets\ only to use one ore more +specific classes. +\begin{options} + \keyval{use-classes}{list of classes}\Default When this option is used only the questions belonging to the specified classes are printed and have their solutions saved. -\end{beschreibung} -\begin{beispiel} - \SetupExSheets{use-classes={A,C}} - \begin{question}[class=A] - Belonging to class A. - \end{question} - \begin{question}[class=B] - Belonging to class B. - \end{question} - \begin{question}[class=C] - Belonging to class C! - \end{question} -\end{beispiel} +\end{options} +\begin{example} + \SetupExSheets{use-classes={A,C}} + \begin{question}[class=A] + Belonging to class A. + \end{question} + \begin{question}[class=B] + Belonging to class B. + \end{question} + \begin{question}[class=C] + Belonging to class C! + \end{question} +\end{example} Questions of classes that are not used are fully discarded. \emph{This also means that questions that don't have a class assigned are discarded.} -\secidx*{Classes} \ExplSyntaxOn \bool_set_false:N \g__exsheets_use_classes_bool \ExplSyntaxOff -\subsection{Using Topics}\label{sec:topics}\secidx{Topics} -\secidx[Topics]{Dividing Concepts} -Similarly to classes one can assign topics to questions. The usage is practically -identical, the semantic meaning is different. -\begin{beschreibung} - \Option{use-topics}{<list of topics>}\Default{} +\subsection{Using Topics}\label{sec:topics} +Similarly to classes one can assign topics to questions. The usage is +practically identical, the semantic meaning is different. +\begin{options} + \keyval{use-topics}{list of topics}\Default When this option is used only the questions belonging to the specified topics are printed and have their solutions saved. -\end{beschreibung} -\begin{beispiel} - \SetupExSheets{use-topics={trigonometry}} - \begin{question}[topic=trigonometry] - A trigonometry question. - \end{question} - \begin{question}[topic=arithmetics] - A arithmetics question - \end{question} -\end{beispiel} +\end{options} +\begin{example} + \SetupExSheets{use-topics={trigonometry}} + \begin{question}[topic=trigonometry] + A trigonometry question. + \end{question} + \begin{question}[topic=arithmetics] + A arithmetics question + \end{question} +\end{example} Questions of topics that are not used are fully discarded. \emph{This also means that questions that don't have a topic assigned are discarded.} -If you set both \key{use-classes} and \key{use-topics} then only questions -will be used that \emph{match both categories}. +If you set both \option{use-classes} and \option{use-topics} then only +questions will be used that \emph{match both categories}. Ideally one could assign more than one topic to a question but this is \emph{not} supported yet. -\secidx*{Topics} + \ExplSyntaxOn \bool_set_false:N \g__exsheets_use_topics_bool \ExplSyntaxOff -\subsection{Own Dividing Concepts}\secidx{Dividing Concepts} +\subsection{Own Dividing Concepts} \noindent\sinceversion{0.8}Actually both classes and topics are introduced -into \ExSheets internally this way: -\begin{beispiel}[code only] - \DeclareQuestionClass{class}{classes} - \DeclareQuestionClass{topic}{topics} -\end{beispiel} +into \ExSheets\ internally this way: +\begin{sourcecode} + \DeclareQuestionClass{class}{classes} + \DeclareQuestionClass{topic}{topics} +\end{sourcecode} which means you can do the same introducing your own dividing concepts. -\begin{beschreibung} - \Befehl{DeclareQuestionClass}{<singular name>}\ma{<plural name>}\newline +\begin{commands} + \command{DeclareQuestionClass}[\marg{singular name}\marg{plural name}] Introduces a new dividing concept and defines both new options for the - \code{question} environment and new global options. -\end{beschreibung} + \env{question} environment and new global options. +\end{commands} For example you could decide you want to group your questions according to their difficulty. You could place the following line in your preamble: -\begin{beispiel}[code only] - \DeclareQuestionClass{difficulty}{difficulties} -\end{beispiel} -This would define an option \key{use-difficulties} analogous to -\key{use-classes} and \key{use-topics}. It would also define an option -\key{difficulty} for the \code{question} environment. This means you could +\begin{sourcecode} + \DeclareQuestionClass{difficulty}{difficulties} +\end{sourcecode} +This would define an option \option*{use-difficulties} analogous to +\option{use-classes} and \option{use-topics}. It would also define an option +\option{difficulty} for the \env{question} environment. This means you could now do something like the following: -\begin{beispiel} - \SetupExSheets{use-difficulties={easy,hard}} - \begin{question}[difficulty=easy] - An easy question. - \end{question} - \begin{question}[difficulty=medium] - This one's a bit harder. - \end{question} - \begin{question}[difficulty=hard] - Now let's see if you can solve this one. - \end{question} -\end{beispiel} -\secidx*{Dividing Concepts} +\begin{example} + \SetupExSheets{use-difficulties={easy,hard}} + \begin{question}[difficulty=easy] + An easy question. + \end{question} + \begin{question}[difficulty=medium] + This one's a bit harder. + \end{question} + \begin{question}[difficulty=hard] + Now let's see if you can solve this one. + \end{question} +\end{example} + \ExplSyntaxOn \bool_set_false:N \g__exsheets_use_difficulties_bool \ExplSyntaxOff \section{Adding and Using Additional Information to Questions}\label{sec:additional_info} -\secidx{Additional Information to Questions} For managing lots of questions and corresponding solutions it can be very useful to be able to save and recover additional information to the questions. This is possible with the following commands. First the ones for saving: -\begin{beschreibung} - \Befehl{DeclareQuestionProperty}{<name>}\newline - This command defines a question property \code{<name>}. It can only be +\begin{commands} + \command{DeclareQuestionProperty}[\marg{name}] + This command defines a question property \meta{name}. It can only be used in the document preamble. - \Befehl{SetQuestionProperties}{<name>=<value>,...}\newline + \command{SetQuestionProperties}[\Marg{\meta{name}=\meta{value},...}] Set the properties for a specific question. this command can only be used - inside the \code{question} environment. -\end{beschreibung} + inside the \env{question} environment. +\end{commands} Now the commands for recovering the properties: -\begin{beschreibung} - \Befehl{QuestionNumber}{<id>}\newline - Recover the number of the question with the \acs{id} \code{<id>}. The +\begin{commands} + \command{QuestionNumber}[\marg{id}] + Recover the number of the question with the \acs{id} \meta{id}. The number is displayed according to the format set with - \key{counter-format}. - \Befehl{GetQuestionProperty}{<name>}\ma{<id>}\newline - Recover the property \code{<name>} of the question with the \acs{id} - \code{<id>}. Of course the property must have been declared before. -\end{beschreibung} - + \option{counter-format}. + \command{GetQuestionProperty}[\marg{name}\marg{id}] + Recover the property \meta{name} of the question with the \acs{id} + \meta{id}. Of course the property must have been declared before. +\end{commands} + Let's say we have declared the properties \code{notes}, \code{reference} and \code{topic}. By default the property \code{points} is available and gets the value of the optional argument of the \code{question} environment. We can now do the following: -\begin{beispiel} - % uses `biblatex' - \begin{question}[ID=center,topic=LaTeX]{3} - Explain how you could center text in a \LaTeX\ document. - \SetQuestionProperties{ - topic = \TeX/\LaTeX , - notes = {How to center text.}, - reference = {\textcite{companion}}} - \end{question} - \begin{solution} - To center a short part of the text body one can use the \texttt{center} - environment (\points{1}). Inside an environment like \texttt{table} one - should use \texttt{\string\centering} (\points{1}). For single lines - there is also the \texttt{\string\centerline} command (\points{1}). - \end{solution} - \begin{question}[ID=knuthbooks,topic=LaTeX]{2} - Name two books by D.\,E.\,Knuth. - \SetQuestionProperties{ - topic = \TeX/\LaTeX , - notes = {Books by Knuth.}, - reference = {\textcite{knuth:ct:a,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}}} - \end{question} - \begin{solution} - For example two volumes from \citetitle{knuth:ct}: - \citetitle{knuth:ct:a,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}. Each valid - answer is worth \points{1} - \end{solution} -\end{beispiel} +\begin{example} + % uses `biblatex' + \begin{question}[ID=center,topic=LaTeX]{3} + Explain how you could center text in a \LaTeX\ document. + \SetQuestionProperties{ + topic = \TeX/\LaTeX , + notes = {How to center text.}, + reference = {\textcite{companion}}} + \end{question} + \begin{solution} + To center a short part of the text body one can use the \env*{center} + environment (\points{1}). Inside an environment like \env*{table} one + should use \cs*{centering} (\points{1}). For single lines there is also + the \cs*{centerline} command (\points{1}). + \end{solution} + \begin{question}[ID=knuthbooks,topic=LaTeX]{2} + Name two books by D.\,E.\,Knuth. + \SetQuestionProperties{ + topic = \TeX/\LaTeX , + notes = {Books by Knuth.}, + reference = {\textcite{knuth:ct:a,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}}} + \end{question} + \begin{solution} + For example two volumes from \citetitle{knuth:ct}: + \citetitle{knuth:ct:a,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}. Each + valid answer is worth \points{1} + \end{solution} +\end{example} It is now possible to recover these values later: -\begin{beispiel} - % uses `booktabs' - \begin{center} - \begin{tabular}{lll} - \toprule - Question & Property & \\ - \midrule - \QuestionNumber{center} - & Points & \GetQuestionProperty{points}{center} \\ - & Topic & \GetQuestionProperty{topic}{center} \\ - & References & \GetQuestionProperty{reference}{center} \\ - & Note & \GetQuestionProperty{notes}{center} \\ - \midrule - \QuestionNumber{knuthbooks} - & Points & \GetQuestionProperty{points}{knuthbooks} \\ - & Topic & \GetQuestionProperty{topic}{knuthbooks} \\ - & References & \GetQuestionProperty{reference}{knuthbooks} \\ - & Note & \GetQuestionProperty{notes}{knuthbooks} \\ - \bottomrule - \end{tabular} - \end{center} -\end{beispiel} - -\sinceversion{0.7a}If you use the package option \key{auto-label} the +\begin{example} + % uses `booktabs' + \begin{center} + \begin{tabular}{lll} + \toprule + Question & Property & \\ + \midrule + \QuestionNumber{center} + & Points & \GetQuestionProperty{points}{center} \\ + & Topic & \GetQuestionProperty{topic}{center} \\ + & References & \GetQuestionProperty{reference}{center} \\ + & Note & \GetQuestionProperty{notes}{center} \\ + \midrule + \QuestionNumber{knuthbooks} + & Points & \GetQuestionProperty{points}{knuthbooks} \\ + & Topic & \GetQuestionProperty{topic}{knuthbooks} \\ + & References & \GetQuestionProperty{reference}{knuthbooks} \\ + & Note & \GetQuestionProperty{notes}{knuthbooks} \\ + \bottomrule + \end{tabular} + \end{center} +\end{example} + +\sinceversion{0.7a}If you use the package option \option{auto-label} the properties \code{ref} and \code{pageref} are predefined which will call the -corresponding \cmd*{ref} or \cmd*{pageref}, respectively. +corresponding \cs*{ref} or \cs*{pageref}, respectively. Please note that these properties \emph{are not the same} as the dividing concepts explained in section~\ref{sec:dividing-concepts} although they may seem similar in meaning or even have the same name. \sinceversion{0.3}There are additional commands that might prove useful: -\begin{beschreibung} - \Befehl{ForEachQuestion}{<code to be executed for each used question>}\newline +\begin{commands} + \command{ForEachQuestion}[\marg{code to be executed for each used question}] Inside the argument one can refer to the \ac{id} of a question with \code{\#1}. Beware that this command only knows of questions used before it is issued. - \expandable\Befehl{numberofquestions}\newline + \expandable\command{numberofquestions} Returns the current number of used questions. Beware that this command only knows of questions used before it is issued. - \expandable\Befehl{iflastquestion}{<true code>}\ma{<false code>}\newline + \expandable\command{iflastquestion}[\marg{true code}\marg{false code}] Although this command is available in the whole document it is only useful - inside \cmd{ForEachQuestion}. It tells you if the end of the loop is + inside \cs{ForEachQuestion}. It tells you if the end of the loop is reached or not. -\end{beschreibung} +\end{commands} For example one could use these commands to create a grading table: -\begin{beispiel}[code only] - \begin{tabular}{|l|*{\numberofquestions}{c|}c|}\hline - Question & - \ForEachQuestion{\QuestionNumber{#1}\iflastquestion{}{&}} & - Total \\ \hline - Points & - \ForEachQuestion{\GetQuestionProperty{points}{#1}\iflastquestion{}{&}} & - \pointssum* \\ \hline - Reached & - \ForEachQuestion{\iflastquestion{}{&}} & \\ \hline - \end{tabular} -\end{beispiel} +\begin{sourcecode} + \begin{tabular}{|l|*{\numberofquestions}{c|}c|}\hline + Question & + \ForEachQuestion{\QuestionNumber{#1}\iflastquestion{}{&}} & + Total \\ \hline + Points & + \ForEachQuestion{\GetQuestionProperty{points}{#1}\iflastquestion{}{&}} & + \pointssum* \\ \hline + Reached & + \ForEachQuestion{\iflastquestion{}{&}} & \\ \hline + \end{tabular} +\end{sourcecode} For four questions the table now would look similar to figure~\ref{fig:grading-table}. \begin{figure}[ht] - \centering - \begin{tabular}{|l|*{4}{c|}c|}\hline - Question & 1. & 2. & 3. & 4. & Total \\ \hline - Points & 3 & 5 & 10 & 8 & 26 \\ \hline - Reached & & & & & \\ \hline - \end{tabular} - \caption{An example for a grading table. (Actually this is a fake. See the - \code{grading-table.tex} file shipped with exsheets for the real use case.)} - \label{fig:grading-table} + \centering + \begin{tabular}{|l|*{4}{c|}c|}\hline + Question & 1. & 2. & 3. & 4. & Total \\ \hline + Points & 3 & 5 & 10 & 8 & 26 \\ \hline + Reached & & & & & \\ \hline + \end{tabular} + \caption{An example for a grading table. (Actually this is a fake. See the + \code{grading-table.tex} file shipped with exsheets for the real use case.)} + \label{fig:grading-table} \end{figure} -\secidx*{Additional Information to Questions} -\section{Variations of an Exam}\secidx{Variations} + +\section{Variations of an Exam} \noindent\sinceversion{0.6}It is a quite common task to design an exam in two different variants. This is of course possible with \ExSheets' classes (see section~\ref{sec:classes}). However, often not the whole question is to be different but only small details, the numbers in a maths exam, say. For this -purpose \ExSheets provides the following commands: -\begin{beschreibung} - \Befehl{SetVariations}{<num>}\newline +purpose \ExSheets\ provides the following commands: +\begin{commands} + \command{SetVariations}[\marg{num}] Set the number of different variants. This will determine how many - arguments the command \cmd*{vary} will get. \code{<num>} must at least be + arguments the command \cs{vary} will get. \meta{num} must at least be \code{2} and is initially set to \code{2}. - \Befehl{variant}{<num>}\newline + \command{variant}[\marg{num}] Choose the active variant. The argument must be a number between \code{1} - and the number set with \cmd*{SetVariations}. Initially set to \code{1}. - \Befehl{vary}{<variant 1>}\ma{<variant 2>}\newline + and the number set with \cs{SetVariations}. Initially set to \code{1}. + \command{vary}[\marg{variant 1}\marg{variant 2}] This command is the one actually used in the document. It has a number of - required arguments equal to the number set with \cmd*{SetVariations}. All + required arguments equal to the number set with \cs{SetVariations}. All of its arguments are discarded except the one specified with - \cmd*{variant}. - \Befehl{lastvariant}\newline% TODO: richtige version einfügen! - \sinceversion{0.7b}Each time \cmd{vary} is called it stores the value it - chose in \cmd{lastversion}. This might be convenient to use if one - otherwise would have to repeatedly write the same \cmd{vary}. -\end{beschreibung} - -\begin{beispiel} - \SetVariations{6}% - \variant{6}\vary{A}{B}{C}{D}{E}{F} - (last variant: \lastvariant) - \variant{1}\vary{A}{B}{C}{D}{E}{F} - (last variant: \lastvariant) - \variant{5}\vary{A}{B}{C}{D}{E}{F} - (last variant: \lastvariant) - \variant{2}\vary{A}{B}{C}{D}{E}{F} - (last variant: \lastvariant) - \variant{4}\vary{A}{B}{C}{D}{E}{F} - (last variant: \lastvariant) - \variant{3}\vary{A}{B}{C}{D}{E}{F} - (last variant: \lastvariant) -\end{beispiel} -\secidx*{Variations} - -\section{A Grade Distribution}\secidx{Grade Distribution} + \cs{variant}. + \command{lastvariant} + \sinceversion{0.7b}Each time \cs{vary} is called it stores the value it + chose in \cs{lastversion}. This might be convenient to use if one + otherwise would have to repeatedly write the same \cs{vary}. +\end{commands} + +\begin{example} + \SetVariations{6}% + \variant{6}\vary{A}{B}{C}{D}{E}{F} + (last variant: \lastvariant) + \variant{1}\vary{A}{B}{C}{D}{E}{F} + (last variant: \lastvariant) + \variant{5}\vary{A}{B}{C}{D}{E}{F} + (last variant: \lastvariant) + \variant{2}\vary{A}{B}{C}{D}{E}{F} + (last variant: \lastvariant) + \variant{4}\vary{A}{B}{C}{D}{E}{F} + (last variant: \lastvariant) + \variant{3}\vary{A}{B}{C}{D}{E}{F} + (last variant: \lastvariant) +\end{example} + +\section{A Grade Distribution} Probably this is a rather esoteric feature but it could proof useful in some cases. Suppose you are a German math teacher and want to grade exactly corresponding to the number of points relative to the sum of total points, regardless of how big that might be. You could do something like this to present your grading decisions for the exam: -\begin{beispiel} - % preamble: - % \DeclareRelGrades{ - % 1 = 1 , - % {1,5} = .9167 , - % 2 = .8333 , - % {2,5} = .75 , - % 3 = .6667 , - % {3,5} = .5833 , - % 4 = .5 - % } - \small\setlength\tabcolsep{2pt} - \begin{tabular}{r|*8c} - Punkte +\begin{example} + % preamble: + % \DeclareRelGrades{ + % 1 = 1 , + % {1,5} = .9167 , + % 2 = .8333 , + % {2,5} = .75 , + % 3 = .6667 , + % {3,5} = .5833 , + % 4 = .5 + % } + \small\setlength\tabcolsep{2pt} + \begin{tabular}{r|*8c} + Punkte & $\grade*{1}$ & $\le\grade*{1}$ & $\le\grade*{1,5}$ & $\le\grade*{2}$ & $\le\grade*{2,5}$ & $\le\grade*{3}$ & $\le\grade*{3,5}$ & $<\grade*{4}$ \\ - Note + Note & 1 & 1--2 & 2 & 2--3 & 3 & 3--4 & 4 & 5 - \end{tabular} -\end{beispiel} + \end{tabular} +\end{example} These are the available commands and options: -\begin{beschreibung} - \Befehl{DeclareRelGrades}{<grade>=<num>,...}\newline +\begin{commands} + \command{DeclareRelGrades}[\Marg{\meta{grade}=\meta{num},...}] This command is used to define grades and assign the percentage of total points to them. - \Befehl{grade}*{<grade>}\newline + \command{grade}[\sarg\marg{grade}] Gives the number of points corresponding to a grade depending on the value - of \cmd{pointssum} with or without (starred version) ``unit''. - \Option[grades]{round}{<num>}\Default{0} + of \cs{pointssum} with or without (starred version) ``unit''. +\end{commands} +\begin{options} + \keyval{round}{num}\Module{grades}\Default{0} The number of decimals the points of a grade are rounded to. This doesn't apply to the maximum number of points if the rounded number would be bigger than the actual sum. - \Option[grades]{half}{\default{true}|false}\Default{false} + \keybool{half}\Module{grades}\Default{false} If set to \code{true} points are rounded either to full or to half points. -\end{beschreibung} -\secidx*{Grade Distribution} +\end{options} \section{Selectively Include Questions from External Files}\label{sec:include} -\secidx{Include from External Files} \subsection{Caveat} -I need to say some words of caution: the \cmd{includequestions} that will be +I need to say some words of caution: the \cs{includequestions} that will be presented shortly is probably \ExSheets' most experimental one at the time of writing (\today). Thanks to feedback of users it is constantly improved and bugs are fixed. It is not a very efficient way to insert question regarding @@ -1393,213 +1351,224 @@ the capacities, anyway, so you'll have to live it, I'm afraid. Suppose you have one or more files with questions prepared to use them as a kind of database. One for class A, say, one for class B, one for class C and so one, something like this: -\begin{beispiel}[code only] - % this is file classA.tex - \begin{question}[class=A,ID=A1,topic=X] - First question of class A, topic X. - \end{question} - \begin{solution} - First solution of class A. - \end{solution} - \begin{question}[class=A,ID=A2,topic=Y] - Second question of class A, topic Y. - \end{question} - \begin{solution} - Second solution of class A. - \end{solution} - ... - % end of file classA.tex - \endinput -\end{beispiel} -You can of course just \cmd{input} or \cmd{include} it but that would of +\begin{sourcecode} + % this is file classA.tex + \begin{question}[class=A,ID=A1,topic=X] + First question of class A, topic X. + \end{question} + \begin{solution} + First solution of class A. + \end{solution} + \begin{question}[class=A,ID=A2,topic=Y] + Second question of class A, topic Y. + \end{question} + \begin{solution} + Second solution of class A. + \end{solution} + ... + % end of file classA.tex + \endinput +\end{sourcecode} +You can of course just \cs*{input} or \cs*{include} it but that would of course include the whole file into your document. But would't it be nice to just include selected questions? Or maybe a five random questions from the file? That is possible with the following command: -\begin{beschreibung} - \Befehl{includequestions}[<options>]{<list of filenames>} -\end{beschreibung} -If you use it without options it will have the same effect as -\cmd{input}. There are however the following options: -\begin{beschreibung} - \Option[include]{all}{\default{true}|false} - \Option[include]{IDs}{<list of IDs>}\Default{} +\begin{commands} + \command{includequestions}[\oarg{options}\marg{list of filenames}] + Include questions from external files. +\end{commands} +If you use it without options it will have the same effect as \cs*{input}. +There are however the following options: +\begin{options} + \keybool{all}\Module{include} + \keyval{IDs}{list of IDs}\Module{include}\Default Includes only the specified questions. - \Option[include]{random}{<num>}\Default{} - Includes \code{<num>} randomly selected questions. This option uses the - \paket{pgfcore} package to create the pseudo-random numbers. - \Option[include]{exclude}{<list of IDs>}\Default{} + \keyval{random}{num}\Module{include}\Default + Includes \meta{num} randomly selected questions. This option uses the + \pkg{pgfcore} package to create the pseudo-random numbers. + \keyval{exclude}{list of IDs}\Module{include}\Default Questions who's \acp{id} are specified here are \emph{not} included. This - option can be combined with the \key{random} option. -\end{beschreibung} + option can be combined with the \option{random} option. +\end{options} + The usage should be self-explainable: -\begin{beispiel}[code only] - % include questions A1, A3 and A4: - \includequestions[IDs={A1,A3,A4}]{classA.tex} - % or include 3 random questions: - \includequestions[random=3]{classA} -\end{beispiel} -In order to be able to select the questions \ExSheets needs to \cmd{input} the -file twice. The first time the available questions are determined, the second -time the selected questions are used. This unfortunately means that anything -that is \emph{not} part of a question or solution is also input twice. Either -don't put anything else into the file or use one of the following commands for -control: -\begin{beschreibung} - \Befehl{PrintIfIncludeActiveTF}\ma{<true code>}\ma{<false code>} - \Befehl{PrintIfIncludeActiveT}\ma{<true code>} - \Befehl{PrintIfIncludeActiveF}\ma{<false code>} -\end{beschreibung} +\begin{sourcecode} + % include questions A1, A3 and A4: + \includequestions[IDs={A1,A3,A4}]{classA.tex} + % or include 3 random questions: + \includequestions[random=3]{classA} +\end{sourcecode} +In order to be able to select the questions \ExSheets\ needs to \cs*{input} +the file twice. The first time the available questions are determined, the +second time the selected questions are used. This unfortunately means that +anything that is \emph{not} part of a question or solution is also input +twice. Either don't put anything else into the file or use one of the +following commands for control: +\begin{commands} + \command{PrintIfIncludeActiveTF}[\marg{true code}\marg{false code}] + Checks if the questions are actively included or not and puts \meta{true + code} or \meta{false code} in the input stream depending on the answer. + \command{PrintIfIncludeActiveT}[\marg{true code}] + Checks if the questions are actively included or not and puts \meta{true + code} in the input stream if the answer is yes. + \command{PrintIfIncludeActiveF}[\marg{false code}] + Checks if the questions are actively included or not and puts \meta{false + code} in the input stream if the answer is no. +\end{commands} The selection can be refined further by selecting questions belonging to a specific class of questions (see section~\ref{sec:dividing-concepts}) before -using \cmd{includequestions}. +using \cs{includequestions}. -\sinceversion{0.8}After you've used \cmd{includequestions} the \acp{id} of the +\sinceversion{0.8}After you've used \cs{includequestions} the \acp{id} of the included questions is available as an unordered comma separated list in the following macro: -\begin{beschreibung} - \Befehl{questionsincludedlast}\newline +\begin{commands} + \command{questionsincludedlast} Unordered comma separated list of question \acp{id} included with the last - usage of \cmd{includequestions}. -\end{beschreibung} -\secidx*{Include from External Files} + usage of \cs{includequestions}. +\end{commands} \section{Own Question/Solution Pairs} -\noindent\changedversion{0.9}\ExSheets provides he possibility to create new -environments that behave like the \code{question} and \code{solution} +\noindent\changedversion{0.9}\ExSheets\ provides he possibility to create new +environments that behave like the \env{question} and \env{solution} environments. This would allow, for example, to define a -\code{question*}/\code{solution*} environment pair for bonus questions. The +\env*{question*}/\env*{solution*} environment pair for bonus questions. The following commands may be used in the document preamble: -\begin{beschreibung} - \Befehl{NewQuSolPair}{<question>}\oa{<question options>}\oa{<general options>}% - \ma{<solution>}\oa{<solution options>}\oa{<general options>} - \Befehl{RenewQuSolPair}{<question>}\oa{<question options>}\oa{<general options>}% - \ma{<solution>}\oa{<solution options>}\oa{<general options>} -\end{beschreibung} +\begin{commands} + \command{NewQuSolPair}[\marg{question}\oarg{question options}\oarg{general + options}\marg{solution}\oarg{solution options}\oarg{general options}] + Define a new pair of question and solution environments. + \command{RenewQuSolPair}[\marg{question}\oarg{question options}\oarg{general + options}\marg{solution}\oarg{solution options}\oarg{general options}] + Redefine an existing pair of question and solution environments. +\end{commands} The standard environments are defined as follows: -\begin{beispiel}[code only] - \NewQuSolPair{question}{solution} -\end{beispiel} +\begin{sourcecode} + \NewQuSolPair{question}{solution} +\end{sourcecode} Let's say we want the possibility to add bonus questions. A simple way would be to define starred variants that add a star in the margin left to the title: -\begin{beispiel} - % preamble: - % \NewQuSolPair - % {question*}[name=\protect\llap{$\bigstar$\space}Bonus Question] - % {solution*}[name=\protect\llap{$\bigstar$\space}Solution] - \begin{question*} - This is a bonus question. - \end{question*} - \begin{solution*}[print] - This is what the solution looks like. - \end{solution*} -\end{beispiel} +\begin{example} + % preamble: + % - \texorpdfstring is provided by `hyperref' + % - \bigstar is provided by `amssymb' + % \DeclareRobustCommand*\questionstar{\texorpdfstring{\bonusquestionsign}{* }} + % \DeclareRobustCommand*\bonusquestionsign{\llap{$\bigstar$\space}} + % + % \NewQuSolPair + % {question*}[name=\questionstar Bonus Question] + % {solution*}[name=\questionstar Solution] + \begin{question*} + This is a bonus question. + \end{question*} + \begin{solution*}[print] + This is what the solution looks like. + \end{solution*} +\end{example} As you can see the environments take the same options as are described for the -standard \code{question} and \code{solution} environments. +standard \env{question} and \env{solution} environments. -\section{Filling in the Blanks}\secidx{Blanks} -\subsection{Cloze}\secidx[Cloze]{Blanks} +\section{Filling in the Blanks} +\subsection{Cloze} \noindent\changedversion{0.4}Both in exercise sheets and in exams it is sometimes desirable to be able to create \blank{blanks} that have to be filled in. Or maybe some more lines: \blank[width=5\linewidth]{} -\begin{beschreibung} - \Befehl{blank}*[<options>]{<text to be filled in>}\newline +\begin{commands} + \command{blank}[\sarg\oarg{options}\marg{text to be filled in}] creates a blank in normal text or in a question but fills the text of its argument if inside a solution. If used at the \emph{begin of a paragraph} - \cmd{blank} will do two things: it will set the linespread according to an - option explained below and will insert \cmd*{par} after the lines. If you + \cs{blank} will do two things: it will set the linespread according to an + option explained below and will insert \cs*{par} after the lines. If you don't want that use the starred version. -\end{beschreibung} +\end{commands} The options are these: -\begin{beschreibung} - \Option[blank]{style}{line|wave|dline|dotted|dashed}\Default{line} +\begin{options} + \keychoice{style}{line,wave,dline,dotted,dashed}\Module{blank}\Default{line} The style of the line. This uses the corresponding command from the - \paket{ulem} package and is the whole reason why \ExSheets loads it in the + \pkg{ulem} package and is the whole reason why \ExSheets\ loads it in the first place. - \Option[blank]{scale}{<num>}\Default{1} - Scales the width of the blank by factor \code{<num>} unless the width is + \keyval{scale}{num}\Module{blank}\Default{1} + Scales the width of the blank by factor \meta{num} unless the width is explicitly set. - \Option[blank]{width}{<dim>}\Default{} + \keyval{width}{dim}\Module{blank}\Default The width of the line. If it is not used the width of the filled in text is used. - \Option[blank]{linespread}{<num>}\Default{1} + \keyval{linespread}{num}\Module{blank}\Default{1} Set the linespread for the blank lines. This only has an effect if - \cmd{blank} is used at the begin of a paragraph. -\end{beschreibung} -\begin{beispiel} - \begin{question} - Try to fill in \blank[width=4cm]{these} blanks. All of them - \blank[style=dotted]{are created} by using the \cmd{blank} - \blank[style=dashed]{command}. - \end{question} - \begin{solution}[print] - Try to fill in \blank[width=4cm]{these} blanks. All of them - \blank[style=dotted]{are created} by using the \cmd{blank} - \blank[style=dashed]{command}. - \end{solution} -\end{beispiel} + \cs{blank} is used at the begin of a paragraph. +\end{options} +\begin{example} + \begin{question} + Try to fill in \blank[width=4cm]{these} blanks. All of them + \blank[style=dotted]{are created} by using the \cs{blank} + \blank[style=dashed]{command}. + \end{question} + \begin{solution}[print] + Try to fill in \blank[width=4cm]{these} blanks. All of them + \blank[style=dotted]{are created} by using the \cs{blank} + \blank[style=dashed]{command}. + \end{solution} +\end{example} A number of empty lines are easily created by setting the width option: -\begin{beispiel} - - \blank[width=4.8\linewidth,linespread=1.5]{} -\end{beispiel} +\begin{example} + \blank[width=4.8\linewidth,linespread=1.5]{} +\end{example} -\subsection{Vertical Space for answers}\secidx[vertical space]{Blanks} +\subsection{Vertical Space for answers} \noindent\sinceversion{0.3}When you're creating an exam you might want to add some vertical space where the students can write down their answers. While -you can always use \cmd*{vspace} this is not always handy when the space left +you can always use \cs*{vspace} this is not always handy when the space left on the page is less than you want. In this case it would be nice if a) there would be no warning and b) the rest of the space would be added at the top of the next page. This is what the following command is for: -\begin{beschreibung} - \Befehl{examspace}*{<dim>}\newline - Add space as specified in \ma{<dim>}. If the space available on the +\begin{commands} + \command{examspace}[\sarg\marg{dim}] + Add space as specified in \meta{dim}. If the space available on the current page is not enough the rest of the space will be added at the top of the next page. The starred version will silently drop any leftover space instead of adding it to the next page. -\end{beschreibung} -\begin{beispiel} - \begin{question} - What do you think of this feature? - \examspace{3cm} - \end{question} - This line comes after the space. -\end{beispiel} -\secidx*{Blanks} +\end{commands} +\begin{example}[side-by-side] + \begin{question} + What do you think of this feature? + \examspace{3cm} + \end{question} + This line comes after the space. +\end{example} \section{Styling your Exercise/Exam Sheets}\label{part:style} \subsection{Background} -The \ExSheets package makes extensive use of \LaTeX3's coffins\footnote{See - the documentation to the \paket*{xcoffins} package for more information on +The \ExSheets\ package makes extensive use of \LaTeX3's coffins\footnote{See + the documentation to the \pkg{xcoffins} package for more information on that.} as well as its templates concept\footnote{Have a look into the - documentation to the \paket*{xtemplate} package.}. The latter allows a + documentation to the \pkg{xtemplate} package.}. The latter allows a rather easy extension and customization of some of \ExSheets' environments. To be more precise: you can define your own instances for the headings used -for questions and solutions and for the \code{tasks} environment. +for questions and solutions and for the \env{tasks} environment. What this package doesn't provide is changing the background of questions or -framing them. But this is easily possible using the \paket{mdframed} package -and its \cmd*{surroundwithmdframed} command. +framing them. But this is easily possible using the \pkg{mdframed} package +and its \cs*{surroundwithmdframed} command. \subsection{The \code{exsheets-headings} Object}\label{sec:exsheets-headings} -\secidx{The `exsheets-headings' Object} -\ExSheets defines the object \code{exsheets-headings} and one template for it, +\ExSheets\ defines the object \code{exsheets-headings} and one template for it, the `default' template. The package also defines two instances of this template, the `block' instance and the `runin' instance. -\begin{beispiel} - \SetupExSheets{headings=block} - \begin{question}{1} - a `block' heading - \end{question} - \SetupExSheets{headings=runin} - \begin{question}{1} - a `runin' heading - \end{question} -\end{beispiel} +\begin{example} + \SetupExSheets{headings=block} + \begin{question}{1} + a `block' heading + \end{question} + \SetupExSheets{headings=runin} + \begin{question}{1} + a `runin' heading + \end{question} +\end{example} \subsubsection{Available Options} This section only lists the options that can be used when defining an instance @@ -1607,51 +1576,51 @@ of the `default' template. The following subsections will give loads of examples of their usage. The options are listed in the definition for the template interface: -\begin{beispiel}[code only] - \DeclareTemplateInterface{exsheets-heading}{default}{3} - { - % option : type = default - inline : boolean = false , - runin : boolean = false , - indent-first : boolean = false , - toc-reversed : boolean = false , - vscale : real = 1 , - above : length = 2pt , - below : length = 2pt , - main : tokenlist = , - pre-code : tokenlist = , - post-code : tokenlist = , - title-format : tokenlist = , - title-pre-code : tokenlist = , - title-post-code : tokenlist = , - number-format : tokenlist = , - number-pre-code : tokenlist = , - number-post-code : tokenlist = , - points-format : tokenlist = , - points-pre-code : tokenlist = , - points-post-code : tokenlist = , - join : tokenlist = , - attach : tokenlist = +\begin{sourcecode} + \DeclareTemplateInterface{exsheets-heading}{default}{3}{ + % option : type = default + inline : boolean = false , + runin : boolean = false , + indent-first : boolean = false , + toc-reversed : boolean = false , + vscale : real = 1 , + above : length = 2pt , + below : length = 2pt , + main : tokenlist = , + pre-code : tokenlist = , + post-code : tokenlist = , + title-format : tokenlist = , + title-pre-code : tokenlist = , + title-post-code : tokenlist = , + number-format : tokenlist = , + number-pre-code : tokenlist = , + number-post-code : tokenlist = , + subtitle-pre-code : tokenlist = , + subtitle-post-code : tokenlist = , + points-format : tokenlist = , + points-pre-code : tokenlist = , + points-post-code : tokenlist = , + join : tokenlist = , + attach : tokenlist = } -\end{beispiel} +\end{sourcecode} - -Each heading is built with at most four coffins available with the names -`main', `title', `number' and `points'. Those coffins place possibly the -whole heading, the title, the question number and the assigned points. The -only coffin that's always typeset is the `main' coffin, which is empty per -default. +Each heading is built with at most five coffins available with the names +`main', `title', `subtitle', `number' and `points'. Those coffins place +possibly the whole heading, the title, the subtitle, the question number and +the assigned points. The only coffin that's always typeset is the `main' +coffin, which is empty per default. Coffins can be joined (two become one, the first extends its bounding box to contain the second) using the following syntax: -\begin{beispiel}[code only] - join = coffin1[handle11,handle12]coffin2[handle21,handle22](x-offset,y-offset) -\end{beispiel} +\begin{sourcecode} + join = coffin1[handle11,handle12]coffin2[handle21,handle22](x-offset,y-offset) +\end{sourcecode} The syntax for attaching (two become one, the first does \emph{not} extend its bounding box around the second) is the same. More on coffin handles is described in the documentation for the -\paket{xcoffins}. Figure~\ref{fig:handles} briefly demonstrates the available +\pkg{xcoffins}. Figure~\ref{fig:handles} briefly demonstrates the available handle pairs. \begin{figure}[ht] @@ -1665,44 +1634,51 @@ handle pairs. \end{figure} The following subsections will show all definitions of the instances available -with the package option \key{load-headings} and how they look. This will +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 \key{load-headings} each of the following instances is -available through the option \key{headings}{<instance>}. +Of you use the option \option{load-headings} each of the following instances is +available through the option \key{headings}{instance}. The following examples use a sample text defined as follows: -\begin{beispiel}[code only] - \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} -\end{beispiel} +\begin{sourcecode} + \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} +\end{sourcecode} \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} +All of the following examples use the same question call: +\begin{sourcecode} + \SetupExSheets{headings=<name>} + \begin{question}[subtitle=The subtitle of the question]{1} + A `<name>' heading. \sample + \end{question} +\end{sourcecode} + \subsubsection{The `block' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{block}{default} - { - join = { title[r,B]number[l,B](1ex,0pt) } , +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block}{default}{ + join = { title[r,B]number[l,B](.333em,0pt) } , attach = { main[l,vc]title[l,vc](0pt,0pt) ; main[r,vc]points[l,vc](\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=block} -\begin{question}{1} - A `block' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `block' heading. \sample \end{question} +\newpage \subsubsection{The `runin' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin}{default}{ runin = true , number-post-code = \space , attach = @@ -1710,143 +1686,154 @@ The following examples use a sample text defined as follows: join = { main[r,vc]title[r,vc](0pt,0pt) ; - main[r,vc]number[l,vc](1ex,0pt) + main[r,vc]number[l,vc](.333em,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin} -\begin{question}{1} - A `runin' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin' heading. \sample \end{question} \subsubsection{The `simple' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{simple}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{simple}{default}{ title-format = \normalsize , points-pre-code = ( , points-post-code = ) , attach = { main[l,t]number[l,t](0pt,0pt) } , join = { - number[r,b]title[l,b](1ex,0pt) ; + number[r,b]title[l,b](.333em,0pt) ; main[l,b]points[l,t](1em,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=simple} -\begin{question}{1} - A `simple' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `simple' heading. \sample \end{question} +\newpage \subsubsection{The `empty' Instance} \sinceversion{0.9a} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{empty}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{empty}{default}{ runin = true , above = \parskip , below = \parskip , attach = { main[l,vc]points[l,vc](\linewidth+\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=empty} -\begin{question}{1} - An `empty' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + An `empty' heading. \sample \end{question} \subsubsection{The `block-rev' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{block-rev}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block-rev}{default}{ toc-reversed = true , - join = { number[r,B]title[l,B](1ex,0pt) } , + join = { number[r,B]title[l,B](.333em,0pt) } , attach = { main[l,vc]number[l,vc](0pt,0pt) ; main[r,vc]points[l,vc](\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=block-rev} -\begin{question}{1} - A `block-rev' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `block-rev' heading. \sample \end{question} +\subsubsection{The `block-subtitle' Instance} +\sinceversion{0.10} +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block-subtitle}{default}{ + join = { + title[r,B]number[l,B](.333em,0pt) ; + title[r,B]subtitle[l,B](1em,0pt) + } , + attach = { + main[l,vc]title[l,vc](0pt,0pt) ; + main[r,vc]points[l,vc](\marginparsep,0pt) + } + } +\end{sourcecode} +\SetupExSheets{headings=block-subtitle} +\begin{question}[subtitle=The subtitle of the question]{1} + A `block-subtitle' heading. \sample +\end{question} \subsubsection{The `block-wp' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{block-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block-wp}{default}{ points-pre-code = ( , points-post-code = ) , join = { - title[r,B]number[l,B](1ex,0pt) ; - title[r,B]points[l,B](1ex,0pt) + title[r,B]number[l,B](.333em,0pt) ; + title[r,B]points[l,B](.333em,0pt) } , attach = { main[l,vc]title[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=block-wp} -\begin{question}{1} - A `block-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `block-wp' heading. \sample \end{question} \subsubsection{The `block-wp-rev' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{block-wp-rev}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block-wp-rev}{default}{ toc-reversed = true , points-pre-code = ( , points-post-code = ) , join = { - number[r,B]title[l,B](1ex,0pt) ; - number[r,B]points[l,B](1ex,0pt) + number[r,B]title[l,B](.333em,0pt) ; + number[r,B]points[l,B](.333em,0pt) } , attach = { main[l,vc]number[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=block-wp-rev} -\begin{question}{1} - A `block-wp-rev' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `block-wp-rev' heading. \sample \end{question} \subsubsection{The `block-nr' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{block-nr}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block-nr}{default}{ attach = { main[l,vc]number[l,vc](0pt,0pt) ; main[r,vc]points[l,vc](\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=block-nr} -\begin{question}{1} - A `block-nr' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `block-nr' heading. \sample \end{question} \subsubsection{The `block-nr-wp' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{block-nr-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{block-nr-wp}{default}{ points-pre-code = ( , points-post-code = ) , - join = { number[r,vc]points[l,vc](1ex,0pt) } , + join = { number[r,vc]points[l,vc](.333em,0pt) } , attach = { main[l,vc]number[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=block-nr-wp} -\begin{question}{1} - A `block-nr-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `block-nr-wp' heading. \sample \end{question} \subsubsection{The `runin-rev' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin-rev}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin-rev}{default}{ toc-reversed = true , runin = true , title-post-code = \space , @@ -1855,39 +1842,37 @@ The following examples use a sample text defined as follows: join = { main[r,vc]number[r,vc](0pt,0pt) ; - main[r,vc]title[l,vc](1ex,0pt) + main[r,vc]title[l,vc](.333em,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin-rev} -\begin{question}{1} - A `runin-rev' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin-rev' heading. \sample \end{question} \subsubsection{The `runin-wp' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin-wp}{default}{ runin = true , points-pre-code = ( , points-post-code = )\space , join = { main[r,vc]title[r,vc](0pt,0pt) ; - main[r,vc]number[l,vc](1ex,0pt) ; - main[r,vc]points[l,vc](1ex,0pt) + main[r,vc]number[l,vc](.333em,0pt) ; + main[r,vc]points[l,vc](.333em,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin-wp} -\begin{question}{1} - A `runin-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin-wp' heading. \sample \end{question} \subsubsection{The `runin-wp-rev' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin-wp-rev}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin-wp-rev}{default}{ toc-reversed = true , runin = true , points-pre-code = ( , @@ -1895,37 +1880,34 @@ The following examples use a sample text defined as follows: join = { main[r,vc]number[r,vc](0pt,0pt) ; - main[r,vc]title[l,vc](1ex,0pt) ; - main[r,vc]points[l,vc](1ex,0pt) + main[r,vc]title[l,vc](.333em,0pt) ; + main[r,vc]points[l,vc](.333em,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin-wp-rev} -\begin{question}{1} - A `runin-wp-rev' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin-wp-rev' heading. \sample \end{question} \subsubsection{The `runin-nr' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin-nr}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin-nr}{default}{ runin = true , number-post-code = \space , attach = { main[l,vc]points[l,vc](\linewidth+\marginparsep,0pt) } , join = { main[r,vc]number[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin-nr} -\begin{question}{1} - A `runin-nr' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin-nr' heading. \sample \end{question} -\newpage \subsubsection{The `runin-fixed-nr' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin-fixed-nr}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin-fixed-nr}{default}{ runin = true , number-pre-code = \hbox to 2em \bgroup , number-post-code = \hfil\egroup , @@ -1933,37 +1915,35 @@ The following examples use a sample text defined as follows: { main[l,vc]points[l,vc](\linewidth+\marginparsep,0pt) } , join = { main[r,vc]number[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin-fixed-nr} -\begin{question}{1} - A `runin-fixed-nr' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin-fixed-nr' heading. \sample \end{question} +\newpage \subsubsection{The `runin-nr-wp' Instance} -\needspace{2\baselineskip} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{runin-nr-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{runin-nr-wp}{default}{ runin = true , points-pre-code = ( , points-post-code = )\space , join = { main[r,vc]number[l,vc](0pt,0pt) ; - main[r,vc]points[l,vc](1ex,0pt) + main[r,vc]points[l,vc](.333em,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=runin-nr-wp} -\begin{question}{1} - A `runin-nr-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `runin-nr-wp' heading. \sample \end{question} \subsubsection{The `inline' Instance} \sinceversion{0.5} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{inline}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{inline}{default}{ inline = true , number-pre-code = \space , number-post-code = \space , @@ -1973,19 +1953,18 @@ The following examples use a sample text defined as follows: main[r,vc]number[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=inline} Text before -\begin{question}{1} - An `inline' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + An `inline' heading. \sample \end{question} Text after \subsubsection{The `inline-wp' Instance} \sinceversion{0.5} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{inline-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{inline-wp}{default}{ inline = true , number-pre-code = \space , number-post-code = \space , @@ -1998,126 +1977,119 @@ Text before main[r,vc]points[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=inline-wp} Text before -\begin{question}{1} - An `inline-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + An `inline-wp' heading. \sample \end{question} Text after \subsubsection{The `inline-nr' Instance} \sinceversion{0.5} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{inline-nr}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{inline-nr}{default}{ inline = true , number-post-code = \space , join = { main[r,vc]number[l,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=inline-nr} Text before -\begin{question}{1} - An `inline-nr' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + An `inline-nr' heading. \sample \end{question} Text after \subsubsection{The `centered' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{centered}{default} - { - join = { title[r,B]number[l,B](1ex,0pt) } , +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{centered}{default}{ + join = { title[r,B]number[l,B](.333em,0pt) } , attach = { main[hc,vc]title[hc,vc](0pt,0pt) ; main[r,vc]points[l,vc](\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=centered} -\begin{question}{1} - A `centered' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `centered' heading. \sample \end{question} \subsubsection{The `centered-wp' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{centered-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{centered-wp}{default}{ points-pre-code = ( , points-post-code = ) , join = { - title[r,B]number[l,B](1ex,0pt) ; - title[r,B]points[l,B](1ex,0pt) + title[r,B]number[l,B](.333em,0pt) ; + title[r,B]points[l,B](.333em,0pt) } , attach = { main[hc,vc]title[hc,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=centered-wp} -\begin{question}{1} - A `centered-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `centered-wp' heading. \sample \end{question} \subsubsection{The `margin' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{margin}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{margin}{default}{ runin = true , number-post-code = \space , points-pre-code = ( , points-post-code = )\space , - join = { title[r,b]number[l,b](1ex,0pt) } , + join = { title[r,b]number[l,b](.333em,0pt) } , attach = { main[l,vc]title[r,vc](0pt,0pt) ; main[l,b]points[r,t](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=margin} -\begin{question}{1} - A `margin' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `margin' heading. \sample \end{question} \subsubsection{The `margin-nr' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{margin-nr}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{margin-nr}{default}{ runin = true , attach = { - main[l,vc]number[r,vc](-1ex,0pt) ; + main[l,vc]number[r,vc](-.333em,0pt) ; main[r,vc]points[l,vc](\linewidth+\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=margin-nr} -\begin{question}{1} - A `margin-nr' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `margin-nr' heading. \sample \end{question} \subsubsection{The `raggedleft' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{raggedleft}{default} - { - join = { title[r,B]number[l,B](1ex,0pt) } , +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{raggedleft}{default}{ + join = { title[r,B]number[l,B](.333em,0pt) } , attach = { main[r,vc]title[r,vc](0pt,0pt) ; main[r,vc]points[l,vc](\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=raggedleft} -\begin{question}{1} - A `raggedleft' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `raggedleft' heading. \sample \end{question} \subsubsection{The `fancy' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{fancy}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{fancy}{default}{ toc-reversed = true , indent-first = true , vscale = 2 , @@ -2126,23 +2098,22 @@ Text before title-format = \large\scshape\color{exsheetsred} , number-format = \large\bfseries\color{exsheetsblue} , points-format = \itshape , - join = { number[r,B] title[l,B] (1ex,0pt) } , + join = { number[r,B] title[l,B] (.333em,0pt) } , attach = { main[hc,vc]number[hc,vc](0pt,0pt) ; main[l,vc]points[r,vc](-\marginparsep,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=fancy} -\begin{question}{1} - A `fancy' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `fancy' heading. \sample \end{question} \subsubsection{The `fancy-wp' Instance} -\begin{beispiel}[code only] - \DeclareInstance{exsheets-heading}{fancy-wp}{default} - { +\begin{sourcecode} + \DeclareInstance{exsheets-heading}{fancy-wp}{default}{ toc-reversed = true , indent-first = true , vscale = 2 , @@ -2155,48 +2126,127 @@ Text before points-post-code = ) , join = { - number[r,B]title[l,B](1ex,0pt) ; - number[r,B]points[l,B](1ex,0pt) + number[r,B]title[l,B](.333em,0pt) ; + number[r,B]points[l,B](.333em,0pt) } , attach = { main[hc,vc]number[hc,vc](0pt,0pt) } } -\end{beispiel} +\end{sourcecode} \SetupExSheets{headings=fancy-wp} -\begin{question}{1} - A `fancy-wp' heading. \sample +\begin{question}[subtitle=The subtitle of the question]{1} + A `fancy-wp' heading. \sample \end{question} -\secidx*{The `exsheets-headings' Object} -\subsection{Load Custom Configurations}\secidx{Custom Configurations} +\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 -will be loaded \cmd*{AtBeginDocument}. -\secidx*{Custom Configurations} -\secidx*{\ExSheets}[ExSheets] -\SetupExSheets{headings=block} +will be loaded \cs*{AtBeginDocument}. -\part{The \Tasks package (\tasksversion)}\label{part:tasks} -\secidx{\Tasks}[tasks] -\section{About the Documentation} -\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. +\SetupExSheets{headings=block} -\part{The \cntformats package (\cntfmtsversion)} -\label{part:cntformats}\secidx{\cntformats}[cntformats] -\section{About the Documentation} -\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. +\part{The \ExSheetslistings\ Package \exsheetslistingsverion}\label{part:listings} +\section{The Problem} +I knew the day would come when people would ask how to include verbatim +material in the \env{question} and \env{solution} environments. Since they're +defined with the \pkg{environ} package they're reading their environment +bodies like macros read their arguments. This makes it impossible to use +verbatim material inside them\footnote{See the \TeX\ \acs{faq} + \url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbwithin} for reasons + why.}. Now the day has come~\cite{tex.sx:131546}. Soon after the first +question appeared I wrote the first draft for \ExSheetslistings\ for a question +on \TeX.sx~\cite{tex.sx:133907}. + +\section{The Proposed Solution} + +The \ExSheetslistings\ package defines \pkg{listings} environments that place +their contents inside \env{question} and \env{solution} environments. They do +this by writing the listing to a unique auxiliary file -- +questions to \code{\cs*{jobname}-ex\meta{num}.lst} and solutions to +\code{\cs*{jobname}-sol\meta{num}.lst} where \meta{num} is an increasing +integer that ensures that each listing gets a unique file name. Those files +are then included with \cs{lstinutlisting} if and when the question or +solution is printed. + +\begin{environments} + \environment{lstquestion}[\oarg{options}] + A \pkg{listings} environment placed in a \env{question}. + \environment{lstsolution}[\oarg{options}] + A \pkg{listings} environment placed in a \env{solution}. +\end{environments} + +All you have to do to use the package is loading it the usual way: +\begin{sourcecode} + \usepackage{exsheets-listings} +\end{sourcecode} +This will also load the packages \ExSheets\ and \pkg{listings} if they're not +loaded already. + +\begin{example} + % this uses my listings style used in this documentation for all pieces of + % code: + \begin{lstquestion}[% + pre=Explain what this piece of \LaTeX\ code does:, + listings={style=cnltx}] + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname foo\endcsname\relax + ... + \else + ... + \fi + \end{lstquestion} +\end{example} + +The example already shows two options of these environments. Here is the +complete list: +\begin{options} + \keyval{pre}{text} + \meta{text} is placed before the code in the \env{question} or + \env{solution} environment. + \keyval{post}{text} + \meta{text} is placed after the code in the \env{question} or + \env{solution} environment. + \keyval{options}{options} + Options passed to underlying the \env{question} or \env{solution} + environment. + \keyval{points}{points} + The points assigned to the underlying \env{question} environment. + \keyval{listings}{options} + Options passed to the underlying \pkg{listings} environment. +\end{options} + +There are also two new options for \ExSheets\ that can be set with +\cs{SetupExSheets}: +\begin{options} + \keyval{listings}{options}\Module{question} + Options passed to the underlying \pkg{listings} environment of + \env{lstquestion}. + \keyval{listings}{options}\Module{solution} + Options passed to the underlying \pkg{listings} environment of + \env{lstsolution}. +\end{options} + +\section{Own Environments} + +\begin{commands} + \command{NewLstQuSolPair}[\oarg{options for both environments}\marg{lst question + env}\marg{question env}\oarg{options for lst question env}\marg{lst + solution env}\marg{solution env}\oarg{options for lst solution env}] + Defines two new \pkg{listings} environments that place the listing in a + question environment \meta{question env} or a solution environment + \meta{solution env}. Those underlying environments should be + environments as defined by \cs{NewQuSolPair}. The different options + allow to preset options for the newly defined environments. +\end{commands} + +The existing environments have been defined like this: +\begin{sourcecode} + \NewLstQuSolPair{lstquestion}{question}{lstsolution}{solution} +\end{sourcecode} \appendix \part{Appendix} -\addsec{A List of all Solutions used in this Manual}\label{sec:solutions:list} +\section{A List of all Solutions used in this Manual}\label{sec:solutions:list} \SetupExSheets{headings=block-wp,solutions-totoc} \printsolutions -\RaggedRight\printbibliography - -\setindexpreamble{Section titles are indicated \textbf{bold}, packages \textsf{sans -serif}, commands \code{\textbackslash\textcolor{code}{brown}}, options \textcolor -{key}{\code{yellow}} and modules \textcolor{module}{\code{blue}}.} -\printindex \end{document} diff --git a/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf b/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf Binary files differindex 877e59b6538..39e41770f3b 100644 --- a/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf +++ b/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf diff --git a/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex b/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex index 62967bad831..5a9ff2442cc 100644 --- a/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex @@ -31,71 +31,39 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -% -% if you want to compile this documentation you'll need the document class -% `cnpkgdoc' which you can get here: -% https://bitbucket.org/cgnieder/cnpkgdoc/ -% the class is licensed LPPL 1.3 or later -% -% use `pdflatex' and `biber' for compilation -% -\PassOptionsToPackage{supstfm=libertinesups}{superiors} -\documentclass[DIV9,toc=index,toc=bib,numbers=noendperiod]{cnpkgdoc} -% ---------------------------------------------------------------------------- -% document layout and typographic features -\docsetup{ - pkg = {[more]tasks} , +\documentclass[load-preamble+]{cnltx-doc} +\usepackage[more]{tasks} + +\setcnltx{ + package = {tasks} , + authors = Clemens Niederberger , + email = {contact@mychemistry.eu} , url = {https://bitbucket.org/cgnieder/exsheets/} , - title = \Tasks , - subtitle = {% - {\small - part of the \href{exsheets_en.pdf}{\ExSheets} bundle% - }\\[\baselineskip] + info = {% + {\small part of the \href{exsheets_en.pdf}{\ExSheets} + bundle}\\[\baselineskip] create horizontal columned lists% } , - name = tasks , - language = en , - modules = true , - code-box = { - backgroundcolor = gray!7!white , - skipbelow = .6\baselineskip plus .5ex minus .5ex , - skipabove = .6\baselineskip plus .5ex minus .5ex , - innerleftmargin = 1.5em , - innerrightmargin = 2.5em + add-cmds = { + checkedchoicebox , + choicebox, + NewTasks, + settasks, + startnewitemline , + task } , - gobble = 1 + add-silent-cmds = { + choice, correct, + DeclareInstance, DeclareTemplateInterface, + leftthumbsup, + s, sample + } } -\usepackage{libertinehologopatch} -\cnpkgusecolorscheme{friendly} - -\usepackage[biblatex]{embrac}[2012/06/29] - \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] - \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] -\usepackage{microtype} -\usepackage[multiple]{fnpct} - -\renewcommand*\othersectionlevelsformat[3]{\textcolor{main}{#3\autodot}\enskip} -\renewcommand*\partformat{\textcolor{main}{\partname~\thepart\autodot}} -\pagestyle{headings} - -\setcapindent{1.5em} -\setkomafont{caption}{\normalfont\footnotesize\sffamily} -\setkomafont{captionlabel}{\normalfont\footnotesize\sffamily\scshape} - -\usepackage{booktabs,array,ragged2e} - -% ---------------------------------------------------------------------------- -% code examples -\newcommand*\Tasks{{\scshape\textcolor{main}{tasks}}\xspace} -\newcommand*\ExSheets{{\scshape\textcolor{main}{ExSheets}}\xspace} - -\addcmds{ - choice, correct, - DeclareInstance, DeclareTemplateInterface, - leftthumbsup, NewTasks, - s, sample, settasks, task -} +\newpackagename\ExSheets{ExSheets} +\newpackagename\ExSheetslistings{ExSheets-listings} +\newpackagename\cntformats{cntformats} +\newpackagename\Tasks{tasks} % ---------------------------------------------------------------------------- % other packages, bibliography, index @@ -110,368 +78,292 @@ } \usepackage{filecontents} -\usepackage{imakeidx} -\begin{filecontents*}{\jobname.ist} - heading_prefix "{\\bfseries " - heading_suffix "\\hfil}\\nopagebreak\n" - headings_flag 1 - delim_0 "\\dotfill\\hyperpage{" - delim_1 "\\dotfill\\hyperpage{" - delim_2 "\\dotfill\\hyperpage{" - delim_r "}\\textendash\\hyperpage{" - delim_t "}" - suffix_2p "\\nohyperpage{\\,f.}" - suffix_3p "\\nohyperpage{\\,ff.}" -\end{filecontents*} -\indexsetup{othercode=\footnotesize} -\makeindex[options={-s \jobname.ist},intoc,columns=3] - \usepackage{csquotes} -\usepackage[backend=biber,style=alphabetic]{biblatex} + % ---------------------------------------------------------------------------- % example definitions that have to be done in the preamble: \usepackage{exsheets} \usepackage{dingbat} -\NewTasks[style=multiplechoice]{choices}[\choice](3) +\NewTasks[style=multiplechoice]{multiplechoice}[\choice](3) \newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} -% ---------------------------------------------------------------------------- -% custom commands -\newcommand*\Default[1]{% - \hfill\llap - {% - \ifblank{#1}% - {(initially~empty)}% - {Default:~\code{#1}}% - }% - \newline -} -\newcommand*\required{\hfill\llap{required}\newline} -\newcommand*\optional{\hfill\llap{optional}\newline} - -\newcommand*\nooption[2]{\item[\code{\textcolor{key}{#1} = #2}] \cnpkgdocarrow\ } - -\newcommand*\unexpsign{$\RHD$} -\newcommand*\expsign{\textcolor{red}{$\rhd$}} -\renewcommand*\cnpkgdoctriangle{\unexpsign} -\newcommand*\expandable{% - \def\cnpkgdoctriangle{% - \expsign - \gdef\cnpkgdoctriangle{\unexpsign}}} - -\usepackage{marginnote} -\makeatletter -\newcommand*\sinceversion[1]{% - \@bsphack - \marginnote{% - \footnotesize\sffamily\RaggedRight - \textcolor{black!75}{Introduced in version~#1}}% - \@esphack} -\newcommand*\changedversion[1]{% - \@bsphack - \marginnote{% - \footnotesize\sffamily\RaggedRight - \textcolor{black!75}{Changed in version~#1}}% - \@esphack} -\makeatother - -\pdfstringdefDisableCommands{\def\llap#1{#1\space}\def\bigstar{*}} -% ---------------------------------------------------------------------------- \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}\secidx{Motivation} -\noindent\changedversion{0.7}Originally \Tasks has been an integral part of -\ExSheets. 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 \code{tasks} environment available. Since I agree with this the +\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 \code{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 \paket{enumitem} package -for customization. -\secidx*{Motivation} +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}\secidx{Requirements} -\Tasks is placed under the terms of the \LaTeX{} Project Public License, -version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). It has -the status ``maintained.'' +\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}. -\Tasks requires packages \paket{l3kernel} ,\paket{xparse}, \paket{l3keys2e}, -\paket{epic}, \paket*{cntformats}\footnote{Part of the \ExSheets bundle}, -\paket{xtemplate} and \paket{environ}. -\secidx*{Requirements} \section{How it works} \subsection{The Basics} -The \code{tasks} environment is similar to a list like \code{enumerate} but not +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 \cmd*{item} - but \cmd{task} so it is unique to this environment only. -\item A fourth difference: the \code{tasks} environment cannot be nested. - You can, however, use an \code{itemize} environment or something in it. -\item A fifth difference: verbatim material cannot be used in it. You'll - have to use \cmd*{string}, \cmd*{texttt} or \cmd*{detokenize}. If this - won't suffice then don't use \code{tasks}. -\item A sixth difference: %footnotes + \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{beschreibung} - \Umg{tasks}[<options>]{\unskip\da{<num of columns>} \cmd{task}\ldots} -\end{beschreibung} +\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{beispiel}[code only] - % \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{beispiel} -Some text before the list. -\begin{tasks} - \task \sample - \task \sample - \task \sample -\end{tasks} -And also some text after it. - -The environment takes the optional argument \da{<num of columns>} with which +\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{beispiel}[code only] - \begin{tasks}(2) - \task \sample - \task \s\ \s - \task \s - \task \sample - \task \s\par\s - \end{tasks} -\end{beispiel} -\begin{tasks}(2) - \task \sample - \task \s\ \s - \task \s - \task \sample - \task \s\par\s -\end{tasks} +\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} -\noindent\sinceversion{0.9}Sometimes it may come in handy if the current -row of items could be terminated and a new one is started. This is possible -with the following command: -\begin{beschreibung} - \Befehl{startnewitemline} -\end{beschreibung} -\begin{beispiel}[code only] - \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{beispiel} -\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} - -\section{Available Options}\secidx{Options}\label{sec:tasks:options} -The \Tasks package has one package option which also is called when you load -\ExSheets with the \key{load-tasks} option. -\begin{beschreibung} - \Option{more}\newline - load additional instances for the \code{tasks} object, details are explained - later in section~\ref{sec:tasks:instances}. -\end{beschreibung} - -The environment itself has some more options, namely these: -\begin{beschreibung} - \Option{style}{<instance>}\Default{} - Choose the instance to be used. Read more on this in - section~\ref{sec:tasks}. - \Option{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}: \cmd{arabic}, \code{a}: - \cmd{alph}, \code{A}: \cmd{Alph}, \code{r}: \cmd{roman} and \code{R}: - \cmd{Roman}. - \Option{label-format}{<code>}\Default{} - \changedversion{0.9}Can be used to apply a formatting like, \emph{e.g.}, - \cmd*{bfseries} to the labels. - \Option{label}{<code>}\Default{} - \changedversion{0.9}Overwrite the automatic label to a custom one. - \Option{label-width}{<dim>}\Default{1em} - Sets the width of the item labels. - \Option{label-offset}{<dim>}\Default{.3333em} - \sinceversion{0.7}Sets the offset, \emph{i.e.}, the distance between label - and item. - \Option{item-indent}\Default{2.5em} - \sinceversion{0.9a}The indent of an item, \textit{i.e.}, the horizontal - space available for both label and label-offset. If \code{indent = - label-width + label=offset} the label will align with the textblock above - (if \key{label-align}{left} is set). - \Option{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 \key{label-width}. - \Option{before-skip}{<skip>}\Default{0pt} - Sets the skip before the list. - \Option{after-skip}{<skip>}\Default{0pt} - Sets the skip after the list. - \Option{after-item-skip}{<skip>}\Default{1ex plus 1ex minus 1ex} - \sinceversion{0.9}This vertical skip is inserted between rows of items. - \Option{resume}{\default{true}|false}\Default{false} - The enumeration will resume from a previous \code{tasks} environment. In - order to use this option properly you shouldn't mix different \code{tasks} - environments that both count their items. -\end{beschreibung} -These options can also be set using a setup command: -\begin{beschreibung} - \Befehl{settasks}{<options>} -\end{beschreibung} +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{beispiel}[code only] - \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} -\end{beispiel} -\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, \textit{i.e.}, inside \ExSheets' -\code{question} environment: -\begin{beispiel} - % 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! +\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{solution} -\end{beispiel} -\secidx*{Options} +\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 \key{more} of the \Tasks package or load -\ExSheets with the \key{load-tasks} option there are currently three +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 \cmd{labelitemi} as labels. - \item[enumerate] enumerates the items with 1., 2., \ldots - \item[multiplechoice] a --~well~-- `multiple choice' list. + \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{beispiel} - \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{beispiel} - -\section{Custom Labels}\secidx{Custom Labels} +\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 \cmd{task}. This will temporarily overwrite the default label. -\begin{beispiel} - \begin{tasks}[style=itemize] - \task a standard item - \task another one - \task[+] a different one - \task and another one - \end{tasks} -\end{beispiel} -\secidx*{Custom Labels} - -\section{New Tasks}\secidx{Own Environments} +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{beschreibung} - \Befehl{NewTasks}[<options>]{<name>}\oa{<separator}\da{<cols>}\newline - Define environment \ma{<name>} that uses \code{<separator>} to introduce a - new item. Default for \code{<separator>} is \cmd{task}, default for - \code{<cols>} is \code{1}. The \code{<options>} are the ones described in - section~\ref{sec:tasks:options}. - \Befehl{RenewTasks}[<options>]{<name>}\oa{<separator}\da{<cols>}\newline - Renew environment previously defined with \cmd{NewTasks}. -\end{beschreibung} -The \code{tasks} environment is defined as follows: -\begin{beispiel}[code only] - \NewTasks{tasks} -\end{beispiel} +\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{beispiel} - % preamble: - % \usepackage{dingbat} - \NewTasks[label=\footnotesize\leftthumbsup,label-width=1.3em]{done}[*] - \begin{done} - * First task - * Second Task - \end{done} -\end{beispiel} +\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 @@ -479,44 +371,46 @@ 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 \code{choices} environment that has three columns in its -default state. You could do something like this: -\begin{beispiel} - % preamble: - % \NewTasks[style=multiplechoice]{choices}[\choice](3) - % \newcommand*\correct{\PrintSolutionsTF{\checkedchoicebox}{\choicebox}} - % - % \PrintSolutionsTF and the {question} environment are provided - % by the ExSheets package - \begin{question} - \begin{choices} - \choice First choice - \choice Second choice - \choice[\correct] Third choice - \end{choices} - \end{question} - \begin{solution}[print] - \begin{choices} - \choice First choice - \choice Second choice - \choice[\correct] Third choice - \end{choices} - \end{solution} -\end{beispiel} +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{beschreibung} - \Befehl{choicebox} \choicebox - \Befehl{checkedchoicebox} \checkedchoicebox -\end{beschreibung} -\secidx*{Own Environments} +\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 \paket{xtemplate} to +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}\secidx{The `tasks' Object} -The object that's defined by \Tasks is the `tasks' object. This time there +\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. @@ -525,45 +419,42 @@ 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{beispiel}[code only] - \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{beispiel} +\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{beispiel}[code only] - % 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{beispiel} -\secidx*{The `tasks' Object} - -\printindex +\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 index f97ca6147e0..cb2cccd2db0 100644 --- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty +++ b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty @@ -9,7 +9,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012 Clemens Niederberger +% Copyright 2012-2013 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -28,29 +28,23 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\def\@cntfmts@date{2012/04/23} -\def\@cntfmts@version{v0.5} - -\ProvidesPackage{cntformats}[\@cntfmts@date\space \@cntfmts@version\space A different way to read counters.] -\RequirePackage{etoolbox} +\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.} -\def\@cntfmts@create@message#1{% - \ifstrequal{#1}{Error} - {% - \lowercase{\csdef{@cntfmts@#1}}##1{% - \csuse{Package#1}{cntformats}{##1}{\@cntfmts@error@message}}% - }{% - \lowercase{\csdef{@cntfmts@#1}}##1{% - \csuse{Package#1}{cntformats}{##1}}% - }} -\@cntfmts@create@message{Error} -\@cntfmts@create@message{Warning} -\@cntfmts@create@message{WarningNoLine} -\@cntfmts@create@message{Info} +\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!}} @@ -66,91 +60,93 @@ % 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}}{}% -} +% \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<spec> -- 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} +% \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 it -\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} +% 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{% - \@cntfmts@expand@second\csdef + \cnltx@expandargs(no)\csdef {@#1@read@#3@counter}% - {\csname @#1@read@#2@counter\endcsname}} + {\csname @#1@read@#2@counter\endcsname}% +} % create pattern for an existing counter: % #1: module @@ -168,13 +164,14 @@ \newcommand*\@cntfmts@add@counter@pattern@nostar[3][cntfmts]{% \@cntfmts@add@counter@pattern[#1]{#2}{#3}% - \@cntfmts@expand@third - \@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}} + \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}} + {\@cntfmts@add@counter@pattern@nostar}% +} \@onlypreamble\AddCounterPattern % create pattern for a new counter @@ -191,13 +188,14 @@ \newcommand*\@cntfmts@new@counter@pattern@nostar[3][cntfmts]{% \@cntfmts@new@counter@pattern[#1]{#2}{#3}% - \@cntfmts@expand@third - \@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}} + \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}} + {\@cntfmts@new@counter@pattern@nostar}% +} \@onlypreamble\NewCounterPattern % renew pattern: @@ -213,13 +211,14 @@ \newcommand*\@cntfmts@renew@counter@pattern@nostar[3][cntfmts]{% \@cntfmts@renew@counter@pattern[#1]{#2}{#3}% - \@cntfmts@expand@third - \@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}} + \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}} + {\@cntfmts@renew@counter@pattern@nostar}% +} \@onlypreamble\RenewCounterPattern % ---------------------------------------------------------------------------- @@ -230,7 +229,8 @@ % #2: counter % #3: internal command \def\@cntfmts@create@read@counter#1#2#3{% - \expandafter\@cntfmts@defwopt\csname @#1@read@#2@counter\endcsname[]{% + \expandafter\newexpandablecmd + \expandafter*\csname @#1@read@#2@counter\endcsname[1][]{% \ifblank{##1} {\@arabic{#3}} {\csuse{@cntfmts@counter@type@##1}{#3}}% @@ -238,17 +238,20 @@ } \newrobustcmd*\ReadCounterFrom[3][cntfmts]{% - \@cntfmts@create@read@counter{#1}{#2}{#3}} + \@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}} + \csdef{@cntfmts@counter@type@#1}{#2}% +} \newrobustcmd*\NewPatternFormat[2]{% - \@cntfmts@new@pattern@format{#1}{#2}} + \@cntfmts@new@pattern@format{#1}{#2}% +} \@onlypreamble\NewPatternFormat % ---------------------------------------------------------------------------- @@ -257,21 +260,24 @@ % #2: list % #3: pattern \def\@cntfmts@read@counter@pattern#1#2#3{% - \def\@cntfmts@parsed@pattern{#3\relax}% + \def\@cntfmts@parsed@pattern{#3\@empty}% \forlistcsloop{\@cntfmts@replace@pattern{#1}}{#2}% } % #1: module % #2: pattern-key \def\@cntfmts@replace@pattern#1#2{% - \@cntfmts@replaceallincs\@cntfmts@parsed@pattern - {#2}{{}\csuse{@#1@read@#2@counter}}} + \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} + \@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}\@cntfmts@parsed@pattern +} \newrobustcmd*\ReadCounterPatternFrom[2][cntfmts]{% - \@cntfmts@expand@third\@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}% - \@cntfmts@parsed@pattern} + \cnltx@expandargs(nno)\@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}% + \@cntfmts@parsed@pattern +} % #1: save pattern in % #2: save interpretation in @@ -290,16 +296,20 @@ } \newrobustcmd*\SaveCounterPattern[4][cntfmts]{% - \@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}} + \@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% +} \newrobustcmd*\SaveCounterPatternFrom[4][cntfmts]{% - \@cntfmts@expand@third\@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}} + \cnltx@expandargs(nno)\@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% +} \newrobustcmd*\eSaveCounterPattern[4][cntfmts]{% - \@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}} + \@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% +} \newrobustcmd*\eSaveCounterPatternFrom[4][cntfmts]{% - \@cntfmts@expand@third\@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}} + \cnltx@expandargs(nno)\@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% +} % ---------------------------------------------------------------------------- % predefined formats and pattern @@ -333,4 +343,7 @@ from \the<ounter> to \c@<ounter> - rename tokenlist test macros to use cntformats' namespace -
\ No newline at end of file +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-listings.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty new file mode 100644 index 00000000000..6e27fa7c90c --- /dev/null +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty @@ -0,0 +1,146 @@ +% ---------------------------------------------------------------------------- +% the EXSHEETS-LISTINGS package +% +% Using listings with exsheets +% +% ---------------------------------------------------------------------------- +% 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. +% ---------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% ---------------------------------------------------------------------------- +\RequirePackage{exsheets,listings} +\def\exsheets@listings@date{2013/10/11} +\def\exsheets@listings@version{0.2} +% we need this loaded before expl3 syntax is activated: +\lst@RequireAspects{writefile} +\ProvidesExplPackage{exsheets-listings} + {\exsheets@listings@date} + {\exsheets@listings@version} + {listings in exsheets} + +% ---------------------------------------------------------------------------- +% variables: +\int_new:N \g__exsheets_listings_question_int +\int_new:N \g__exsheets_listings_solution_int + +\tl_new:N \l__exsheets_listings_question_pre_tl +\tl_new:N \l__exsheets_listings_question_post_tl +\tl_new:N \l__exsheets_listings_question_options_tl +\tl_new:N \l__exsheets_listings_question_code_tl +\tl_new:N \l__exsheets_listings_solution_pre_tl +\tl_new:N \l__exsheets_listings_solution_post_tl +\tl_new:N \l__exsheets_listings_solution_options_tl +\tl_new:N \l__exsheets_listings_solution_code_tl +\tl_new:N \l__exsheets_listings_question_points_tl + +% ---------------------------------------------------------------------------- +% listings style for questions and solutions: +\keys_define:nn { exsheets } + { + question / listings .tl_set:N = \l__exsheets_listings_question_code_tl , + solution / listings .tl_set:N = \l__exsheets_listings_solution_code_tl + } + +% ---------------------------------------------------------------------------- +% expansion help: +\cs_new:Npn \__exsheets_question_expandopt:Nnnnn #1#2#3#4#5 + { #1{#2}[#3]{#4}#5 } +\cs_generate_variant:Nn \__exsheets_question_expandopt:Nnnnn { NnVox } + +\cs_new:Npn \__exsheets_question_expand_opt_and_body:Nnnn #1#2#3#4 + { #1{#2}[#3]#4 } +\cs_generate_variant:Nn \__exsheets_question_expand_opt_and_body:Nnnn { NnVx } + +% ---------------------------------------------------------------------------- +% lstquestion environment: +\keys_define:nn { exsheets / listings / question } + { + pre .tl_set:N = \l__exsheets_listings_question_pre_tl , + post .tl_set:N = \l__exsheets_listings_question_post_tl , + options .tl_set:N = \l__exsheets_listings_question_options_tl , + points .tl_set:N = \l__exsheets_listings_question_points_tl , + listings .tl_set:N = \l__exsheets_listings_question_code_tl , + } + +\keys_define:nn { exsheets / listings / solution } + { + pre .tl_set:N = \l__exsheets_listings_solution_pre_tl , + post .tl_set:N = \l__exsheets_listings_solution_post_tl , + options .tl_set:N = \l__exsheets_listings_solution_options_tl , + listings .tl_set:N = \l__exsheets_listings_solution_code_tl , + } + +\cs_new:Npn \exsheets_listings_new_lstenvironment:nnnnnnn #1#2#3#4#5#6#7 + { + \lstnewenvironment{#2}[1][] + { + \keys_set:nn {exsheets/listings/question} {#1,#4,##1} + \int_gincr:N \g__exsheets_listings_question_int + \lst@BeginWriteFile + { \c_job_name_tl - ex \int_use:N\g__exsheets_listings_question_int .lst } + } + { + \lst@EndWriteFile + \__exsheets_question_expandopt:NnVox + \begin {#3} + \l__exsheets_listings_question_options_tl + { \l__exsheets_listings_question_points_tl } + { + \exp_not:V \l__exsheets_listings_question_pre_tl + \exp_not:N \lstinputlisting + [ \exp_not:V \l__exsheets_listings_question_code_tl ] + { \c_job_name_tl - ex \int_use:N\g__exsheets_listings_question_int .lst } + \exp_not:V \l__exsheets_listings_question_post_tl + } + \end {#3} + } + \lstnewenvironment{#5}[1][] + { + \keys_set:nn { exsheets / listings / solution } { #1,#7,##1 } + \int_gincr:N \g__exsheets_listings_solution_int + \lst@BeginWriteFile + { \c_job_name_tl - sol \int_use:N \g__exsheets_listings_solution_int . lst } + } + { + \lst@EndWriteFile + \__exsheets_question_expand_opt_and_body:NnVx + \begin {#6} + \l__exsheets_listings_solution_options_tl + { + \exp_not:V \l__exsheets_listings_solution_pre_tl + \exp_not:N \lstinputlisting + [ \exp_not:V \l__exsheets_listings_solution_code_tl ] + { \c_job_name_tl - sol \int_use:N \g__exsheets_listings_solution_int . lst } + \exp_not:V \l__exsheets_listings_solution_post_tl + } + \end {#6} + } + } + +\NewDocumentCommand \NewLstQuSolPair { O{}mmO{}mmO{} } + { \exsheets_listings_new_lstenvironment:nnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7} } + +\NewLstQuSolPair{lstquestion}{question}{lstsolution}{solution} + +\tex_endinput:D + +HISTORY +2013/09/18 v0.1 - first draft, see http://tex.stackexchange.com/a/133969/5049 +2013/10/11 v0.2 - first official version bundled with ExSheets diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index 64ce0f3e650..0ac48c0717c 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{2013/07/17} -\def\exsheets@version{0.9i} +\def\exsheets@date{2013/10/11} +\def\exsheets@version{0.10} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -201,8 +201,10 @@ \tl_set:Nn \l__exsheets_heading_instance_tl { block } \tl_new:N \l__exsheets_question_heading_instance_tl \tl_new:N \l__exsheets_solution_heading_instance_tl -\tl_new:N \l__exsheets_heading_title_user_format_tl -\tl_set:Nn \l__exsheets_heading_title_user_format_tl { \normalsize\bfseries } +\tl_new:N \l_exsheets_heading_title_user_format_tl +\tl_set:Nn \l_exsheets_heading_title_user_format_tl { \normalsize\bfseries } +\tl_new:N \l_exsheets_subtitle_format_tl +\tl_set:Nn \l_exsheets_subtitle_format_tl { \normalsize\bfseries\itshape } \tl_new:N \l__exsheets_questions_toclevel_tl \tl_set:Nn \l__exsheets_questions_toclevel_tl { subsection } \tl_new:N \l__exsheets_solutions_toclevel_tl @@ -224,7 +226,9 @@ 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 , - headings-format .tl_set:N = \l__exsheets_heading_title_user_format_tl , + headings-format .tl_set:N = + \l_exsheets_heading_title_user_format_tl , + subtitle-format .tl_set:N = \l_exsheets_subtitle_format_tl , load-tasks .bool_set:N = \l__exsheets_load_tasks_bool , use-ref .bool_set:N = \l__exsheets_solutions_by_ref_bool , totoc .choice: , @@ -764,7 +768,7 @@ } % ---------------------------------------------------------------------------- -% Aufgaben und Lösungen +% Aufgaben und Lösungen \bool_new:N \g__exsheets_questions_use_bool \bool_gset_true:N \g__exsheets_questions_use_bool \bool_new:N \l__exsheets_questions_use_bool @@ -900,8 +904,8 @@ % die 'question' Umgebung \tl_new:N \l__exsheets_questions_name_tl \tl_set:Nn \l__exsheets_questions_name_tl { Question } -\tl_new:N \l__exsheets_exsheets_name_tl -\tl_set:Nn \l__exsheets_exsheets_name_tl { Exercise } +\tl_new:N \l__exsheets_exercise_name_tl +\tl_set:Nn \l__exsheets_exercise_name_tl { Exercise } \bool_new:N \l__exsheets_questions_print_bool \bool_set_true:N \l__exsheets_questions_print_bool @@ -944,14 +948,14 @@ } \prop_new:N \g__exsheets_questions_id_prop -\prop_new:N \g__exsheets_questions_meta_prop +\prop_new:N \g__exsheets_questions_subtitle_prop \prop_new:N \g__exsheets_questions_used_prop \int_new:N \g__exsheets_questions_used_int \tl_new:N \l__exsheets_questions_id_tl -\tl_new:N \l__exsheets_questions_meta_tl +\tl_new:N \l__exsheets_questions_subtitle_tl \tl_new:N \g__exsheets_questions_current_id_tl -\tl_new:N \l__exsheets_title_tl +\tl_new:N \l__exsheets_questions_title_tl \tl_new:N \l__exsheets_questions_label_tl \tl_new:N \l__exsheets_questions_points_tl @@ -1028,11 +1032,11 @@ } % FIXME: rather useless since it isn't used at all, see also % exsheets_headings.def - \tl_if_blank:VF \l__exsheets_questions_meta_tl + \tl_if_blank:VF \l__exsheets_questions_subtitle_tl { - \prop_gput:NVV \g__exsheets_questions_meta_prop + \prop_gput:NVV \g__exsheets_questions_subtitle_prop \g__exsheets_questions_current_id_tl - \l__exsheets_questions_meta_tl + \l__exsheets_questions_subtitle_tl } } \bool_if:nT @@ -1091,8 +1095,8 @@ } { \tl_clear:N \l__exsheets_step_counter_tl - % das ist etwas mühsam: abhängig von der Nutzung der verschiedenen - % Gruppierungsmöglichkeiten muss der Counter erhöht werden: + % das ist etwas mühsam: abhängig von der Nutzung der verschiedenen + % Gruppierungsmöglichkeiten muss der Counter erhöht werden: \prop_map_inline:Nn \l__exsheets_class_prop { \use:c { __exsheets_questions_use_##1: } @@ -1109,7 +1113,7 @@ { \tl_put_right:Nn \l__exsheets_step_counter_tl { y } } { \tl_put_right:Nn \l__exsheets_step_counter_tl { n } } } - % erhöhe jetzt, wenn kein Nein dabei war: + % erhöhe jetzt, wenn kein Nein dabei war: \tl_if_in:NnF \l__exsheets_step_counter_tl { n } { \refstepcounter{question} } \__exsheets_get_sectioning_numbers: @@ -1131,24 +1135,34 @@ \bool_if:NT \l__exsheets_questions_print_bool { \bool_if:NTF \l__exsheets_exam_bool - { \tl_set_eq:NN \l__exsheets_title_tl \l__exsheets_questions_name_tl } - { \tl_set_eq:NN \l__exsheets_title_tl \l__exsheets_exsheets_name_tl } + { + \tl_set_eq:NN + \l__exsheets_questions_title_tl + \l__exsheets_questions_name_tl + } + { + \tl_set_eq:NN + \l__exsheets_questions_title_tl + \l__exsheets_exercise_name_tl + } \bool_if:NTF \l__exsheets_parse_points_bool { - \__exsheets_use_heading:VVVnn + \__exsheets_use_heading:VVVnnV \l__exsheets_question_heading_instance_tl - \l__exsheets_title_tl + \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl { \l__exsheets_question_points_fp } { \l__exsheets_question_bonus_fp } + \g__exsheets_questions_current_id_tl } { - \__exsheets_use_heading:VVVnn + \__exsheets_use_heading:VVVnnV \l__exsheets_question_heading_instance_tl - \l__exsheets_title_tl + \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl { \l__exsheets_questions_points_tl } { 0 } + \g__exsheets_questions_current_id_tl } } } @@ -1264,7 +1278,8 @@ % #3: number % #4: points % #5: bonus -\cs_new_nopar:Npn \__exsheets_use_heading:nnnnn #1#2#3#4#5 +% #6: id +\cs_new_nopar:Npn \__exsheets_use_heading:nnnnnn #1#2#3#4#5#6 { \IfInstanceExistTF { exsheets-heading } { #1 } { \UseInstance { exsheets-heading } { #1 } } @@ -1272,9 +1287,9 @@ \msg_warning:nnx { exsheets} { headings } { #1 } \UseInstance { exsheets-heading } { block } } - { #2 } { #3 } { #4 } { #5 } + { #2 } { #3 } { #4 } { #5 } { #6 } } -\cs_generate_variant:Nn \__exsheets_use_heading:nnnnn { V , VV , VVV } +\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV } \bool_new:N \l__exsheets_exam_bool \bool_set_false:N \l__exsheets_exam_bool @@ -1290,10 +1305,10 @@ type / exercise .code:n = \bool_set_false:N \l__exsheets_exam_bool , name .code:n = - \tl_set:Nn \l__exsheets_exsheets_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 , - meta .tl_set:N = \l__exsheets_questions_meta_tl , + subtitle .tl_set:N = \l__exsheets_questions_subtitle_tl , print .bool_set:N = \l__exsheets_questions_print_bool , print .default:n = true , ID .tl_set:N = \l__exsheets_questions_id_tl , @@ -1786,9 +1801,10 @@ { \int_set:Nn \l__exsheets_counter_qu_int { \arabic{question} } \__exsheets_get_sectioning_numbers: - \__exsheets_solutions_name:VV + \__exsheets_solutions_name:VVV \l__exsheets_qu_counter_interpretation_tl \l__exsheets_solutions_name_tl + \g__exsheets_questions_current_id_tl \use:n { #1 } \cs_if_eq:NNTF \exsheets_par: \scan_stop: { \c_space_tl } @@ -1855,7 +1871,7 @@ \bool_new:N \l__exsheets_solutions_runin_bool \bool_set_false:N \l__exsheets_solutions_runin_bool -\cs_new_protected_nopar:Npn \__exsheets_solutions_name:nn #1#2 +\cs_new_protected_nopar:Npn \__exsheets_solutions_name:nnn #1#2#3 { \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl { @@ -1863,17 +1879,17 @@ \l__exsheets_solution_heading_instance_tl \l__exsheets_heading_instance_tl } - \__exsheets_use_heading:Vnnnn + \__exsheets_use_heading:Vnnnnn \l__exsheets_solution_heading_instance_tl - { #2 } { #1 } { 0 } { 0 } + { #2 } { #1 } { 0 } { 0 } { #3 } } -\cs_generate_variant:Nn \__exsheets_solutions_name:nn { VV } +\cs_generate_variant:Nn \__exsheets_solutions_name:nnn { VV , VVV } -\tl_new:N \l__exsheets_solutions_name_style_tl -\tl_set:Nn \l__exsheets_solutions_name_style_tl { \normalsize \bfseries } +\tl_new:N \l_exsheets_solutions_name_style_tl +\tl_set:Nn \l_exsheets_solutions_name_style_tl { \normalsize \bfseries } \cs_new:Npn \exsheets_solutions_name_style:n #1 - { \l__exsheets_solutions_name_style_tl #1 } + { \l_exsheets_solutions_name_style_tl #1 } % ---------------------------------------------------------------------------- % print solutions: @@ -1976,13 +1992,16 @@ { #1 } \l__exsheets_tmpa_tl \prop_get:NnN \g__exsheets_solutions_content_prop { #1 } \l__exsheets_tmpb_tl + \prop_get:NnN \g__exsheets_solutions_questions_id_prop + { #1 } \l__exsheets_tmpc_tl \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl \l__exsheets_qu_counter_pattern_tl - \exsheets_solutions_print_name:VV + \exsheets_solutions_print_name:VVV \l__exsheets_current_pattern_tl \l__exsheets_tmpa_tl + \l__exsheets_tmpc_tl \tl_use:N \l__exsheets_tmpb_tl \cs_if_eq:NNTF \exsheets_par: \scan_stop: { \c_space_tl } @@ -2126,13 +2145,16 @@ \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 + \prop_get:NnN \g__exsheets_solutions_questions_id_prop + { #1 } \l__exsheets_tmpc_tl \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl \l__exsheets_qu_counter_pattern_tl - \exsheets_solutions_print_name:VV + \exsheets_solutions_print_name:VVV \l__exsheets_current_pattern_tl \l__exsheets_tmpa_tl + \l__exsheets_tmpc_tl \tl_use:N \l__exsheets_tmpb_tl \cs_if_eq:NNTF \exsheets_par: \scan_stop: { \c_space_tl } @@ -2175,6 +2197,8 @@ { \prop_get:NnN \g__exsheets_solutions_content_prop { ##1 } \l__exsheets_tmpb_tl + \prop_get:NnN \g__exsheets_solutions_questions_id_prop + { ##1 } \l__exsheets_tmpc_tl \__exsheets_restore_number_from_and_do:Nnn \g__exsheets_question_number_prop { ##1 } @@ -2183,9 +2207,10 @@ \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl \l__exsheets_qu_counter_pattern_tl - \exsheets_solutions_print_name:VV + \exsheets_solutions_print_name:VVV \l__exsheets_current_pattern_tl \l__exsheets_tmpa_tl + \l__exsheets_tmpc_tl \tl_use:N \l__exsheets_tmpb_tl \cs_if_eq:NNTF \exsheets_par: \scan_stop: { \c_space_tl } @@ -2215,16 +2240,16 @@ \int_set:Nn \l__exsheets_counter_qu_int { #3 } } -\cs_new_protected_nopar:Npn \exsheets_solutions_print_name:nn #1#2 +\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:nn { } { #2 } } - { \__exsheets_solutions_name:nn { #1 } { #2 } } + { \__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:nn { VV } +\cs_generate_variant:Nn \exsheets_solutions_print_name:nnn { VVV } \cs_new:Npn \PrintSolutionsTF { \bool_if:NTF \l__exsheets_solutions_print_bool } @@ -2483,62 +2508,63 @@ % ---------------------------------------------------------------------------- % Sprachanpassungen -\file_if_exist:nT { translations.sty } - { - \RequirePackage { translations } - % translation for the exercises - \DeclareTranslationFallback { exsheets-exercise-name } { Exercise } - \DeclareTranslation { English } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { British } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { American } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { French } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { German } { exsheets-exercise-name } { \"Ubung } - \DeclareTranslation { Italian } { exsheets-exercise-name } { Esercizio } - \DeclareTranslation { Spanish } { exsheets-exercise-name } { Ejercicio } - \DeclareTranslation { Catalan } { exsheets-exercise-name } { Exercici } - \DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz } - \DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer } - \DeclareTranslation { Hungarian } { exsheets-exercise-name } { Gyakorol } - \DeclareTranslation { Danish } { exsheets-exercise-name } { \O{}velse } - \DeclareTranslation { Portuges } { exsheets-exercise-name } { Exerc\'\i cio } - % translation for the question - \DeclareTranslationFallback { exsheets-question-name } { Question } - \DeclareTranslation { English } { exsheets-question-name } { Question } - \DeclareTranslation { British } { exsheets-question-name } { Question } - \DeclareTranslation { American } { exsheets-question-name } { Question } - \DeclareTranslation { French } { exsheets-question-name } { Question } - \DeclareTranslation { German } { exsheets-question-name } { Aufgabe } - \DeclareTranslation { Italian } { exsheets-question-name } { Questione } - \DeclareTranslation { Spanish } { exsheets-question-name } { Pregunta } - \DeclareTranslation { Catalan } { exsheets-question-name } { Q\"uesti\'o } - \DeclareTranslation { Turkish } { exsheets-question-name } { Soru } - \DeclareTranslation { Croatian } { exsheets-question-name } { Zadatak } - \DeclareTranslation { Hungarian } { exsheets-question-name } { Feladat } - \DeclareTranslation { Danish } { exsheets-question-name } { Opgave } - \DeclareTranslation { Portuges } { exsheets-question-name } { Quest\~ao } - % translation for the solutions - \DeclareTranslationFallback { exsheets-solution-name } { Solution } - \DeclareTranslation { English } { exsheets-solution-name } { Solution } - \DeclareTranslation { British } { exsheets-solution-name } { Solution } - \DeclareTranslation { American } { exsheets-solution-name } { Solution } - \DeclareTranslation { French } { exsheets-solution-name } { Solution } - \DeclareTranslation { German } { exsheets-solution-name } { L\"osung } - \DeclareTranslation { Italian } { exsheets-solution-name } { Soluzione } - \DeclareTranslation { Spanish } { exsheets-solution-name } { Soluci\'on } - \DeclareTranslation { Catalan } { exsheets-solution-name } { Soluci\'o } - \DeclareTranslation { Turkish } { exsheets-solution-name } { \c C\"oz\"um } - \DeclareTranslation { Croatian } { exsheets-solution-name } { Rje\v{s}enje } - \DeclareTranslation { Hungarian } { exsheets-solution-name } { Megold\'{a}s } - \DeclareTranslation { Danish } { exsheets-solution-name } { Opl\o{}sning } - \DeclareTranslation { Portuges } { exsheets-solution-name } { Solu\c c\~ao } - % the actual translating - \tl_set:Nn \l__exsheets_exsheets_name_tl - { \GetTranslation { exsheets-exercise-name } } - \tl_set:Nn \l__exsheets_questions_name_tl - { \GetTranslation { exsheets-question-name } } - \tl_set:Nn \l__exsheets_solutions_name_tl - { \GetTranslation { exsheets-solution-name } } - } +\RequirePackage { translations } +% translation for the exercises +\DeclareTranslationFallback { exsheets-exercise-name } { Exercise } +\DeclareTranslation { English } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { British } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { American } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { French } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { German } { exsheets-exercise-name } { \"Ubung } +\DeclareTranslation { Italian } { exsheets-exercise-name } { Esercizio } +\DeclareTranslation { Spanish } { exsheets-exercise-name } { Ejercicio } +\DeclareTranslation { Catalan } { exsheets-exercise-name } { Exercici } +\DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz } +\DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer } +\DeclareTranslation { Hungarian } { exsheets-exercise-name } { Gyakorol } +\DeclareTranslation { Danish } { exsheets-exercise-name } { \O{}velse } +\DeclareTranslation { Norsk } { exsheets-exercise-name } { Oppgave } +\DeclareTranslation { Portuges } { exsheets-exercise-name } { Exerc\'\i cio } +% translation for the question +\DeclareTranslationFallback { exsheets-question-name } { Question } +\DeclareTranslation { English } { exsheets-question-name } { Question } +\DeclareTranslation { British } { exsheets-question-name } { Question } +\DeclareTranslation { American } { exsheets-question-name } { Question } +\DeclareTranslation { French } { exsheets-question-name } { Question } +\DeclareTranslation { German } { exsheets-question-name } { Aufgabe } +\DeclareTranslation { Italian } { exsheets-question-name } { Questione } +\DeclareTranslation { Spanish } { exsheets-question-name } { Pregunta } +\DeclareTranslation { Catalan } { exsheets-question-name } { Q\"uesti\'o } +\DeclareTranslation { Turkish } { exsheets-question-name } { Soru } +\DeclareTranslation { Croatian } { exsheets-question-name } { Zadatak } +\DeclareTranslation { Hungarian } { exsheets-question-name } { Feladat } +\DeclareTranslation { Danish } { exsheets-question-name } { Opgave } +\DeclareTranslation { Norsk } { exsheets-question-name } { Oppgave } +\DeclareTranslation { Portuges } { exsheets-question-name } { Quest\~ao } +% translation for the solutions +\DeclareTranslationFallback { exsheets-solution-name } { Solution } +\DeclareTranslation { English } { exsheets-solution-name } { Solution } +\DeclareTranslation { British } { exsheets-solution-name } { Solution } +\DeclareTranslation { American } { exsheets-solution-name } { Solution } +\DeclareTranslation { French } { exsheets-solution-name } { Solution } +\DeclareTranslation { German } { exsheets-solution-name } { L\"osung } +\DeclareTranslation { Italian } { exsheets-solution-name } { Soluzione } +\DeclareTranslation { Spanish } { exsheets-solution-name } { Soluci\'on } +\DeclareTranslation { Catalan } { exsheets-solution-name } { Soluci\'o } +\DeclareTranslation { Turkish } { exsheets-solution-name } { \c C\"oz\"um } +\DeclareTranslation { Croatian } { exsheets-solution-name } { Rje\v{s}enje } +\DeclareTranslation { Hungarian } { exsheets-solution-name } { Megold\'{a}s } +\DeclareTranslation { Danish } { exsheets-solution-name } { Opl\o{}sning } +\DeclareTranslation { Norsk } { exsheets-solution-name } { L\o{}sning } +\DeclareTranslation { Portuges } { exsheets-solution-name } { Solu\c c\~ao } +% the actual translating +\tl_set:Nn \l__exsheets_exercise_name_tl + { \GetTranslation { exsheets-exercise-name } } +\tl_set:Nn \l__exsheets_questions_name_tl + { \GetTranslation { exsheets-question-name } } +\tl_set:Nn \l__exsheets_solutions_name_tl + { \GetTranslation { exsheets-solution-name } } + % ---------------------------------------------------------------------------- % save total points in .aux file to make it available for \allpoints anywhere @@ -2700,6 +2726,12 @@ HISTORY: 2013/07/17 v0.9i - made \g__exsheets_total_bonus_fp and \g__exsheets_total_points_fp public - removed `translations' from the bundle +2013/10/11 v0.10 - require `translations' like any other package + - added `exsheets-listings' package + - added Norwegian translations + - changed horizontal spaces declared as `1ex' into + `.3333em' in the declarations of the headings + instances %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg index 0db292f4be1..19f8ebfc137 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg @@ -22,12 +22,6 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -% The exsheets package consists of the files -% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg, -% exsheets_tasks.def, exsheets_tasks.cfg, exsheets_configurations.cfg, -% - exsheets_en.tex, exsheets_en.pdf, -% - README -% -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- @@ -54,7 +48,7 @@ attach = { main[l,t] number[l,t] (0pt,0pt) } , join = { - number[r,b] title[l,b] (1ex,0pt) ; + number[r,b] title[l,b] (.333em,0pt) ; main[l,b] points[l,t] (1em,0pt) } } @@ -63,7 +57,7 @@ \DeclareInstance { exsheets-heading } { block-rev } { default } { toc-reversed = true , - join = { number[r,B] title[l,B] (1ex,0pt) } , + join = { number[r,B] title[l,B] (.333em,0pt) } , attach = { main[l,vc] number[l,vc] (0pt,0pt) ; @@ -71,6 +65,18 @@ } } +% BLOCK, SUBTITLE: +\DeclareInstance{exsheets-heading}{block-subtitle}{default}{ + join = { + title[r,B]number[l,B](.333em,0pt) ; + title[r,B]subtitle[l,B](1em,0pt) + } , + attach = { + main[l,vc]title[l,vc](0pt,0pt) ; + main[r,vc]points[l,vc](\marginparsep,0pt) + } +} + % BLOCK, POINTS WITH THE TITLE: \DeclareInstance { exsheets-heading } { block-wp } { default } { @@ -78,8 +84,8 @@ points-post-code = ) , join = { - title[r,B] number[l,B] (1ex,0pt) ; - title[r,B] points[l,B] (1ex,0pt) + title[r,B] number[l,B] (.333em,0pt) ; + title[r,B] points[l,B] (.333em,0pt) } , attach = { main[l,vc] title[l,vc] (0pt,0pt) } } @@ -92,8 +98,8 @@ points-post-code = ) , join = { - number[r,B] title[l,B] (1ex,0pt) ; - number[r,B] points[l,B] (1ex,0pt) + number[r,B] title[l,B] (.333em,0pt) ; + number[r,B] points[l,B] (.333em,0pt) } , attach = { main[l,vc] number[l,vc] (0pt,0pt) } } @@ -113,7 +119,7 @@ { points-pre-code = ( , points-post-code = ) , - join = { number[r,vc] points[l,vc] (1ex,0pt) } , + join = { number[r,vc] points[l,vc] (.333em,0pt) } , attach = { main[l,vc] number[l,vc] (0pt,0pt) } } @@ -128,7 +134,7 @@ join = { main[r,vc] number[r,vc] (0pt,0pt) ; - main[r,vc] title[l,vc] (1ex,0pt) + main[r,vc] title[l,vc] (.333em,0pt) } } @@ -141,8 +147,8 @@ join = { main[r,vc] title[r,vc] (0pt,0pt) ; - main[r,vc] number[l,vc] (1ex,0pt) ; - main[r,vc] points[l,vc] (1ex,0pt) + main[r,vc] number[l,vc] (.333em,0pt) ; + main[r,vc] points[l,vc] (.333em,0pt) } } @@ -156,8 +162,8 @@ join = { main[r,vc] number[r,vc] (0pt,0pt) ; - main[r,vc] title[l,vc] (1ex,0pt) ; - main[r,vc] points[l,vc] (1ex,0pt) + main[r,vc] title[l,vc] (.333em,0pt) ; + main[r,vc] points[l,vc] (.333em,0pt) } } @@ -180,7 +186,7 @@ join = { main[r,vc] number[l,vc] (0pt,0pt) ; - main[r,vc] points[l,vc] (1ex,0pt) + main[r,vc] points[l,vc] (.333em,0pt) } } @@ -235,7 +241,7 @@ % CENTERED: \DeclareInstance { exsheets-heading } { centered } { default } { - join = { title[r,B] number[l,B] (1ex,0pt) } , + join = { title[r,B] number[l,B] (.333em,0pt) } , attach = { main[hc,vc] title[hc,vc] (0pt,0pt) ; @@ -250,8 +256,8 @@ points-post-code = ) , join = { - title[r,B] number[l,B] (1ex,0pt) ; - title[r,B] points[l,B] (1ex,0pt) + title[r,B] number[l,B] (.333em,0pt) ; + title[r,B] points[l,B] (.333em,0pt) } , attach = { main[hc,vc] title[hc,vc] (0pt,0pt) } } @@ -263,7 +269,7 @@ number-post-code = \c_space_tl , points-pre-code = ( , points-post-code = ) \c_space_tl , - join = { title[r,b] number[l,b] (1ex,0pt) } , + join = { title[r,b] number[l,b] (.333em,0pt) } , attach = { main[l,vc] title[r,vc] (0pt,0pt) ; @@ -277,7 +283,7 @@ runin = true , attach = { - main[l,vc]number[r,vc](-1ex,0pt) ; + main[l,vc]number[r,vc](-.333em,0pt) ; main[r,vc]points[l,vc](\linewidth+\marginparsep,0pt) } } @@ -285,7 +291,7 @@ % RIGHT-ALIGNED: \DeclareInstance { exsheets-heading } { raggedleft } { default } { - join = { title[r,B] number[l,B] (1ex,0pt) } , + join = { title[r,B] number[l,B] (.333em,0pt) } , attach = { main[r,vc] title[r,vc] (0pt,0pt) ; @@ -298,7 +304,7 @@ { vscale = 2 , title-format = \Large\bfseries\sffamily , - join = { title[r,B] number[l,B] (1ex,0pt) } , + join = { title[r,B] number[l,B] (.333em,0pt) } , attach = { main[l,vc] title[l,vc] (0pt,0pt) ; @@ -317,7 +323,7 @@ title-format = \large\scshape\color{exsheetsred} , number-format = \large\bfseries\color{exsheetsblue} , points-format = \itshape , - join = { number[r,B] title[l,B] (1ex,0pt) } , + join = { number[r,B] title[l,B] (.333em,0pt) } , attach = { main[hc,vc] number[hc,vc] (0pt,0pt) ; @@ -340,10 +346,10 @@ points-post-code = ) , join = { - number[r,B] title[l,B] (1ex,0pt) ; - number[r,B] points[l,B] (1ex,0pt) + number[r,B] title[l,B] (.333em,0pt) ; + number[r,B] points[l,B] (.333em,0pt) } , attach = { main[hc,vc] number[hc,vc] (0pt,0pt) } } -\tex_endinput:D
\ No newline at end of file +\tex_endinput:D diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index 637cde2cfd0..4d29d095776 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -22,12 +22,6 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -% The exsheets package consists of the files -% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg, -% exsheets_tasks.def, exsheets_tasks.cfg, exsheets_configurations.cfg, -% - exsheets_en.tex, exsheets_en.pdf, -% - README -% -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- @@ -42,7 +36,7 @@ \coffin_new:N \l__exsheets_heading_title_coffin \coffin_new:N \l__exsheets_heading_number_coffin \coffin_new:N \l__exsheets_heading_points_coffin -\coffin_new:N \l__exsheets_heading_meta_coffin +\coffin_new:N \l__exsheets_heading_subtitle_coffin % the object variables: \bool_new:N \l__exsheets_heading_runin_bool @@ -60,17 +54,21 @@ \tl_new:N \l__exsheets_heading_title_format_tl \tl_new:N \l__exsheets_heading_title_pre_code_tl +\tl_set:Nn \l__exsheets_heading_title_pre_code_tl { \use:n } \tl_new:N \l__exsheets_heading_title_post_code_tl \tl_new:N \l__exsheets_heading_number_format_tl \tl_new:N \l__exsheets_heading_number_pre_code_tl +\tl_set:Nn \l__exsheets_heading_number_pre_code_tl { \use:n } \tl_new:N \l__exsheets_heading_number_post_code_tl -\tl_new:N \l__exsheets_heading_meta_pre_code_tl -\tl_new:N \l__exsheets_heading_meta_post_code_tl +\tl_new:N \l__exsheets_heading_subtitle_pre_code_tl +\tl_set:Nn \l__exsheets_heading_subtitle_pre_code_tl { \use:n } +\tl_new:N \l__exsheets_heading_subtitle_post_code_tl \tl_new:N \l__exsheets_heading_points_format_tl \tl_new:N \l__exsheets_heading_points_pre_code_tl +\tl_set:Nn \l__exsheets_heading_points_pre_code_tl { \use:n } \tl_new:N \l__exsheets_heading_points_post_code_tl \tl_new:N \l__exsheets_heading_points_post_hook_tl @@ -146,62 +144,63 @@ % #2 = number, % #3 = points % #4 = bonus -\DeclareObjectType { exsheets-heading } { 4 } +% #5 = id +\DeclareObjectType { exsheets-heading } { 5 } % the `default' template interface: -\DeclareTemplateInterface { exsheets-heading } { default } { 4 } +\DeclareTemplateInterface { exsheets-heading } { default } { 5 } { - inline : boolean = false , - runin : boolean = false , - indent-first : boolean = false , - toc-reversed : boolean = false , - vscale : real = 1 , - above : length = 2pt , - below : length = 2pt , - main : tokenlist = , - pre-code : tokenlist = , - post-code : tokenlist = , - title-format : tokenlist = , - title-pre-code : tokenlist = , - title-post-code : tokenlist = , - number-format : tokenlist = , - number-pre-code : tokenlist = , - number-post-code : tokenlist = , - meta-pre-code : tokenlist = , - meta-post-code : tokenlist = , - points-format : tokenlist = , - points-pre-code : tokenlist = , - points-post-code : tokenlist = , - join : tokenlist = , - attach : tokenlist = + inline : boolean = false , + runin : boolean = false , + indent-first : boolean = false , + toc-reversed : boolean = false , + vscale : real = 1 , + above : length = 2pt , + below : length = 2pt , + main : tokenlist = , + pre-code : tokenlist = , + post-code : tokenlist = , + title-format : tokenlist = , + title-pre-code : tokenlist = , + title-post-code : tokenlist = , + number-format : tokenlist = , + number-pre-code : tokenlist = , + number-post-code : tokenlist = , + subtitle-pre-code : tokenlist = , + subtitle-post-code : tokenlist = , + points-format : tokenlist = , + points-pre-code : tokenlist = , + points-post-code : tokenlist = , + join : tokenlist = , + attach : tokenlist = } % the `default' template code: -\DeclareTemplateCode { exsheets-heading } { default } { 4 } +\DeclareTemplateCode { exsheets-heading } { default } { 5 } { - inline = \l__exsheets_heading_inline_bool , - runin = \l__exsheets_heading_runin_bool , - indent-first = \l__exsheets_heading_indent_first_bool , - toc-reversed = \l__exsheets_heading_toc_reversed_bool , - vscale = \l__exsheets_heading_scale_fp , - above = \l__exsheets_heading_above_dim , - below = \l__exsheets_heading_below_dim , - main = \l__exsheets_heading_main_tl , - pre-code = \l__exsheets_heading_pre_code_tl , - post-code = \l__exsheets_heading_post_code_tl , - title-format = \l__exsheets_heading_title_format_tl , - title-pre-code = \l__exsheets_heading_title_pre_code_tl , - title-post-code = \l__exsheets_heading_title_post_code_tl , - number-format = \l__exsheets_heading_number_format_tl , - number-pre-code = \l__exsheets_heading_number_pre_code_tl , - number-post-code = \l__exsheets_heading_number_post_code_tl , - meta-pre-code = \l__exsheets_heading_meta_pre_code_tl , - meta-post-code = \l__exsheets_heading_meta_post_code_tl , - points-format = \l__exsheets_heading_points_format_tl , - points-pre-code = \l__exsheets_heading_points_pre_code_tl , - points-post-code = \l__exsheets_heading_points_post_code_tl , - join = \l__exsheets_heading_joined_coffins_tl , - attach = \l__exsheets_heading_attached_coffins_tl + inline = \l__exsheets_heading_inline_bool , + runin = \l__exsheets_heading_runin_bool , + indent-first = \l__exsheets_heading_indent_first_bool , + toc-reversed = \l__exsheets_heading_toc_reversed_bool , + vscale = \l__exsheets_heading_scale_fp , + above = \l__exsheets_heading_above_dim , + below = \l__exsheets_heading_below_dim , + main = \l__exsheets_heading_main_tl , + pre-code = \l__exsheets_heading_pre_code_tl , + post-code = \l__exsheets_heading_post_code_tl , + title-format = \l__exsheets_heading_title_format_tl , + title-pre-code = \l__exsheets_heading_title_pre_code_tl , + title-post-code = \l__exsheets_heading_title_post_code_tl , + number-format = \l__exsheets_heading_number_format_tl , + number-pre-code = \l__exsheets_heading_number_pre_code_tl , + number-post-code = \l__exsheets_heading_number_post_code_tl , + subtitle-pre-code = \l__exsheets_heading_subtitle_pre_code_tl , + subtitle-post-code = \l__exsheets_heading_subtitle_post_code_tl , + points-format = \l__exsheets_heading_points_format_tl , + points-pre-code = \l__exsheets_heading_points_pre_code_tl , + points-post-code = \l__exsheets_heading_points_post_code_tl , + join = \l__exsheets_heading_joined_coffins_tl , + attach = \l__exsheets_heading_attached_coffins_tl } { \AssignTemplateKeys @@ -247,7 +246,7 @@ \tl_use:N \l__exsheets_heading_title_format_tl \strut \tl_use:N \l__exsheets_heading_title_pre_code_tl - { \tl_use:N \l__exsheets_heading_title_user_format_tl #1 } + { \tl_use:N \l_exsheets_heading_title_user_format_tl #1 } \tl_use:N \l__exsheets_heading_title_post_code_tl } \hcoffin_set:Nn \l__exsheets_heading_number_coffin @@ -257,28 +256,29 @@ { \tl_use:N \l__exsheets_heading_number_format_tl } \strut \tl_use:N \l__exsheets_heading_number_pre_code_tl - { \tl_use:N \l__exsheets_heading_title_user_format_tl #2 } + { \tl_use:N \l_exsheets_heading_title_user_format_tl #2 } \tl_use:N \l__exsheets_heading_number_post_code_tl } - % TODO: if questions are included via \includequestions - % \g__exsheets_questions_current_id_tl doesn't hold the current ID any - % more when the questions are typeset - \hcoffin_set:Nn \l__exsheets_heading_meta_coffin + \hcoffin_set:Nn \l__exsheets_heading_subtitle_coffin { - \prop_get:NoNT \g__exsheets_questions_meta_prop - { \g__exsheets_questions_current_id_tl } - \l__exsheets_questions_meta_tl + \prop_get:NnNT \g__exsheets_questions_subtitle_prop + { #5 } + \l__exsheets_questions_subtitle_tl { - \tl_use:N \l__exsheets_heading_meta_pre_code_tl - \tl_use:N \l__exsheets_questions_meta_tl - \tl_use:N \l__exsheets_heading_meta_post_code_tl + \tl_use:N \l__exsheets_heading_subtitle_pre_code_tl + { + \tl_use:N \l_exsheets_subtitle_format_tl + \tl_use:N \l__exsheets_questions_subtitle_tl + } + \tl_use:N \l__exsheets_heading_subtitle_post_code_tl } } \hcoffin_set:Nn \l__exsheets_heading_points_coffin { \bool_if:NTF \l__exsheets_parse_points_bool { - \bool_if:nF { \fp_compare_p:n { #3 = 0 } && \fp_compare_p:n { #4 = 0 } } + \bool_if:nF + { \fp_compare_p:n { #3 = 0 } && \fp_compare_p:n { #4 = 0 } } { \tl_use:N \l__exsheets_heading_points_format_tl \group_begin: @@ -296,7 +296,8 @@ { \exsheets_print_points:n { #3 } } { \exsheets_parse_points:n { #3 } } } - \bool_if:nT { !\fp_compare_p:n { #3 = 0 } && !\fp_compare_p:n { #4 = 0 } } + \bool_if:nT + { !\fp_compare_p:n { #3 = 0 } && !\fp_compare_p:n { #4 = 0 } } { ~ } \fp_compare:nF { #4 = 0 } { |