diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/exercisebank/README.txt | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exercisebank/example.zip | bin | 60477 -> 60293 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf | bin | 216892 -> 223329 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex | 121 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty | 235 |
5 files changed, 241 insertions, 117 deletions
diff --git a/Master/texmf-dist/doc/latex/exercisebank/README.txt b/Master/texmf-dist/doc/latex/exercisebank/README.txt index 0cc36d155bc..1f720685498 100644 --- a/Master/texmf-dist/doc/latex/exercisebank/README.txt +++ b/Master/texmf-dist/doc/latex/exercisebank/README.txt @@ -22,7 +22,7 @@ https://github.com/Strauman/exercisebank/ Licence: -The LaTeX package exercisebank - version v0.1.4 (2018/04/28) - build 74 +The LaTeX package exercisebank - version v0.2.0 (2018/07/21) - build 75 exercisebank.sty: Exercise bank ------------------------------------------------------------------------------------------- Copyright (c) 2018 by Andreas Storvik Strauman diff --git a/Master/texmf-dist/doc/latex/exercisebank/example.zip b/Master/texmf-dist/doc/latex/exercisebank/example.zip Binary files differindex 733003d592c..5bda00d48e2 100644 --- a/Master/texmf-dist/doc/latex/exercisebank/example.zip +++ b/Master/texmf-dist/doc/latex/exercisebank/example.zip diff --git a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf Binary files differindex 4594a33fcd6..cbf2d7c44b6 100644 --- a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf +++ b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.pdf diff --git a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex index 008b94ff30c..8897fb1d927 100644 --- a/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex +++ b/Master/texmf-dist/doc/latex/exercisebank/exercisebank-doc.tex @@ -1,5 +1,5 @@ -%% exercisebank v0.1.4b74 - 2018/04/28 -%% The LaTeX package exercisebank - version v0.1.4 (2018/04/28) build 74 +%% exercisebank v0.2.0b75 - 2018/07/21 +%% The LaTeX package exercisebank - version v0.2.0 (2018/07/21) build 75 %% Manual/Documentation for exercisebank.sty %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2018 by Andreas Storvik Strauman @@ -99,12 +99,12 @@ \setlength{\parindent}{0pt} -\title{{exercisebank - manual\\ v0.1.4{\\[-0.5em]\footnotesize(build 74)}}} +\title{{exercisebank - manual\\ v0.2.0{\\[-0.5em]\footnotesize(build 75)}}} \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 @@ -201,8 +201,11 @@ The \dac{phead} command makes a problem header. You can pass them as much as you \end{dispListing} \subsection{Solutions} -The last thing to cover then is solutions. In your exercise files you just use the solution environment +The last thing to cover then is solutions. In your exercise files you just use the solution environment \emph{below} the \refEnv{problem} environment: \begin{dispListing} +\begin{problem} +Some problem +\end{problem} \begin{solution} Solution goes here \end{solution} @@ -212,7 +215,13 @@ your main file to display them. \subsection{Using \dac{At}} \subsubsection{Making your own front page for a set} -To create your own front page for each set, you'd use\\ \dac{At}\dac{StartBuildset}\brackets{\meta{FrontPageContents}}. Anyhing you send in to \dac{At}\dac{StartBuildset} will be executed before the first problem starts: + +To create your own front page for each set, you could use the \refKey{front page} key: +\begin{dispListing} + \exercisebanksetu{front page={path/to/file.tex}} +\end{dispListing}\\ + +To illustrate how the \dac{At} command works, you could use the following command to execute macros \dac{At}\dac{StartBuildset}\brackets{\meta{FrontPageContents}}. Anything you send in to \dac{At}\dac{StartBuildset} will be executed before the first problem starts: \begin{dispListing} \At\StartBuildset{ \input{myFrontpage} @@ -227,7 +236,7 @@ Maybe you want to see what files are what problems. One way to do that is hook i } \end{dispListing} -Note that the \dac{At}{BeginProblem} is executed \emph{before} the headers. +Note that the \dac{At}\dac{BeginProblem} is executed \emph{before} the headers. \subsection{Dynamic figure path} Exercisebank automatically allows you to \dac{input} and \dac{includegraphics} from @@ -276,7 +285,7 @@ Sometimes you'd want to introcude your exercises and tell a little bit about it. 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 } +\updated{v0.2.0\\2018/07/21 } 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 @@ -296,17 +305,17 @@ exercise, explaining short what the exercise is about. It's only visible when us \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 } +\updated{v0.2.0\\2018/07/21 } 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 } +\updated{v0.2.0\\2018/07/21 } 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 } +\defnew{v0.2.0\\2018/07/21 } 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: @@ -320,7 +329,7 @@ This can be used later in makesets. E.g. \end{dispListing} \end{docCommand} \begin{docCommand}{exec}{\marg{macros}}\addcontentsline{toc}{subsubsection}{\refCom{exec}} -\updated{v0.1.4\\2018/04/28 } +\updated{v0.2.0\\2018/07/21 } 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} @@ -342,12 +351,19 @@ The following example prints "Exercise set number 1" and "Exercise set number 2" \end{document} \end{dispListing} \end{docCommand} +\begin{docCommand}{buildsets}{\marg{list}}\addcontentsline{toc}{subsubsection}{\refCom{buildsets}} +\defnew{v0.2.0\\2018/07/21 } +This command will generate multiple sets: +\begin{dispListing} +\buildsets{set,set2,set3} +\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 } +\updated{v0.2.0\\2018/07/21 } 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}} @@ -358,12 +374,12 @@ Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e. You can do a lot of configurations on this package, and probably even more to come in later versions! \begin{docCommand}{ShowNumbers}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowNumbers}} -\updated{v0.1.4\\2018/04/28 } +\updated{v0.2.0\\2018/07/21 } 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 } +\updated{v0.2.0\\2018/07/21 } 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. @@ -386,7 +402,8 @@ You can do a lot of configurations on this package, and probably \dac{large}\dac{textbf}\{(\dac{theproblemcounter}\dac{alph}{partproblemcounter\})} } \keyDef{solution header}{string}{see below}{ -\dac{large}\{\dac{textbf}{\dac{@tr}{Solution\}:}} +\dac{large}\{\dac{textbf}{\dac{@tr}\brackets{Solution:\}}} +\dac{@tr} is the translation macro } \keyDef{exercise directory}{dir}{./}{ This key is used for setting the default exercise directory. @@ -403,11 +420,27 @@ 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\} +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:}}} +\exercisebanksetup{ + exercise directory=exercises, + part problems=Off, + solution header={\textbf{SOL:}} +} \end{dispListing} +\keyDef{use margins}{True/False}{True}{ + Whether or not to put the part problem labels and the problem headers outside the + normal margins. +} +\keyDef{front page}{file}{}{ +Path to a front page that will be loaded at every \dac{buildset} +Where to load the front page. The commands \refCom{setName} is available. +} +\keyDef{style margins}{yes/no}{yes}{ +Whether or not to put problem headers and part problem headers out in the margins. +} \end{docCommand} \filbreak\subsection{Internationalization} \begin{docCommand}{translateExBank}{\marg{Translation key/vals}}\addcontentsline{toc}{subsubsection}{\refCom{translateExBank}} @@ -472,6 +505,40 @@ This is a `read-only' macro that contains the name of the current exerciseFile \filbreak\subsection{Counters} \docCounter{problemcounter}-counter holds the current problem number and \docCounter{partproblemcounter}-counter holds the current partproblem \emph{number}. +\filbreak\subsection{Lengths and margins} +Note that these are all \emph{\!\dac{textbf}\{lengths\}} +and should be used as e.g. +\begin{dispListing} +\setlength{\pMarginBelow} +\end{dispListing} +\begin{docCommand}{pMarginBelow}{}\addcontentsline{toc}{subsubsection}{\refCom{pMarginBelow}} + +Distance below Problem \# header +\end{docCommand} +\begin{docCommand}{pMarginAbove}{}\addcontentsline{toc}{subsubsection}{\refCom{pMarginAbove}} + +Distance above Problem \# header +\end{docCommand} +\begin{docCommand}{pMarginLeft}{}\addcontentsline{toc}{subsubsection}{\refCom{pMarginLeft}} + + Problem header: distance from the default left margin +\end{docCommand} +\begin{docCommand}{ppMarginBelow}{}\addcontentsline{toc}{subsubsection}{\refCom{ppMarginBelow}} + + Part problem: distance from the end of the part problem to the next item +\end{docCommand} +\begin{docCommand}{ppMarginAbove}{}\addcontentsline{toc}{subsubsection}{\refCom{ppMarginAbove}} + + Part problem: distance above the start of the part problem to the previous item +\end{docCommand} +\begin{docCommand}{ppMargin}{}\addcontentsline{toc}{subsubsection}{\refCom{ppMargin}} + + Part problem: how far away from the text the part problem labels are. +\end{docCommand} +\begin{docCommand}{introMargin}{}\addcontentsline{toc}{subsubsection}{\refCom{introMargin}} + + The offset of margins for intros +\end{docCommand} \filbreak\subsection{Macro definitions} \addcontentsline{mac}{macro}{\refCom{At}}{} @@ -480,13 +547,21 @@ This is a `read-only' macro that contains the name of the current exerciseFile \addcontentsline{mac}{macro}{\refCom{ShowNumbers}}{} \addcontentsline{mac}{macro}{\refCom{Trigger}}{} \addcontentsline{mac}{macro}{\refCom{about}}{} +\addcontentsline{mac}{macro}{\refCom{buildsets}}{} \addcontentsline{mac}{macro}{\refCom{exclude}}{} \addcontentsline{mac}{macro}{\refCom{exec}}{} \addcontentsline{mac}{macro}{\refCom{exerciseFile}}{} \addcontentsline{mac}{macro}{\refCom{exercisebanksetup}}{} +\addcontentsline{mac}{macro}{\refCom{introMargin}}{} \addcontentsline{mac}{macro}{\refCom{isin}}{} \addcontentsline{mac}{macro}{\refCom{makeset}}{} \addcontentsline{mac}{macro}{\refCom{ownLineNoSpacesGotIt}}{} +\addcontentsline{mac}{macro}{\refCom{pMarginAbove}}{} +\addcontentsline{mac}{macro}{\refCom{pMarginBelow}}{} +\addcontentsline{mac}{macro}{\refCom{pMarginLeft}}{} +\addcontentsline{mac}{macro}{\refCom{ppMargin}}{} +\addcontentsline{mac}{macro}{\refCom{ppMarginAbove}}{} +\addcontentsline{mac}{macro}{\refCom{ppMarginBelow}}{} \addcontentsline{mac}{macro}{\refCom{pplabel}}{} \addcontentsline{mac}{macro}{\refCom{ppref}}{} \addcontentsline{mac}{macro}{\refCom{pref}}{} @@ -536,15 +611,21 @@ This is a `read-only' macro that contains the name of the current exerciseFile \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{Fixed bugs related to \refCom*{phead} and the commands used in \refCom{makeset}-lists.} +\newversion{V0.1.4 2018/04/28} % \change{Introduced solutions only: \refCom{SolutionsOnly}} + \change{Updated margins a lot!} + \change{Fixed sneaky space in translation} \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.} +\newversion{v0.2.0 2018/07/21} \change{Fixed bug where \refCom{ppref} did not reference letter in part problem.} + \change{Introducing \refCom{buildsets}-command for building more than one set at a time.} + \change{Ability to add front page with the \refKey{front page} setup-key.} + \change{You can now remove the forced margin setup with \refKey{style margins}.} \chlogtable \end{document} diff --git a/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty b/Master/texmf-dist/tex/latex/exercisebank/exercisebank.sty index 6d32887e413..3ad71d95aff 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.4 (2018/04/28) - build 74 +%% The LaTeX package exercisebank - version v0.2.0 (2018/07/21) - build 75 %% exercisebank.sty: Exercise bank %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2018 by Andreas Storvik Strauman <andreas dot s dot strauman at uit dot no> @@ -13,9 +13,9 @@ %% 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/28 v0.1.4 Creates a setup that gives freedom in making sets and exercises.] +\ProvidesPackage{exercisebank}[2018/07/21 v0.2.0 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!} +\PackageWarningNoLine{exercisebank-v0.2.0}{This package is in the beta 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 @@ -32,6 +32,7 @@ \usepackage{geometry} \usepackage{listofitems} \usepackage{trimspaces} +\usepackage{needspace} \edef\@isTrue{1} \edef\@isFalse{0} \gdef\isin#1#2#3#4{ \def\needle{#2} @@ -86,26 +87,34 @@ \pgfkeys{/exbanksetup/.is family, /exbanksetup, default/.style = { part problems = On, tighten paragraphs = True, - problem header={\normalfont\Large\bfseries\@tr{Problem}~\theproblemcounter}, + problem header={\normalsize\Large\bfseries\@tr{Problem}~\theproblemcounter}, part problem header={\large\textbf{(\theproblemcounter\alph{partproblemcounter})}}, solution header={\large{\textbf{\@tr{Solution}:}}}, exercise directory=., figure root directory=\@exercisesDir, + style margins=On, + problem needs space=0.2\paperheight }, exercise directory/.estore in = \@exercisesDir, % figure root directory/.estore in = \@figrootDir, % +front page/.estore in = \exb@frontpage, +front page=\@isFalse, problem header/.store in = \exbank@opt@problemHeader, part problem header/.store in = \exbank@opt@partProblemHeader, solution header/.store in = \exbank@opt@solutionHeader, +problem needs space/.store in = \exbank@opt@problemneedspace, part problems/.style = {switches/#1/.get = \exbank@opt@partProblems}, tighten paragraphs/.style = {switches/#1/.get = \exbank@opt@tightenparagraphs}, +style margins/.style={switches/#1/.get = \exbank@opt@doMargins}, switches/.cd, On/.initial = \@isTrue, on/.initial = \@isTrue, - T/.initial = \@isTrue + T/.initial = \@isTrue, + True/.initial = \@isTrue, Off/.initial = \@isFalse, off/.initial = \@isFalse, F/.initial = \@isFalse, + False/.initial = \@isFalse, } \newcommand\exercisebanksetup[1]{ \pgfkeys{/exbanksetup, #1}% } @@ -113,11 +122,7 @@ switches/.cd, \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{% @@ -142,8 +147,10 @@ switches/.cd, \newcommand{\translateExBank}[1]{ \pgfkeys{/exbanki18n, default, #1}% } \translateExBank{} -\gdef\@tr#1{\@ifundefined{@tr@#1}{#1}{ \csname @tr@#1\endcsname -} +\gdef\@tr#1{% +\@ifundefined{@tr@#1}{#1}{% + \csname @tr@#1\endcsname% +}% } \let\ea = \expandafter \begingroup\lccode`\|=`\\ @@ -176,61 +183,66 @@ switches/.cd, \@dlog{\fileInputBase} \@ifundefined{input@path}{\gdef\input@path{{\fileInputBase}{\fileInputPath}}}{} } -\newlength{\ppLeading} \newlength{\pMarginBelow} \newlength{\pMarginAbove} \newlength{\pMarginLeft} \newlength{\ppMarginBelow} \newlength{\ppMarginAbove} \newlength{\ppMargin} -\newlength{\ppPullback} -\setlength{\ppLeading}{4em} -\setlength{\pMarginBelow}{1em} -\setlength{\pMarginAbove}{1em} -\setlength{\pMarginLeft}{-1.5em} -\setlength{\ppMarginBelow}{2em} -\setlength{\ppMarginAbove}{2em} -\setlength{\ppMargin}{2em} -\setlength{\ppPullback}{3.5em} +\newlength{\introMargin} +\newlength{\solutionMarginLeft} +\newlength{\solutionMarginAbove} +\edef\defaultLeftMargin{\the\dimexpr1in+\hoffset} +\setlength{\ppMargin}{0.5em} +\setlength{\pMarginLeft}{-\ppMargin-2.5em} +\setlength{\solutionMarginLeft}{\ppMargin} +\setlength{\solutionMarginAbove}{1em} +\setlength{\pMarginBelow}{0em} +\setlength{\pMarginAbove}{\baselineskip} +\setlength{\introMargin}{-1.5em} +\setlength{\ppMarginBelow}{\baselineskip} +\setlength{\ppMarginAbove}{0em} +\setlength\parindent{0pt} +\newbox\ppmarkbox +\newlength\markskip +\setlength\markskip{4\baselineskip} \def\solMargin{\dimexpr\ppMargin\relax} \def\vsSize{1em} \def\vs{\vspace{\vsSize}} \newcounter{problemcounter} \setcounter{problemcounter}{0} \newcounter{partproblemcounter} -\At\VeryBeginProblem{ \stepcounter{problemcounter} - \setcounter{partproblemcounter}{0} - \vspace*{\pMarginAbove} - \begin{addmargin}{\pMarginLeft} - {\exbank@opt@problemHeader} - \end{addmargin} - \vspace*{\pMarginBelow} +\At\VeryBeginProblem{% + \if\exbank@opt@tightenparagraphs\@isTrue\relax% + \needspace{\exbank@opt@problemneedspace}% + \vskip-2\baselineskip\relax% + \fi% + \stepcounter{problemcounter}% + \setcounter{partproblemcounter}{0}% + \vspace*{\pMarginAbove}% + \strut\vadjust{\vbox to 0pt{\if\exbank@opt@doMargins\@isTrue\hskip\pMarginLeft\fi{\exbank@opt@problemHeader}\vss}}\par% + \vspace*{\the\dimexpr\baselineskip+\pMarginBelow}% } -\At\EndProblem{\tighten@paragraph +\At\EndProblem{% +\tighten@paragraph% } \At\VeryBeginPartproblem{% \stepcounter{partproblemcounter}% - \bgroup - \if\@displayMetaCounter\isTrue\relax% - \ex@before\exbank@opt@partProblemHeader{{\Large\themetacounter}:} - \fi - \begin{addmargin}{\ppMargin} - \begin{itemize} - \item[\exbank@opt@partProblemHeader] -} -\At\EndPartproblem{ \end{itemize} - \end{addmargin} - \egroup\tighten@paragraph + \bgroup% + \if\@displayMetaCounter\@isTrue\relax% + \ex@before\exbank@opt@partProblemHeader{{\Large\themetacounter}:}% + \fi% +\if\exbank@opt@doMargins\@isTrue\relax% +\leavevmode\smash{\llap{{\exbank@opt@partProblemHeader}\hskip\ppMargin}}% +\else{\exbank@opt@partProblemHeader}\fi% +\ignorespaces}% +\At\EndPartproblem{% + \egroup% \vspace*{\pMarginBelow}% + \tighten@paragraph\par% } -\At\BeginSolution{ \vspace*{1em} - \begin{addmargin}{\solMargin} - \begin{itemize} - \item[\exbank@opt@solutionHeader] -} -\At\EndSolution{ \end{itemize} - \end{addmargin} -} +\At\BeginSolution{\hfill\break\vspace*{\solutionMarginAbove}{\exbank@opt@solutionHeader}} +\At\EndSolution{} \At\EndProblem{% \if\exbank@opt@tightenparagraphs\@isTrue\relax% \if\@SolutionsOnly\@isFalse% @@ -306,6 +318,13 @@ switches/.cd, \endgroup \Trigger\EndSolutionHard% } +\def\intromargin#1{% +\if\exbank@opt@doMargins\@isTrue% +\gdef\endintromargin{\endlist\endgroup}% +\begingroup\list{}{\leftmargin#1}\item[]% +\else% +\relax\global\let\endintromargin=\relax\fi% +} \generalcomment{intro}{ \if\@countIntros\isTrue \stepcounter{metacounter} \Trigger\DecideProblemDisplay @@ -313,8 +332,8 @@ switches/.cd, \if\@displayMetaCounter\isTrue\relax% {\exb@lmargin{{\Large\themetacounter}}{\pMarginLeft}} \fi - \if\@spriteMode\isTrue - \if\introarg\isTrue + \if\@spriteMode\@isTrue + \if\introarg\@isTrue \stepcounter{partproblemcounter} \fi \fi @@ -322,12 +341,12 @@ switches/.cd, \tighten@paragraph% \Trigger\BeginIntro% } - \fi + \fi% + \intromargin{-1em} }{ \if\@countIntros\isTrue \Trigger\EndIntro \endgroup - \fi - \vspace*{1em} + \fi\par\endintromargin } \def\squeeze{ \newlength{\marginw} \setlength{\marginw}{1.5cm} @@ -404,7 +423,9 @@ switches/.cd, \long\gdef\spritesets#1{ \gdef\exbank@spriteSets{#1} } \global\let\exlist@protect\noexpand -\newcommand\makeset[3][]{ \pgfkeys{/makeset, default, #1}% +\newcommand\makeset[3][]{ \xdef\thissetid{#2} + \ea\xdef\csname setkeys@\thissetid\endcsname{#1} + \pgfkeys{/makeset, default, #1}% \if\introarg\isTrue% \gdef\introarg{\isTrue} \ea\gdef\csname setlist@#2@intro\endcsname{\isTrue} @@ -475,22 +496,32 @@ switches/.cd, \global\let\ex@protect\noexpand \gdef\exec#1{:\ex@protect{#1}} \gdef\@countIntros{\isFalse} -\newcommand\buildset[2][]{ \def\oarg{#1} - \@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}{}?} +\gdef\exb@setpgf#1{% +\edef\keystring{{/makeset,default,#1}}% +\ea\pgfkeys\keystring} +\newcommand\buildset[2][]{% + \def\oarg{#1}% + \@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}% + \ifcsname setkeys@\setName\endcsname% + \xdef\skeys{\csname setkeys@#2\endcsname}% + \exb@setpgf\skeys% + \fi% + \@ifundefined{setlist@#2}{% + \@latex@error{Couldn't find set #2. Did you remember to do \string\makeset{#2}{}?} \stop\bye }{} - \let\exlist@protect\unexpanded - \edef\exbank@setlist{\csname setlist@#2\endcsname} - \let\exlist@protect\noexpand - \if\@spriteMode\isFalse - \Trigger\StartBuildset - \fi - \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} + \let\exlist@protect\unexpanded% + \edef\exbank@setlist{\csname setlist@#2\endcsname}% + \let\exlist@protect\noexpand% + \if\@spriteMode\isFalse% + \if\exb@frontpage\@isFalse\else\input{\exb@frontpage}\fi + \Trigger\StartBuildset% + \fi% + \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"}% @@ -500,45 +531,57 @@ switches/.cd, \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 + \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 + \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 - \fi - \fi - \if\nohead\isFalse\Trigger\VeryBeginProblem\fi - \if\@spriteMode\isTrue\textbf{\exerciseFile.tex\\}\fi - \IfFileExists{\@exercisesDir/\exerciseFile}{ \incl{\@exercisesDir/\exerciseFile} - \if\@spriteMode\isTrue + \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% + \fi% + \fi% + \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 + \if\nohead\isFalse\Trigger\EndProblem\fi% \fi% } - \if\@spriteMode\isFalse - \Trigger\EndBuildset + \if\@spriteMode\isFalse% + \Trigger\EndBuildset% \fi + \setcounter{problemcounter}{0}% + \setcounter{partproblemcounter}{0}% + \clearpage% +} +\newcommand\buildsets[1]{% + \xdef\csvlist{#1}% + \readlist*\items\csvlist% + \foreachitem\set\in\items{% + \buildset{\set}% +} } \newcommand\refcounter[1]{\edef\@currentlabel{#1}% } |