summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/exercisebank/README.txt28
-rw-r--r--Master/texmf-dist/doc/latex/exercisebank/example.zipbin59960 -> 60477 bytes
-rw-r--r--Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdfbin192009 -> 216892 bytes
-rw-r--r--Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex387
-rw-r--r--Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty350
5 files changed, 550 insertions, 215 deletions
diff --git a/Master/texmf-dist/doc/latex/exercisebank/README.txt b/Master/texmf-dist/doc/latex/exercisebank/README.txt
index 5851770e029..0cc36d155bc 100644
--- a/Master/texmf-dist/doc/latex/exercisebank/README.txt
+++ b/Master/texmf-dist/doc/latex/exercisebank/README.txt
@@ -2,25 +2,27 @@ Exercisebank:
A tool for creating and managing exercise sets in maths, physics, statistics and the like.
Files:
-- exercisebank.sty : The exercise bank
-- exercisebank-doc.pdf : Description of how the package works
-- exercisebank-doc.tex : Description of how the package works - documentation
-- example.zip : containing example
- |-- example.tex : example of use texfile
- |-- exampe.pdf : example of use output
- |-- exercises/ : Directory containing exercises that could be use
- |---|--- firstexercise.tex: example exercise
- |---|--- secondexercise.tex: example exercise
- |---|--- thirdexercise.tex: example exercise
+
+├── README.txt
+├── example.zip
+│   ├── example.pdf
+│   ├── example.tex
+│   └── exercises
+│   ├── firstexercise.tex
+│   ├── secondexercise.tex
+│   └── thirdexercise.tex
+├── exercisebank-doc.pdf
+├── exercisebank-doc.tex
+└── exercisebank.sty
Author: Storvik Strauman, Andreas
For bug report, inquires, contributed or anything else:
-https://github.com/Strauman/exerciseBank
+https://github.com/Strauman/exercisebank/
Licence:
-The LaTeX package exercisebank - version v0.1.0 (2018/04/08)
+The LaTeX package exercisebank - version v0.1.4 (2018/04/28) - build 74
exercisebank.sty: Exercise bank
-------------------------------------------------------------------------------------------
Copyright (c) 2018 by Andreas Storvik Strauman
@@ -33,4 +35,4 @@ The latest version of this license is in
and version 1.3c or later is part of all distributions of LaTeX
version 2008/05/04 or later.
This work has the LPPL maintenance status `author-maintained'.
-This work consists of all files listed in README
+This work consists of all files listed in README.txt
diff --git a/Master/texmf-dist/doc/latex/exercisebank/example.zip b/Master/texmf-dist/doc/latex/exercisebank/example.zip
index ffa5b38e9af..733003d592c 100644
--- a/Master/texmf-dist/doc/latex/exercisebank/example.zip
+++ b/Master/texmf-dist/doc/latex/exercisebank/example.zip
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf
index 9a30ecd502a..4594a33fcd6 100644
--- a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf
+++ b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex
index b4f3a1970ee..008b94ff30c 100644
--- a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex
+++ b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex
@@ -1,6 +1,6 @@
-%% exercisebank v0.1.0b55 - 2018/04/08
-%% The LaTeX package exercisebank - version v0.1.0 (2018/04/08) build 55
-%% #PACKAGE.sty
+%% exercisebank v0.1.4b74 - 2018/04/28
+%% The LaTeX package exercisebank - version v0.1.4 (2018/04/28) build 74
+%% Manual/Documentation for exercisebank.sty
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2018 by Andreas Storvik Strauman
%% -------------------------------------------------------------------------------------------
@@ -13,11 +13,13 @@
%% version 2008/05/04 or later.
%% This work has the LPPL maintenance status `author-maintained'.
%% This work consists of all files listed in README.txt
-\documentclass{article}
+\documentclass[a4paper]{article}
\usepackage[all]{tcolorbox}
\usepackage{needspace}
\usepackage{tabularx}
+\usepackage{geometry}
\makeatletter
+\def\input@path{{../../docs/}}
\lstdefinestyle{mydocumentation}{style=tcbdocumentation,
classoffset=0,
texcsstyle=*\color{blue},
@@ -41,14 +43,54 @@
\path[fill=yellow!50!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=4mm]interior.north west);
},
drop fuzzy shadow,#1}
- \title{Exercise bank - Manual\\{\normalsize v0.1.0}}
- \makeatother
+ \def\l@macro#1#2{#1\hfill\newline}
+\newcommand\macrotable{\hypersetup{linkcolor=black}\@starttoc{mac}\hypersetup{linkcolor=Definition}}
+\newcommand\gh[1]{\href{#1}{https://github.com/#1}}
+% --- CHANGELOG TABLE --- %
+\newcommand*\l@version[2]{%
+ \ifnum \c@tocdepth >\z@
+ \addpenalty\@secpenalty
+ \addvspace{1.0em \@plus\p@}%
+ \setlength\@tempdima{1.5em}%
+ \begingroup
+ \parindent \z@ \rightskip \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode \bfseries
+ \advance\leftskip\@tempdima
+ \hskip -\leftskip
+ #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{}\par
+ \endgroup
+ \fi}
+ \newcommand*\l@change[2]{%
+ \addvspace{0.5em \@plus\p@}%
+ \leftskip1em--\hspace{0.5em}\begin{minipage}{0.5\textwidth}#1\end{minipage}\hfill%
+ \begin{minipage}{0.3\textwidth}#2\end{minipage}\par%
+ }
+
+\newcommand\chlogtable{\begin{NoHyper}\@starttoc{chlog}\hypersetup{final}\end{NoHyper}}
+\def\newversion#1{\addcontentsline{chlog}{version}{#1}}
+\newcommand\change[2][]{\addtocontents{chlog}{\protect\contentsline{change}{#2}{#1}{section.\thepage}}}
+% --- /CHANGELOG TABLE --- %
+
+\let\oldTOC\tableofcontents
+\renewcommand\tableofcontents{\hypersetup{linkcolor=black}\oldTOC\hypersetup{linkcolor=Definition}}
+\reversemarginpar
+\def\updated#1{\tcbdocmarginnote{\bfseries{\color{blue}U}#1}}
+\def\defnew#1{\tcbdocmarginnote{\bfseries{\color{green}N}#1}}
+
\let\dac\docAuxCommand
+\def\mdac#1{\docAuxCommand{\expandafter\@gobble\string#1}}
+
+\makeatother
+
\long\def\keyDef#1#2#3#4{\begin{docKey}{#1}{=\meta{#2}}{\meta{default}=#3}#4\end{docKey}}
+\long\def\optDef#1#2{\begin{docKey*}{#1}{}{}#2\end{docKey*}}
\tcbset{documentation listing style=mydocumentation}
% Magenta HREF style
\let\oldhref\href
\gdef\href#1#2{{\color{magenta}\oldhref{#1}{#2}}}
+\tcbset{documentation listing style=mydocumentation,/tcb/color hyperlink=Definition}
+\hypersetup{colorlinks=true}
% Give section some space
\let\oldsection\section
\gdef\section{\needspace{0.3\paperheight}\oldsection}
@@ -57,12 +99,12 @@
\setlength{\parindent}{0pt}
-\title{{exercisebank - manual\\ v0.1.0{\\[-0.5em]\footnotesize(build 55)}}}
+\title{{exercisebank - manual\\ v0.1.4{\\[-0.5em]\footnotesize(build 74)}}}
\author{Andreas Strauman}
\begin{document}
\maketitle
-If you found any bugs or want new functionality, to contribute, view the commented source, get latest version of this package or get in touch with me, you can do all of that at \url{https://github.com/Strauman/exerciseBank/}. If you have questions of functionality, kindly direct them to the community\\ \url{http://tex.stackexchange.com}. The author is active on this site regularly.
+If you found any bugs or want new functionality, to contribute, view the commented source, get latest version of this package or get in touch with me, you can do all of that at \url{https://github.com/Strauman/exercisebank/}. If you have questions of functionality, kindly direct them to the community\\ \url{http://tex.stackexchange.com}. The author is active on this site regularly.
\tableofcontents
\clearpage
@@ -133,6 +175,10 @@ Here it's important to note that the [intro] argument would not make the intros
\makeset[intro]{myExerciseSet}{\exclude{myexercise}{1}}
\end{dispListing}
So we're excluding the partproblem 1. But that's the intro when we send the [intro] optional argument
+
+\subsection{Displaying numbers}
+If you have many part problems, counting the problem numbers can be a real hassle. Just use \dac{ShowNumbers}, and a big number will appear in front of every part problem!
+
\subsection{Multiple}
In \dac{makeset} you can just separate exercises with commas! Here is an example:
@@ -183,6 +229,20 @@ Maybe you want to see what files are what problems. One way to do that is hook i
Note that the \dac{At}{BeginProblem} is executed \emph{before} the headers.
+\subsection{Dynamic figure path}
+Exercisebank automatically allows you to \dac{input} and \dac{includegraphics} from
+the same as exercise is in. E.g. if you have a declared the option
+\begin{dispListing}
+\exercisebanksetup{exercise directory=exercises}
+\end{dispListing}
+ and you have a file \texttt{exercises/somedir/myexercise.tex}, you can put a figure in \texttt{exercises/somedir/} or make a directory with the same name as the file \texttt{exercises/somedir/myexercise/}. Then if you put a figure \texttt{exercises/somedir/myfig.png} or \texttt{exercises/somedir/myexercise/myfig.png} you can just do
+\begin{dispListing}
+ \includegraphics{myfig}
+\end{dispListing}
+
+You can change the root dir by doing \\
+\dac{exercisebanksetup}\brackets{\refKey{figure root directory}=figures}. See the \refKey{figure root directory} key for more info.
+
That covers the basics. Enjoy
\begin{marker}
\dac{begin}\{problem\},\dac{end}\{problem\},\\
@@ -190,7 +250,16 @@ That covers the basics. Enjoy
\dac{begin}\{intro\} and \dac{end}\{intro\} has to be on their own line without any spaces!
\end{marker}
\section{Reference}
-\subsection{Environments}
+\filbreak\subsection{Environments}
+ \addcontentsline{toc}{subsubsection}{\refEnv{intro}}
+\addcontentsline{toc}{subsubsection}{\refEnv{problem}}
+\addcontentsline{toc}{subsubsection}{\refEnv{solution}}
+
+
+\begin{docCommand}{DisplaySolutions}{}\addcontentsline{toc}{subsubsection}{\refCom{DisplaySolutions}}
+
+Turns on the solutions, so they are shown.
+\end{docCommand}
\begin{docEnvironment}{problem}{}
Inside the \dac{keyRef}\{exercise directory\}, you keep your exercises. Inside the exercise file you'd use a problem environment to write your partproblems. It might be a little confusing that you're using \dac{begin}\{problem\} instead of \dac{begin}\{partproblem\} when you're writing a partproblem, but it's less typing.
\end{docEnvironment}
@@ -198,16 +267,103 @@ Inside the \dac{keyRef}\{exercise directory\}, you keep your exercises. Inside t
Things inside here is only visible if \refCom{DisplaySolutions} are given before \dac{begin}\{document\}
\begin{marker}\dac{end}\{solution\} has to be on it's own line without any leading spaces!\end{marker}
\end{docEnvironment}
-\begin{docCommand}{DisplaySolutions}{}
-Turns on the solutions, so they are shown.
-\end{docCommand}
\begin{docEnvironment}{intro}{}
Sometimes you'd want to introcude your exercises and tell a little bit about it. Maybe have a figure there also. Those things should go inside this environment. This can be treated as a problem in terms of counting. See \refCom{makeset} for more info.
\end{docEnvironment}
-\subsection{Configuration and options}
+\filbreak\subsection{Making sets}
+\begin{docCommand}{spritesets}{\marg{setlist}}\addcontentsline{toc}{subsubsection}{\refCom{spritesets}}
+
+ This is a command that is used by sprite to determine what sets are shown in sprite. If this is not given, sprite uses all sets given in \dac{makset}
+\end{docCommand}
+\begin{docCommand}{makeset}{\oarg{intro,nohead}\marg{filable}}\addcontentsline{toc}{subsubsection}{\refCom{makeset}}
+\updated{v0.1.4\\2018/04/28 }
+ This command is the one you use to make a set! Later you use \dac{buildset} to build the sets you make. The \meta{filable} argument is either the name of the file relative to the \dac{setExercisesDir}-path (default is nothing, so it's in the root path), or you could use the \dac{select} or \dac{exclude} to respectively cherry pick or exclude exercises. (See their docs).\\
+ \oarg{intro} this counts the intro environment as a part problem, so that you can \dac{select} or \dac{exclude} the intro\\
+ \oarg{nohead} prevents the builder from adding a problem header. This is handy if you want to create an exercise that is composed of multiple parts. You can use the \dac{phead} to insert the problem header where you want it
+\begin{dispListing}
+ \makeset[nohead]\{\phead, \select{myexercise}{1,2,3}}
+\end{dispListing}
+\end{docCommand}
+\begin{docCommand}{about}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{about}}
+
+This contains information about an exercise set. It is intended to be on the top of an
+exercise, explaining short what the exercise is about. It's only visible when using \dac{sprite}
+\end{docCommand}
+\begin{docCommand}{sprite}{\oarg{PiP}}\addcontentsline{toc}{subsubsection}{\refCom{sprite}}
+\updated{v0.1.1\\2018/04/13 }
+ This is a way to visualize all exercises. It takes one optional argument which is how many pages
+ inside one page. Defaults to 4
+ \begin{marker}If \dac{sprite} is used, it should be the only command in \dac{begin}\{document\}\dac{end}\{document\}\end{marker}
+\end{docCommand}
+\begin{docCommand}{exclude}{\marg{exerciseFileName}\marg{Comma separated numbers}}\addcontentsline{toc}{subsubsection}{\refCom{exclude}}
+\updated{v0.1.4\\2018/04/28 }
+As you can see in the intro section of the documentation, this is for excluding partproblems
+To be used in \refCom{makeset}
+\end{docCommand}
+\begin{docCommand}{select}{\marg{exerciseFileName}\marg{Comma separated numbers}}\addcontentsline{toc}{subsubsection}{\refCom{select}}
+\updated{v0.1.4\\2018/04/28 }
+As you can see in the intro section of the documentation, this is for cherry picking partproblems
+To be used in \refCom{makeset}
+\end{docCommand}
+\begin{docCommand}{DeclareExerciseCommand}{\marg{\dac{command}}\marg{actions}}\addcontentsline{toc}{subsubsection}{\refCom{DeclareExerciseCommand}}
+\defnew{v0.1.4\\2018/04/28 }
+This can be used later in makesets. E.g.
+\dac{DelcareExerciseCommand}\{\dac{pbreak}\}\brackets{\dac{clearpage}} will make
+\dac{pbreak} behave like \dac{clearpage} in the set:
+\begin{dispListing}
+\makeset[nohead]{%
+ \phead,
+ myExercise,
+ \pbreak,
+ myExerciseOnNewPage%
+}
+\end{dispListing}
+\end{docCommand}
+\begin{docCommand}{exec}{\marg{macros}}\addcontentsline{toc}{subsubsection}{\refCom{exec}}
+\updated{v0.1.4\\2018/04/28 }
+You can use this in \dac{makeset} to execute commands between problems.
+E.g. to insert a new page in between two problems when using nohead:
+\begin{dispListing}
+\makeset[nohead]{2}{\phead,my/exercise,\exec{\clearpage},next/exercise}
+\end{dispListing}
+\end{docCommand}
+\begin{docCommand}{setName}{}\addcontentsline{toc}{subsubsection}{\refCom{setName}}
+
+This variable prints out the name of your set that you sent to \dac{buildset}.
+The following example prints "Exercise set number 1" and "Exercise set number 2" on the top of each set
+\begin{dispListing}
+\At\StartBuildset{
+ Exercise set number \setName
+}
+ %... \makesets here ...%
+\begin{document}
+ \buildset{1}{myexercise}
+ \buildset{2}{myexercise}
+\end{document}
+\end{dispListing}
+\end{docCommand}
+\begin{docCommand}{pplabel}{\marg{label}}\addcontentsline{toc}{subsubsection}{\refCom{pplabel}}
+
+Labels a partproblem. You can reference to it later using \dac{ppref}\{\meta{label\}}
+\end{docCommand}
+\begin{docCommand}{ppref}{\marg{label}}\addcontentsline{toc}{subsubsection}{\refCom{ppref}}
+\updated{v0.1.4\\2018/04/28 }
+Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e.g. 1c)
+\end{docCommand}
+\begin{docCommand}{pref}{\marg{label}}\addcontentsline{toc}{subsubsection}{\refCom{pref}}
+
+ Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e.g. 1
+\end{docCommand}
+\filbreak\subsection{Configuration and options}
You can do a lot of configurations on this package, and probably
even more to come in later versions!
-\begin{docCommand}{exercisebanksetup}{\marg{[key/values]}}
+\begin{docCommand}{ShowNumbers}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowNumbers}}
+\updated{v0.1.4\\2018/04/28 }
+ Shows the numbers in fron of the part problems and intros that should be used with
+ \dac{exclude} and \dac{select}
+\end{docCommand}
+\begin{docCommand}{exercisebanksetup}{\marg{[key/values]}}\addcontentsline{toc}{subsubsection}{\refCom{exercisebanksetup}}
+\defnew{v0.1.0\\2018/04/08 }
Here is a list of the different keys and their meaning
\keyDef{part problems}{On/Off}{On}{
This is whether or not to do part problems. E.g. 1a), 1b) etc.
@@ -232,15 +388,30 @@ You can do a lot of configurations on this package, and probably
\keyDef{solution header}{string}{see below}{
\dac{large}\{\dac{textbf}{\dac{@tr}{Solution\}:}}
}
-\keyDef{exercise directory}{string}{./}{
+\keyDef{exercise directory}{dir}{./}{
This key is used for setting the default exercise directory.
}
+\keyDef{figure root directory}{dir}{\meta{exercise directory}}{
+Exercisebank automatically allows you to \dac{input}{} and \dac{includegraphics}{} from
+the same folder folder that your exercise is in, as well as a folder with the
+same name as the exercise file. This is elaborated in the intro section.
+However, you might want to put the figures inside a different directory.
+For example if you have one directory containing your problems called \texttt{exercises/},
+set with \refKey{exercise directory}, and a file containing the exercise:
+ \texttt{exercises/faradaysLaw/ACGenerate.tex}.
+Then by default figures in the directories \texttt{exercises/faradaysLaw/} and
+\texttt{exercises/faradaysLaw/ACGenerate/} can be included by just doing \dac{includegraphics}.
+And if you want to change the root of this directory to be \texttt{figures}, such that
+exercisebank looks for figures in \texttt{figures/faradaysLaw/} and \texttt{figures/faradaysLaw/ACGenerate/}
+You would use this option in the setup: \dac{exercisebanksetup}\{figure root directory=figures\}
+}
\begin{dispListing}
\exercisebanksetup{exercise directory=exercises,part problems=Off,solution header={\textbf{SOL:}}}
\end{dispListing}
\end{docCommand}
-\subsection{Internationalization}
-\begin{docCommand}{translateExBank}{\marg{Translation key/vals}}
+\filbreak\subsection{Internationalization}
+\begin{docCommand}{translateExBank}{\marg{Translation key/vals}}\addcontentsline{toc}{subsubsection}{\refCom{translateExBank}}
+
This is to translate the text inside the package. As of now the available key/values are
\begin{itemize}
\item Problem
@@ -251,125 +422,129 @@ The Norwegian translation would then be done with
\translateExBank{Problem=Oppgave, Solution=Løsning}
\end{dispListing}
\end{docCommand}
-\subsection{Triggers}
-\begin{docCommand}{Trigger}{\marg{Any Macro}}
+\filbreak\subsection{Triggers}
+\begin{docCommand}{Trigger}{\marg{Any Macro}}\addcontentsline{toc}{subsubsection}{\refCom{Trigger}}
+\updated{v0.1.3\\2018/04/20 }
See \refCom{At}\\
Available triggers:\\
\dac{Trigger}\dac{BeginPartproblem}:\\ Triggers before a partproblem is inserted\\
-\dac{Trigger}\dac{VeryBeginPartproblem}:\\ Triggers right after \dac{BeginPartproblem}. This is so that the user can do stuff before the actual headers start. The partproblem headers are invoked by \dac{At}\dac{VeryBeginPartproblem}
+\dac{Trigger}\dac{VeryBeginPartproblem}:\\ Triggers right after \dac{BeginPartproblem}. This is so that the user can do stuff before the actual headers start. The partproblem headers are invoked by \dac{At}\dac{VeryBeginPartproblem}\\
\dac{Trigger}\dac{InputExercise}:\\ Triggers before a file is included\\\
\dac{Trigger}\dac{BeginProblem}:\\ Triggers before a file is included, but only if problem headers are to be written (no [nohead] given)\\
-\dac{Trigger}\dac{EndProblem}:\\ Triggers right after problem is included if [nohead] \dac{emph}\{not\} given\\
+\dac{Trigger}\dac{EndProblem}:\\ Triggers right after problem is included if [nohead] \emph{not} given\\
\dac{Trigger}\dac{BeginBuildset}:\\ Triggers right before a set has begun building (not if \dac{sprite} is used). You might want to put your set-header here\\
\dac{Trigger}\dac{EndBuildset}:\\ Triggers when a set has stopped building (not if \dac{sprite} is used)\\
\end{docCommand}
-\subsection{General reference}
-\begin{docCommand}{ownLineNoSpacesGotIt}{}
+\filbreak\subsection{General reference}
+\begin{docCommand}{ownLineNoSpacesGotIt}{}\addcontentsline{toc}{subsubsection}{\refCom{ownLineNoSpacesGotIt}}
+
This is to annoy the user enough to get his attention about the requirements of the \refEnv{problem}, \refEnv{solution} and \refEnv{intro} environments.\\
\end{docCommand}
\begin{marker}DEPRECATED! use \refCom{exercisebanksetup} with \refKey{exercise directory} instead!\end{marker}
-\begin{docCommand}{setExercisesDir}{\marg{directory}}
+\begin{docCommand}{setExercisesDir}{\marg{directory}}\addcontentsline{toc}{subsubsection}{\refCom{setExercisesDir}}
+
\begin{marker}\dac{setExercisesDir} is deprecated! use \refCom{exercisebanksetup} with \refKey{exercise directory} instead!\end{marker}
This is the directory, relative to the file you included the package,
where the package should be looking for exercises. Default is the same directory as your main file (the one you build).
\end{docCommand}
+\begin{docCommand}{isin}{\marg{haystack}\marg{needle}\marg{True}\marg{False}}\addcontentsline{toc}{subsubsection}{\refCom{isin}}
+
+ \meta{haystack} is a comma separated list of integers\\
+ \meta{needle} is an integer\\
+ Executes \meta{True} if \meta{needle} is found in \meta{haystack}
+ else executes \meta{False}
+\end{docCommand}
This package also includes some extra stuff. For example the \dac{At} and \dac{Trigger}
\begin{docCommand}{At}{\marg{AnyMacro}}
-Here you can send any macro because it isn't evaluated! For example \dac{At}\dac{BeginSomething} is fine and even if \dac{BeginSomething} is not defined. Also and when using \dac{Trigger} it just ignores it if it didn't exist. It's pretty similar in function as to \dac{AtBeginDocument}.
+\updated{v0.1.3\\2018/04/20 }Here you can send any macro because it isn't evaluated! For example \dac{At}\dac{BeginSomething} is fine and even if \dac{BeginSomething} is not defined. Also and when using \dac{Trigger} it just ignores it if it didn't exist. It's pretty similar in function as to \dac{AtBeginDocument}.
\begin{dispListing}
\At\BeginSomething{DoSomething}
Which is triggered with
\Trigger\BeginSomething, this evaluates to DoSomething
\end{dispListing}
\end{docCommand}
-\begin{docCommand}{isin}{\marg{haystack}\marg{needle}\marg{True}\marg{False}}
- \meta{haystack} is a comma separated list of integers\\
- \meta{needle} is an integer\\
- Executes \meta{True} if \meta{needle} is found in \meta{haystack}
- else executes \meta{False}
-\end{docCommand}
-\begin{docCommand}{exerciseFile}{}
+\begin{docCommand}{exerciseFile}{}\addcontentsline{toc}{subsubsection}{\refCom{exerciseFile}}
+
This is a `read-only' macro that contains the name of the current exerciseFile
\end{docCommand}
-\subsection{Making sets}
-\begin{docCommand}{makeset}{\oarg{intro,nohead}\marg{filable}}
- This command is the one you use to make a set! Later you use \dac{buildset} to build the sets you make. The \meta{filable} argument is either the name of the file relative to the \dac{setExercisesDir}-path (default is nothing, so it's in the root path), or you could use the \dac{select} or \dac{exclude} to respectively cherry pick or exclude exercises. (See their docs).\\
- \oarg{intro} this counts the intro environment as a part problem, so that you can \dac{select} or \dac{exclude} the intro\\
- \oarg{nohead} prevents the builder from adding a problem header. This is handy if you want to create an exercise that is composed of multiple parts. You can use the \dac{phead} to insert the problem header where you want it
-\begin{dispListing}
- \makeset[nohead]\{\phead, \select{myexercise}{1,2,3}}
-\end{dispListing}
-\end{docCommand}
-\begin{docCommand}{about}{\marg{text}}
-This contains information about an exercise set. It is intended to be on the top of an
-exercise, explaining short what the exercise is about. It's only visible when using \dac{sprite}
-\end{docCommand}
-\begin{docCommand}{sprite}{\oarg{PiP}}
- This is a way to visualize all exercises. It takes one optional argument which is how many pages
- inside one page. Defaults to 4
- \begin{marker}If \dac{sprite} is used, it should be the only command in \dac{begin}\{document\}\dac{end}\{document\}\end{marker}
-\end{docCommand}
-\begin{docCommand}{exclude}{\marg{exerciseFileName}\marg{Comma separated numbers}}
-As you can see in the intro section of the documentation, this is for excluding partproblems
-To be used in \refCom{makeset}
-\end{docCommand}
-\begin{docCommand}{select}{\marg{exerciseFileName}\marg{Comma separated numbers}}
-As you can see in the intro section of the documentation, this is for cherry picking partproblems
-To be used in \refCom{makeset}
-\end{docCommand}
-\begin{docCommand}{setName}{}
-This variable prints out the name of your set that you sent to \dac{buildset}.
-The following example prints "Exercise set number 1" and "Exercise set number 2" on the top of each set
-\begin{dispListing}
-\At\StartBuildset{
- Exercise set number \setName
-}
- %... \makesets here ...%
-\begin{document}
- \buildset{1}{myexercise}
- \buildset{2}{myexercise}
-\end{document}
-\end{dispListing}
-\end{docCommand}
-\begin{docCommand}{pplabel}{\marg{label}}
-Labels a partproblem. You can reference to it later using \dac{ppref}\{\meta{label\}}
-\end{docCommand}
-\begin{docCommand}{ppref}{\marg{label}}
-Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e.g. 1c)
-\end{docCommand}
-\begin{docCommand}{ppref}{\marg{label}}
- Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e.g. 1
-\end{docCommand}
-\subsection{Counters}
+\filbreak\subsection{Counters}
\docCounter{problemcounter}-counter holds the current problem number and
\docCounter{partproblemcounter}-counter holds the current partproblem \emph{number}.
+\filbreak\subsection{Macro definitions}
+
+ \addcontentsline{mac}{macro}{\refCom{At}}{}
+\addcontentsline{mac}{macro}{\refCom{DeclareExerciseCommand}}{}
+\addcontentsline{mac}{macro}{\refCom{DisplaySolutions}}{}
+\addcontentsline{mac}{macro}{\refCom{ShowNumbers}}{}
+\addcontentsline{mac}{macro}{\refCom{Trigger}}{}
+\addcontentsline{mac}{macro}{\refCom{about}}{}
+\addcontentsline{mac}{macro}{\refCom{exclude}}{}
+\addcontentsline{mac}{macro}{\refCom{exec}}{}
+\addcontentsline{mac}{macro}{\refCom{exerciseFile}}{}
+\addcontentsline{mac}{macro}{\refCom{exercisebanksetup}}{}
+\addcontentsline{mac}{macro}{\refCom{isin}}{}
+\addcontentsline{mac}{macro}{\refCom{makeset}}{}
+\addcontentsline{mac}{macro}{\refCom{ownLineNoSpacesGotIt}}{}
+\addcontentsline{mac}{macro}{\refCom{pplabel}}{}
+\addcontentsline{mac}{macro}{\refCom{ppref}}{}
+\addcontentsline{mac}{macro}{\refCom{pref}}{}
+\addcontentsline{mac}{macro}{\refCom{select}}{}
+\addcontentsline{mac}{macro}{\refCom{setExercisesDir}}{}
+\addcontentsline{mac}{macro}{\refCom{setName}}{}
+\addcontentsline{mac}{macro}{\refCom{sprite}}{}
+\addcontentsline{mac}{macro}{\refCom{spritesets}}{}
+\addcontentsline{mac}{macro}{\refCom{translateExBank}}{}
+
+ \macrotable
+
+% \newgeometry{lmargin=0.7cm}
\section{Changelog}
%!TEX root = exercisebank-doc.tex
-\begin{tabularx}{\textwidth}{llX}
- Version&Date&Change\\
- v0.0.2b11&2018/04/02&Updated documentation syntax.\\
- v0.0.3b38&2018/04/03&\nobreak\begin{itemize}
- \item Updated triggers doc
- \item added trigger \dac{VeryBeginPartproblem}
- \end{itemize}\\
- v0.0.3b40&2018/04/03&\begin{itemize}
- \item Added examples that uses the \dac{At} command.
- Making front page and other snacks
- \end{itemize}\\
- v0.0.4b44&2018/04/03&\begin{itemize}
- \item Changed design of part problems. (Looks much better now!)
- \end{itemize}\\
- v0.0.5b46&2018/04/03&\begin{itemize}
- \item Fixed partproblems and solutions to fit on pages using \dac{filbreak}.
- \end{itemize}\\
- v0.1.0&2018/04/08&\begin{itemize}
- \item \begin{marker}Backward incompability from v0.0.5:Removed default exercise directory! \end{marker} Use \dac{exercisebanksetup}\brackets{exercise directory=exercises} if you used the package before 2018/04/08!
- \item Fixed title of documentation to match actual package.
- \item Fixed weird paragraph styling when displaying solutions
- \item Added a few package options. More to come!
- \end{itemize}\\
-\end{tabularx}
+\newversion{v0.0.2b11 2018/04/02}
+ \change{Updated documentation syntax.}
+\newversion{v0.0.3b38 2018/04/03}\nobreak
+ \change{Updated triggers doc}
+ \change{added trigger \dac{VeryBeginPartproblem}}
+
+\newversion{v0.0.3b40 2018/04/03}
+ \change{Added examples that uses the \refCom{At} command.}
+ \change{Making front page and other snacks}
+
+\newversion{v0.0.4b44 2018/04/03}
+ \change{Changed design of part problems. (Looks much better now!)}
+
+\newversion{v0.0.5b46 2018/04/03}
+ \change{Fixed partproblems and solutions to fit on pages using \dac{filbreak}.}
+
+\newversion{v0.1.0 2018/04/08}
+ \change{Fixed title of documentation to match actual package.}
+ \change{Fixed weird paragraph styling when displaying solutions}
+ \change{Added a few package options. More to come!}
+
+\newversion{v0.1.1 2018/04/13}
+ \change{Added \refCom{exec}, which allows the user to execute macros between problems}
+ \change{Bug fix: \refCom{At} would cause crash due to latexmk multiple builds}
+ \change{Bug fix: \refCom{sprite} wouldn't build correctly}
+ \change{Bug fix: misc bugs involving \refCom{makeset}, \refCom{buildset}, nohead and \refCom{phead}}
+
+\newversion{v0.1.2 2018/04/17}
+ \change{Fixed bug that \refCom{select} and \refCom{exclude} not working as expected.}
+ \change{Added \refCom{ShowNumbers} for displaying numbers related to use in \refCom{select} and \refCom{exclude}}
+
+\newversion{v0.1.3 2018/04/20}
+ \change{Added custom dynamic figure path \refKey{figure root directory}.}
+ \change{Fixed bugs related to \refCom{phead} and the commands used in \refCom{makeset}-lists.}
+\newversion{ 2018/04/28}
+ % \change{Introduced solutions only: \refCom{SolutionsOnly}}
+ \change{Fixed paragraph tightening when displaying solutions}
+ \change{Introduced \refCom{DeclareExerciseCommand}}
+ \change{Fixed bug with \refCom{exec}}
+ \change{Iteration over items now uses a more lighweight approach.}
+ \change{For commands that takes `lists' as arguments (\refCom{makeset}, \refCom{select} and \refCom{exclude}), the last item of the list can be terminated with new line or spaces without problems.}
+ \change{For commands that takes `lists' as arguments, the entries in the list are now trimmed whitespaces on both sides.}
+ \change{Fixed bug where \refCom{ppref} did not reference letter in part problem.}
+\chlogtable
\end{document}
diff --git a/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty b/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty
index 059c4e1973b..6d32887e413 100644
--- a/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty
+++ b/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty
@@ -1,5 +1,5 @@
-% Source (with comments) can be found at https://github.com/Strauman/exerciseBank
-%% The LaTeX package exercisebank - version v0.1.0 (2018/04/08) - build 55
+% Source (with comments) can be found at https://github.com/Strauman/exercisebank/
+%% The LaTeX package exercisebank - version v0.1.4 (2018/04/28) - build 74
%% exercisebank.sty: Exercise bank
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2018 by Andreas Storvik Strauman <andreas dot s dot strauman at uit dot no>
@@ -13,9 +13,10 @@
%% version 2008/05/04 or later.
%% This work has the LPPL maintenance status `author-maintained'.
%% This work consists of all files listed in README
-\ProvidesPackage{exercisebank}[2018/04/08 v0.1.0 Creates a setup that gives freedom in making sets and exercises.]
-\PackageWarningNoLine{exercisebank-v0.1.0}{This package is in the alpha stage, and if something unexpected happens please, oh pretty please, report it to https://github.com/Strauman/exerciseBank. Thank you!}
-\@ifundefined{ownLineNoSpacesGotIt}{\@latex@warning{Compilation wont work unless \string\end{problem} and \string\end{solution} are on their own lines and without any spaces. This warning can be removed by doing \string\def\string\ownLineNoSpacesGotIt{} before \@backslashchar usepackage{exbank}}
+\ProvidesPackage{exercisebank}[2018/04/28 v0.1.4 Creates a setup that gives freedom in making sets and exercises.]
+\xdef\exbank@quiet{1}
+\PackageWarningNoLine{exercisebank-v0.1.4}{This package is in the alpha stage, and if something unexpected happens please, oh pretty please, report it to https://github.com/Strauman/exerciseBank. Thank you!}
+\@ifundefined{ownLineNoSpacesGotIt}{\@latex@warning{Compilation wont work unless \string\end{problem} and \string\end{solution} are on their own lines and without any spaces. This warning can be removed by doing \string\def\string\ownLineNoSpacesGotIt{} before \@backslashchar usepackage{exercisebank}}
}{}
\gdef\setExercisesDir#1{\@latex@error{\string\setExercisesDir is deprecated. Use \string\exercisebanksetup{exercise directory=#1} instead}{}\stop\bye
}
@@ -29,8 +30,59 @@
\usepackage{calc}
\usepackage{pgfpages}
\usepackage{geometry}
+\usepackage{listofitems}
+\usepackage{trimspaces}
\edef\@isTrue{1}
\edef\@isFalse{0}
+\gdef\isin#1#2#3#4{ \def\needle{#2}
+ \def\haystack{#1}
+ \def\isFalse{0}
+ \let\isInList = \isFalse
+ \IfInteger{\needle}{}{\@latex@error{ISIN: Can't look for part problem that is not numeric!}{}\bye\stop}
+ \IfInteger{\haystack}{ \ifnum\haystack=\needle\relax
+ #3
+ \else
+ #4
+ \fi
+}{ \foreach\pp in #1{ \ifnum\pp=\needle\relax%
+ \gdef\isInList{1}
+ #3
+ \fi
+}
+ \if\isInList\isFalse
+ #4
+ \fi
+}
+}
+\gdef\strif#1#2{%
+ \ifnum\pdfstrcmp{#1}{#2}=\z@\relax%
+}
+\let\ea = \expandafter
+\begingroup\lccode`\|=`\\
+\lowercase{\endgroup\def\removebs#1{\if#1|\else#1\fi}}
+\gdef\exbank@macroname#1{\expandafter\removebs\string#1}
+\gdef\@noneofone#1{}
+\gdef\@noneoftwo#1#2{}
+\@ifundefined{exbank@quiet}{ \global\let\@dlog\@latex@warning
+}{ \global\let\@dlog\@noneofone
+}
+\newcommand\ex@before[2]{\edef #1{\unexpanded{#2}\unexpanded\expandafter{#1}}
+}
+\newcommand{\exb@lmargin}[2]{\strut\vadjust{\exb@domark{#1}{#2}}}
+\newcommand{\exb@domark}[2]{%
+ \hbox to #2{ \vbox to 0pt{ \kern-\dp\strutbox
+ \smash{\llap{#1}}
+ \vss
+}%
+}
+}
+\edef\@isTrue{1}
+\edef\@isFalse{0}
+\gdef\ShowNumbers{\gdef\@displayMetaCounter{\isTrue}}
+\gdef\@DisplaySolutions{\@isFalse}
+\gdef\DisplaySolutions{\xdef\@DisplaySolutions{\isTrue}\@latex@warning{Showing solutions}}
+\gdef\@SolutionsOnly{\@isFalse}
+\gdef\SolutionsOnly{\xdef\@SolutionsOnly{\@isTrue}\DisplaySolutions}
\pgfkeys{/exbanksetup/.is family, /exbanksetup,
default/.style = { part problems = On,
tighten paragraphs = True,
@@ -38,8 +90,10 @@ default/.style = { part problems = On,
part problem header={\large\textbf{(\theproblemcounter\alph{partproblemcounter})}},
solution header={\large{\textbf{\@tr{Solution}:}}},
exercise directory=.,
+ figure root directory=\@exercisesDir,
},
exercise directory/.estore in = \@exercisesDir, %
+figure root directory/.estore in = \@figrootDir, %
problem header/.store in = \exbank@opt@problemHeader,
part problem header/.store in = \exbank@opt@partProblemHeader,
solution header/.store in = \exbank@opt@solutionHeader,
@@ -56,6 +110,30 @@ switches/.cd,
\newcommand\exercisebanksetup[1]{ \pgfkeys{/exbanksetup, #1}%
}
\exercisebanksetup{default}
+\AtBeginDocument{\xdef\tpd{\the\prevdepth}}
+\gdef\tighten@paragraph{%
+\if\exbank@opt@tightenparagraphs\@isTrue\relax%
+ \if\@SolutionsOnly\@isFalse
+ \if\@DisplaySolutions\@isFalse
+ \filbreak%
+ \fi
+ \fi
+\fi%
+}
+\gdef\tighten@paragraph@solutions{%
+\if\exbank@opt@tightenparagraphs\@isTrue\relax%
+ \if\@SolutionsOnly\@isFalse
+ \if\@DisplaySolutions\@isTrue
+ \filbreak%
+ \fi
+ \fi
+\fi%
+}
+\gdef\tighten@paragraph@always{%
+\if\exbank@opt@tightenparagraphs\@isTrue\relax%
+\filbreak%
+\fi%
+}
\pgfkeys{ /exbanki18n/.is family, /exbanki18n,
default/.style = {Problem = Problem, Solution = Solution},
Problem/.estore in = \@tr@Problem,
@@ -68,18 +146,35 @@ switches/.cd,
}
}
\let\ea = \expandafter
-\def\removebs#1{\if#1\@backslashchar\else#1\fi}
-\newcommand{\At}[2]{ \def\macname{\expandafter\removebs\detokenize{#1}}
- \let\mname = \macname
+\begingroup\lccode`\|=`\\
+\lowercase{\endgroup\def\removebs#1{\if#1|\else#1\fi}}
+\newcommand{\At}[2]{ \edef\mname{\exbank@macroname{#1}}
\ifcsname At@\mname\endcsname
\ea\g@addto@macro\csname At@\mname\endcsname{#2}
\else
\ea\gdef\csname At@\mname\endcsname{#2}
+ \AtEndDocument{ \expandafter\let\csname At@\mname\endcsname\relax
+}
\fi
}
-\newcommand{\Trigger}[1]{ \def\macname{\expandafter\removebs\detokenize{#1}}
- \let\mname = \macname
- \@ifundefined{At@\mname}{}{\csname At@\mname\endcsname}
+\newcommand{\Trigger}[1]{ \edef\mname{\exbank@macroname{#1}}
+ \ea\@ifundefined{At@\mname}{}{%
+ \csname At@\mname\endcsname%
+}%
+}
+\xdef\figuresPath{\@figrootDir/}
+\gdef\fileInputPath{}
+\gdef\fileInputBase{}
+\providecommand*{\input@path}{}
+\g@addto@macro\input@path{{\fileInputBase}{\fileInputPath}}
+\At\PathControl{ \xdef\figuresPath{\@figrootDir/}
+ \edef\exfile{\exerciseFile}
+ \expandafter\filename@parse{\exfile}
+ \xdef\fileInputPath{\figuresPath\filename@area}
+ \xdef\fileInputBase{\figuresPath\filename@area\filename@base/}
+ \graphicspath{{\fileInputBase}{\fileInputPath}}
+ \@dlog{\fileInputBase}
+ \@ifundefined{input@path}{\gdef\input@path{{\fileInputBase}{\fileInputPath}}}{}
}
\newlength{\ppLeading}
\newlength{\pMarginBelow}
@@ -111,17 +206,21 @@ switches/.cd,
\end{addmargin}
\vspace*{\pMarginBelow}
}
-\At\EndProblem{ \if\exbank@opt@tightenparagraphs\isTrue\filbreak\fi
+\At\EndProblem{\tighten@paragraph
}
\At\VeryBeginPartproblem{%
\stepcounter{partproblemcounter}%
+ \bgroup
+ \if\@displayMetaCounter\isTrue\relax%
+ \ex@before\exbank@opt@partProblemHeader{{\Large\themetacounter}:}
+ \fi
\begin{addmargin}{\ppMargin}
- \if\exbank@opt@tightenparagraphs\isTrue\filbreak\fi
\begin{itemize}
\item[\exbank@opt@partProblemHeader]
}
\At\EndPartproblem{ \end{itemize}
\end{addmargin}
+ \egroup\tighten@paragraph
\vspace*{\pMarginBelow}%
}
\At\BeginSolution{ \vspace*{1em}
@@ -132,36 +231,43 @@ switches/.cd,
\At\EndSolution{ \end{itemize}
\end{addmargin}
}
+\At\EndProblem{%
+\if\exbank@opt@tightenparagraphs\@isTrue\relax%
+ \if\@SolutionsOnly\@isFalse%
+ \if\@DisplaySolutions\@isTrue%
+ \penalty-300%
+ \fi%
+ \fi%
+\fi%
+}
+\@ifundefined{figure}{}{\edef\figure{\unexpanded{\tighten@paragraph@always}\unexpanded\expandafter{\figure}}
+}
+\@ifundefined{endfigure}{}{\g@addto@macro\endfigure{\tighten@paragraph@always}
+}
\gdef\isFalse{0}
\gdef\isTrue{1}
\gdef\DisplayProblem{\isTrue}
\gdef\@displayMetaCounter{\isFalse}
-\gdef\ShowNumbers{\gdef\@displayMetaCounter{\isTrue}}
-\gdef\@DisplaySolutions{\isFalse}
-\gdef\DisplaySolutions{\xdef\@DisplaySolutions{\isTrue}\@latex@warning{Showing solutions}}
\AtBeginDocument{ \if\@DisplaySolutions\isFalse
\@latex@warning{Hiding solutions. Show them with \string\DisplaySolutions}
\fi
}
\global\let\do@ProcessCutFile = \ProcessCutFile
\gdef\showhideproblem#1{%
- \if\@displayMetaCounter\isTrue%
- {P:\Large\themetacounter}
- \Trigger\BeginPartproblem
- \Trigger\VeryBeginPartproblem
- \gdef\DisplayProblem{\isTrue}
+ \if\DisplayProblem\isFalse
+ \def\ProcessCutFile{}
\else
- \if\DisplayProblem\isFalse
- \def\ProcessCutFile{}
- \else
- #1
- \fi
+ \if\@SolutionsOnly\@isTrue\relax%
+ \def\ProcessCutFile{}\fi%
+ #1
\fi
}
\generalcomment{problem}{ \edef\DisplaySolution{\@DisplaySolutions}
+ \stepcounter{metacounter}
\Trigger\DecideProblemDisplay
\begingroup
- \showhideproblem{ \if\exbank@opt@partProblems\isTrue
+ \showhideproblem{%
+ \if\exbank@opt@partProblems\isTrue
\Trigger\BeginPartproblem
\Trigger\VeryBeginPartproblem
\else
@@ -169,9 +275,10 @@ switches/.cd,
\Trigger\VeryBeginProblem
\fi
}
-}{ \if\DisplayProblem\isFalse\else
+}{ \if\DisplayProblem\@isFalse\relax\else
\if\exbank@opt@partProblems\isTrue
\Trigger\EndPartproblem
+ \tighten@paragraph
\else
\Trigger\EndProblem
\fi
@@ -193,14 +300,28 @@ switches/.cd,
\fi
}{\if\DisplaySolution\isTrue
\Trigger\EndSolution
+\tighten@paragraph@solutions
+\vspace*{0.5em}
\fi
-\Trigger\EndSolutionHard
\endgroup
+\Trigger\EndSolutionHard%
}
\generalcomment{intro}{ \if\@countIntros\isTrue
+ \stepcounter{metacounter}
\Trigger\DecideProblemDisplay
\begingroup
- \showhideproblem{\Trigger\BeginIntro}
+ \if\@displayMetaCounter\isTrue\relax%
+ {\exb@lmargin{{\Large\themetacounter}}{\pMarginLeft}}
+ \fi
+ \if\@spriteMode\isTrue
+ \if\introarg\isTrue
+ \stepcounter{partproblemcounter}
+ \fi
+ \fi
+ \showhideproblem{%
+ \tighten@paragraph%
+ \Trigger\BeginIntro%
+}
\fi
}{ \if\@countIntros\isTrue
\Trigger\EndIntro
@@ -208,25 +329,6 @@ switches/.cd,
\fi
\vspace*{1em}
}
-\gdef\isin#1#2#3#4{ \def\needle{#2}
- \def\haystack{#1}
- \def\isFalse{0}
- \let\isInList = \isFalse
- \IfInteger{\haystack}{ \if\haystack\needle
- #3
- \else
- #4
- \fi
-}{ \foreach\pp in #1{ \if\pp\needle
- \gdef\isInList{1}
- #3
- \fi
-}
- \if\isInList\isFalse
- #4
- \fi
-}
-}
\def\squeeze{ \newlength{\marginw}
\setlength{\marginw}{1.5cm}
\newgeometry{margin=\marginw}
@@ -259,20 +361,16 @@ switches/.cd,
}
\let\ea = \expandafter
\newcounter{metacounter}
-\def\emptyList{-1}
-\begingroup\lccode`\|=`\\
-\lowercase{\endgroup\def\removebs#1{\if#1|\else#1\fi}}
-\newcommand{\macroname}[1]{\expandafter\removebs\string#1}
-\gdef\ifppMode#1{ \def\mname{\macroname{#1}}
- \if\mname\ppMode
+\setcounter{metacounter}{0}
+\gdef\emptyList{0}
+\gdef\ifppMode#1{ \def\mname{\exbank@macroname{#1}}
+ \strif\mname\ppMode
}
-\gdef\isppMode#1#2{ \edef\mname{\macroname{#1}}
- \if{\macroname{#1}}\ppMode#2\fi
+\gdef\isppMode#1#2{ \edef\mname{\exbank@macroname{#1}}
+ \strif{\exbank@macroname{#1}}{\ppMode}\relax#2\fi
}
-\gdef\@noneofone#1{}
-\gdef\@noneOfTwo#1#2{}
\gdef\@ifppMode#1{%
-\ifnum\pdfstrcmp{\macroname{#1}}{\ppMode}=\z@%
+\ifnum\pdfstrcmp{\exbank@macroname{#1}}{\ppMode}=\z@%
\expandafter\@firstofone%
\else%
\expandafter\@noneofone%
@@ -280,17 +378,18 @@ switches/.cd,
}%
\def\pm@Exclude{exclude}
\def\pm@Select{select}
+\def\pm@Normal{normal}
\let\ipm\@ifppMode
\let\T@\isTrue
\let\F@\isFalse
-\At\DecideProblemDisplay{ \if\ppList\emptyList
- \xdef\DisplayProblem{\ipm\exclude\T@\ipm\select\F@}
- \else
- \isin{\ppList}{\themetacounter}{ \xdef\DisplayProblem{\ipm\exclude\F@\ipm\select\T@\ipm\normal\T@}
-}{ \xdef\DisplayProblem{\ipm\exclude\T@\ipm\select\F@\ipm\normal\T@}
+\At\DecideProblemDisplay{%
+ \ifnum\pdfstrcmp{\ppList}{\emptyList}=\z@\relax%
+ \xdef\DisplayProblem{\ipm\exclude\T@\ipm\select\F@}
+ \else
+ \isin{\ppList}{\themetacounter}{ \xdef\DisplayProblem{\ipm\exclude\F@\ipm\select\T@\ipm\normal\T@}
+}{ \xdef\DisplayProblem{\ipm\exclude\T@\ipm\select\F@\ipm\normal\T@}
}
- \fi
- \stepcounter{metacounter}
+ \fi
}
\pgfkeys{ /makeset/.is family, /makeset,
default/.style = {noheadarg=\isFalse, introarg=\isFalse},
@@ -301,69 +400,125 @@ switches/.cd,
}
\gdef\@listOfSets{}
\gdef\@spriteMode{\isFalse}
+\gdef\exbank@spriteSets{\emptyList}
+\long\gdef\spritesets#1{ \gdef\exbank@spriteSets{#1}
+}
+\global\let\exlist@protect\noexpand
\newcommand\makeset[3][]{ \pgfkeys{/makeset, default, #1}%
\if\introarg\isTrue%
+ \gdef\introarg{\isTrue}
\ea\gdef\csname setlist@#2@intro\endcsname{\isTrue}
\fi
\if\noheadarg\isTrue%
\ea\gdef\csname setlist@#2@nohead\endcsname{\isTrue}
\fi
- \ea\gdef\csname setlist@#2\endcsname{#3}
+ \ea\gdef\csname setlist@#2\endcsname{\exlist@protect{#3}}
\def\setmacro{\unexpanded\expandafter{\csname setlist@#2\endcsname}}
- \g@addto@macro\@listOfSets{#2}
+ \g@addto@macro\@listOfSets{,#2}
}
\long\gdef\about#1{}
\newcommand\sprite[1][4]{\squeeze
\gdef\@spriteMode{\isTrue}
\long\def\about##1{{\Large\textbf{About}:\\[1.1em]##1\\[1.5em]}}
\pgfpagesuselayout{#1 on 1}[a4paper,border shrink=5mm]
- \foreach\set in \@listOfSets{ \buildset{\set}
+\ifnum\pdfstrcmp{\exbank@spriteSets}{\emptyList}=\z@\relax%
+ \edef\sprite@setlist{\ea\@secondoftwo\@listOfSets}
+ \readlist*\list@sprite@setlist\sprite@setlist
+ \foreachitem\set\in\list@sprite@setlist{ \edef\theset{{\set}}
+ \if\theset\empty\relax\else%
+ \buildset{\set}%
+ \fi%
+}
+\else
+ \edef\sprite@setlist{\exbank@spriteSets}
+ \readlist*\list@sprite@setlist\sprite@setlist
+ \foreachitem\set\in\list@sprite@setlist{ \edef\theset{{\set}}
+ \if\theset\empty\relax\else%
+ \buildex{\set}%
+ \fi%
}
+\fi
+}
+\gdef\exbank@setEnv@normal#1{\exbank@setEnv{#1}{normal}
}
-\newcommand{\redef}[3][{-1}]{ \if\@spriteMode\isFalse%
+\newcommand{\exbank@setEnv}[3][{-1}]{ \if\@spriteMode\isFalse%
\gdef\ppList{#1}
\gdef\exerciseFile{#2}
\gdef\ppMode{#3}
\else
- \gdef\ppList{}
+ \gdef\ppList{\emptyList}
\gdef\exerciseFile{#2}
- \gdef\ppMode{exclude}
-\fi
+ \gdef\ppMode{\pm@Normal}
+ \fi
}
\newcommand{\exclude}[2]{[{#2}]{#1}{exclude}}
\newcommand{\select}[2]{[{#2}]{#1}{select}}
\gdef\buildex#1{ \makeset{#1}{#1}
\buildset{#1}
}
+\gdef\exbank@def@makeset@command#1#2{%
+ \edef\macroname{\exbank@macroname{#1}}%
+ \xdef#1{?{@\macroname}}%
+ \ea\gdef\csname @\macroname\endcsname{#2}%
+}
+\let\exbank@isFirstProblem\isTrue
+\exbank@def@makeset@command{\phead}{ \if\exbank@isFirstProblem\isTrue%
+ \let\exbank@isFirstProblem\isFalse%
+ \else%
+ \Trigger\EndProblem%
+ \fi%
+ \Trigger\BeginProblem%
+ \Trigger\VeryBeginProblem%
+}
+\exbank@def@makeset@command{\pbreak}{\clearpage}
+\let\DeclareExerciseCommand\exbank@def@makeset@command
+\global\let\ex@protect\noexpand
+\gdef\exec#1{:\ex@protect{#1}}
\gdef\@countIntros{\isFalse}
-\gdef\phead{?\noexpand\Trigger\noexpand\VeryBeginProblem}
\newcommand\buildset[2][]{ \def\oarg{#1}
- \@ifundefined{setlist@#2@intro}{\gdef\@countIntros{\isFalse}}{\gdef\@countIntros{\isTrue}\@latex@warning{Counting intros}}
+ \@ifundefined{setlist@#2@intro}{\gdef\@countIntros{\isFalse}}{\gdef\@countIntros{\isTrue}\@dlog{Counting intros}}
\@ifundefined{setlist@#2@nohead}{\gdef\nohead{\isFalse}}{\gdef\nohead{\isTrue}}
\xdef\setName{#2}
\@ifundefined{setlist@#2}{ \@latex@error{Couldn't find set #2. Did you remember to do \string\makeset{#2}{}?}
\stop\bye
}{}
- \edef\setlist{\csname setlist@#2\endcsname}
+ \let\exlist@protect\unexpanded
+ \edef\exbank@setlist{\csname setlist@#2\endcsname}
+ \let\exlist@protect\noexpand
\if\@spriteMode\isFalse
\Trigger\StartBuildset
\fi
- \foreach\exerciseFileInfo in \setlist{ \def\continueLoop{\isTrue}
- \gdef\ppList{-1}
- \setcounter{metacounter}{1}
- \StrLeft{\exerciseFileInfo}{1}[\firstchar]%
- \if[\firstchar
- \ea\redef\exerciseFileInfo\relax
- \def\continueLoop{\isTrue}
- \else\if?\firstchar
- \expandafter\@secondoftwo\exerciseFileInfo
- \def\continueLoop{\isFalse}
- \else
- \redef{\exerciseFileInfo}{normal}
- \def\continueLoop{\isTrue}
- \fi\fi
- \if\continueLoop\isTrue
+ \gdef\@delegateFileInfo{\@ifnextchar?\@execute@makeset@command\@is@exec}
+ \def\@is@exec{\@ifnextchar:\@execute@exec\@is@file}
+ \gdef\@is@file{\@ifnextchar[\exb@setEnv@withOptargs\X@exb@setEnv}
+ \gdef\X@exb@setEnv##1{%
+ \def\continueLoop{\isTrue}%
+ \@dlog{Processing normal file "\exerciseFileInfo.tex"}%
+ \exbank@setEnv@normal{\exerciseFileInfo}\bgroup\nullfont%
+}
+ \gdef\exb@setEnv@withOptargs{%
+ \def\continueLoop{\isTrue}\ea\exbank@setEnv\exerciseFileInfo\bgroup\nullfont%
+}
+ \gdef\@execute@makeset@command ?##1{%
+ \edef\inner{\@firstofone##1}
+ \@dlog{Executing macro \@backslashchar\@gobble##1}
+ \csname\inner\endcsname
+ #1\def\continueLoop{\isFalse}\ea\bgroup
+}
+ \def\@execute@exec:{%
+ \def\continueLoop{\isFalse}\@dlog{Executing custom command}\bgroup
+}
+ \readlist*\setlist\exbank@setlist
+ \foreachitem\exerciseFileInfo\in\setlist{ \def\continueLoop{\isTrue}
+ \gdef\ppList{\emptyList}
+ \setcounter{metacounter}{0}
+ \let\ex@protect\unexpanded
+ \edef\exerciseFileInfo{\exerciseFileInfo}
+ \ea\@delegateFileInfo\exerciseFileInfo\egroup
\Trigger\InputExercise
+ \if\continueLoop\isTrue
+ \let\ex@protect\noexpand
+ \Trigger\PathControl
\if\nohead\isFalse
\if\@spriteMode\isFalse
\Trigger\BeginProblem
@@ -372,11 +527,14 @@ switches/.cd,
\if\nohead\isFalse\Trigger\VeryBeginProblem\fi
\if\@spriteMode\isTrue\textbf{\exerciseFile.tex\\}\fi
\IfFileExists{\@exercisesDir/\exerciseFile}{ \incl{\@exercisesDir/\exerciseFile}
+ \if\@spriteMode\isTrue
+ \setcounter{partproblemcounter}{0}%
+ \fi
}{ \@latex@error{Could not find \@exercisesDir/\exerciseFile. Maybe it is because the default exercise directory is now changed to the same directory that your main file is in. To set default exercise directory to exercises, do \string\exercisebanksetup{exercise directory=exercises}}{}
\stop\bye
}
\if\nohead\isFalse\Trigger\EndProblem\fi
- \fi
+ \fi%
}
\if\@spriteMode\isFalse
\Trigger\EndBuildset
@@ -385,14 +543,14 @@ switches/.cd,
\newcommand\refcounter[1]{\edef\@currentlabel{#1}%
}
\DeclareRobustCommand{\pplabel}[1]{ \refcounter{\theproblemcounter}\label{pr:\exerciseFile:#1}
- \refcounter{\thepartproblemcounter}\label{pp:\exerciseFile:#1}
+ \refcounter{\alph{partproblemcounter}}\label{pp:\exerciseFile:#1}
}
\let\pptag = \pplabel
\newcommand\pppref[1]{%
-(\ref{pp:\exerciseFile:#1})\relax%
+(\ea\@alph\ref{pp:\exerciseFile:#1})\relax%
}
\newcommand\ppref[1]{%
-\ref{pr:\exerciseFile:#1}\ref{pp:\exerciseFile:#1}\relax%
+(\ref{pr:\exerciseFile:#1}\ref{pp:\exerciseFile:#1})\relax%
}
\newcommand\pref[1]{%
\ref{pr:\exerciseFile:#1}\relax%