%% exercisebank v0.3.0b137 - 2019/03/18 %% The LaTeX package exercisebank - version v0.3.0 (2019/03/18) build 137 %% Manual/Documentation for exercisebank.sty %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2018 by Andreas Storvik Strauman %% ------------------------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c %% 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.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.txt \documentclass[a4paper]{article} \usepackage[all]{tcolorbox} \usepackage{needspace} \usepackage{tabularx} \usepackage{geometry} \usepackage{listofitems} \makeatletter \def\input@path{{../../docs/}} \lstdefinestyle{mydocumentation}{style=tcbdocumentation, classoffset=0, texcsstyle=*\color{blue}, moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso}, classoffset=1, moretexcs={% core makeset,phead,buildset,select,exclude,Trigger,At,translateExBank,exercisebanksetup,exerciseFile }, texcsstyle=*\color{Definition}\bfseries, classoffset=0,% restore default } \newtcolorbox{marker}[1][]{enhanced, before skip=2mm,after skip=3mm, boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm, colback=yellow!50, colframe=yellow!20!black, sharp corners,rounded corners=southeast,arc is angular,arc=3mm, underlay={% \path[fill=tcbcol@back!80!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2); \path[draw=tcbcol@frame,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2); \path[fill=yellow!50!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=4mm]interior.north west); }, drop fuzzy shadow,#1} \def\l@macro#1#2{#1\hfill\newline} \newcommand\macrotable{\hypersetup{linkcolor=black}\@starttoc{mac}\hypersetup{linkcolor=Definition}} \newcommand\gh[1]{\href{https://github.com/#1}{@#1}} \newcommand\ghURL[1]{\href{https://github.com/#1}{https://github.com/#1}} \providecommand\onethankyou@tmp@content{\relax} \providecommand\onethankyou@content{\relax} \let\dlog\@latex@warning \dlog{OTYC\onethankyou@content:\the\catcode`\@} \gdef\onethankyou#1{\dlog{Reg @oty}\gdef\onethankyou@tmp@content{#1}} \AtEndDocument{\write\@auxout{\string\gdef\string\onethankyou@content{\onethankyou@tmp@content}}} \providecommand\thankyous{\relax} \def\print@thankyous{\readlist*\lst\thankyous\foreachitem\itm\in\lst{\if\itm\relax\else\item[-] \itm\fi}} \providecommand\@thankyous@content{\relax} \AtEndDocument{\write\@auxout{\string\gdef\string\thankyous{\@thankyous@content}}} \gdef\thankyou#1{\g@addto@macro\@thankyous@content{#1,}} \providecommand\testers{} \providecommand\@testers@content{} \AtEndDocument{\write\@auxout{\string\gdef\string\testers{\@testers@content}}} \gdef\tester#1{\g@addto@macro\@testers@content{#1\,}} \gdef\footxt#1{\protected@xdef\@thefnmark{}\@footnotetext{#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}} \definecolor{green(munsell)}{rgb}{0.0, 0.70, 0.47} \def\defnew#1{\tcbdocmarginnote{\bfseries{\color{green(munsell)}New:}#1}} \newcommand{\removebs}[1]{\if#1\@backslashchar\else#1\fi} \begingroup\lccode`\|=`\\ \lowercase{\endgroup\def\removebs#1{\if#1|\else#1\fi}} \newcommand{\macroname}[1]{\expandafter\removebs\string#1} % \def\obeyifnextspace{\ltx@ifnextchar{ }\relax\relax} \def\dac#1{\docAuxCommand{\macroname{#1}}} \let\mdac\dac \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} \let\oldsubsection\subsection \gdef\subsection{\needspace{0.2\paperheight}\oldsubsection} \setlength{\parindent}{0pt} \title{{exercisebank - manual\\ v0.3.0{\\[-0.5em]\footnotesize(build 137)}}} \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 feel up for it, you can always find the latest development version online, and I always need people to test -- it saves me a lot of time! \makeatletter \if\onethankyou@content\relax\else\par% An extra special thanks to \onethankyou@content who really helps out with this package! \fi \if\thankyous\relax\else\par Special thanks to the people who helps me with this package: \makeatletter\begin{itemize}\print@thankyous\end{itemize}\makeatother\fi \if\testers\relax\else\footxt{People who helped test and make this package better (github users): \testers}\fi \tableofcontents \clearpage \section{Motivation} Exercises are saved as separate files containing part problems. These files can be used to make sets, and you can cherry-pick or exclude certain part problems as you see fit. This makes it easier to maintain and keep your exercises flexible as the syllabus changes. \section{Flow/Moderate start} I suspect that working with this package will break you current flow. So let's go throught it. Most likely you would want to put all your exercises in a folder. To set the default folder, use \refCom{exercisebanksetup}. In these examples we use \texttt{exercises/}. \begin{dispListing*}{title=exercises/myexercise.tex} \begin{intro} This introduces our problem \end{intro} \begin{problem} This is a partproblem 1, and will be hidden (just wait, you'll see) \end{problem} \begin{problem} This is a partproblem 2. This will not be hidden, but become part problem a! \end{problem} \end{dispListing*} Let's build all of them first. In the main file, (the one where you include this package): \begin{dispListing*}{title=main.tex} \documentclass{article} \usepackage{exercisebank} \exercisebanksetup{exercise directory=exercises} \makeset{myExerciseSet}{myexercise} \begin{document} \buildset{myExerciseSet} \end{document} \end{dispListing*} This builds the entire set, and adds Problem header and partproblem counters ( (1a) and (1b) ) by default. \subsection{Select} Now, let's build only the second problem. \begin{dispListing*}{title=main.tex} \documentclass{article} \usepackage{exercisebank} \exercisebanksetup{exercise directory=exercises} \makeset{myExerciseSet}{\select{myexercise}{2}} \begin{document} \buildset{myExerciseSet} \end{document} \end{dispListing*} This should only build the intro and the one exercise you \refCom*{select}ed! Now, say you want to hide the intro. Well all you have to do in this case is make the package treat the intro as a problem in regards to what is \refCom*{select}ed. Just add the optional argument \oarg{intro} to \dac{make}. That is switch \begin{dispListing} \makeset{myExerciseSet}{\select{myexercise}{2}} \end{dispListing} with \begin{dispListing} \makeset[intro]{myExerciseSet}{\select{myexercise}{3}} \end{dispListing} Notice that there are 3 `partproblems' now since we have to count the intro! \subsection{Exclude} But what if you have an exercise with 12 partproblems, and you only want to exclude the 7th partproblem? Well, then \dac{Exclude} is here to rescue the day for you. \begin{dispListing} \makeset{myExerciseSet}{\exclude{soManyExercises}{7}} \end{dispListing} Here it's important to note that the [intro] argument would not make the intros disappear. If we wanted to only exclude the intro from our previous example file \texttt{exercises/myexercise.tex} we would do \begin{dispListing} \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: Let's say you have two files with exercises. One located in \texttt{exercises/circuits/RLC.tex} and one in \texttt{exercises/ohm/ohmsGeneralLaw.tex}, and you want to include partproblem 1 through 5 from \texttt{RLC.tex} and all of the exercises from \texttt{ohmsGeneralLaw.tex}. \begin{dispListing} \makeset{myExerciseSet}{\select{circuits/RLC}{1,...,5}, ohmsGeneralLaw} \end{dispListing} This will divide it up with problem headers. So that what is in the \texttt{RLC.tex}-file will be Problem 1, and \texttt{ohmsGeneralLaw.tex} Problem 2. \subsection{Mixnmatch} What if you want to make both of them the same exercise? Well, then you pass the [nohead] argument to \dac{makeset}: \begin{dispListing} \makeset[nohead]{myExerciseSet}{\phead, \select{circuits/RLC}{1,...,5}, ohmsGeneralLaw} \end{dispListing} The \dac{phead} command makes a problem header. You can pass them as much as you want: \begin{dispListing} \makeset[nohead]{myExerciseSet}{\phead, \select{circuits/RLC}{1,...,5}, ohmsGeneralLaw, \phead, someOtherExercise, moreExercises} \end{dispListing} \subsection{Solutions} 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} \end{dispListing} They are hidden by default, so you would have to use \dac{DisplaySolutions} in 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 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} } \end{dispListing} \subsubsection{Printing the file name beneath the problem header} Maybe you want to see what files are what problems. One way to do that is hook into the \dac{At}\dac{VeryBeginProblem} and use \refCom{exerciseFile}.This is the command that the headers call, so anything you put in there will be executed right after the headers. \begin{dispListing} \At\VeryBeginProblem{ \exerciseFile\\ } \end{dispListing} 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 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. \subsection{Points and tags for exercises} By default since version v0.2.1 there are now points and tags available through the \refCom{nextproblem} command.% To assign a points to a part problem you'd do \begin{dispListing} \nextproblem{points=3,tag=difficult} \begin{problem} This problem is worth 3 points and has the `difficult' tag. \end{problem} \end{dispListing} Then to build all exercises that has the `difficult' and e.g. the `easy' tag one would use the \refCom{buildtags} command. \begin{dispListing} \makeset{myExerciseSet}{ohmsGeneralLaw} \buildtags{dificult,easy}{myExerciseSet} \end{dispListing} That covers the basics. Enjoy \begin{marker} \dac{begin}\{problem\},\dac{end}\{problem\},\\ \dac{begin}\{solution\},\dac{end}\{solution\},\\ \dac{begin}\{intro\} and \dac{end}\{intro\} has to be on their own line without any spaces! \end{marker} \section{Reference} \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{docCommand}{SolutionsOnly}{}\addcontentsline{toc}{subsubsection}{\refCom{SolutionsOnly}} \defnew{v0.3.0\\2019/03/18 } Displays only solutions (if there are any) to the part problem \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} \begin{docEnvironment}{solution}{} 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{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} \filbreak\subsection{Making sets} \begin{docCommand}{makesetdefaults}{\marg{nohead|intro}}\addcontentsline{toc}{subsubsection}{\refCom{makesetdefaults}} \defnew{v0.2.1\\2018/09/24 } Sets the default arguments to all makeset-keys. e.g. \begin{dispListing} \makesetdefaults{intro} \end{dispListing} Will effectively make all \begin{dispListing} \makeset{...}{...} \end{dispListing} into \begin{dispListing} \makeset[intro]{...}{...} \end{dispListing} However, you can override this; \begin{dispListing} \makesetdefaults{intro} \makeset[nointro]{...}{...} \end{dispListing} (the \oarg{nointro} overrides the default \meta{intro} setting) \end{docCommand} \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.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 \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}{buildall}{}\addcontentsline{toc}{subsubsection}{\refCom{buildall}} \defnew{v0.3.0\\2019/03/18 } Build all sets defined with \dac{makeset} \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}{exec}{\marg{macros}}\addcontentsline{toc}{subsubsection}{\refCom{exec}} \updated{v0.2.1\\2018/09/24 } 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}{DeclareExerciseCommand}{\marg{command}\oarg{numargs}\marg{actions}}\addcontentsline{toc}{subsubsection}{\refCom{DeclareExerciseCommand}} \updated{v0.2.1\\2018/09/24 } Now, use similar to newcommand. Does not support default arguments yet, but plans to. The old way of defining still works: \begin{dispListing} \DelcareExerciseCommand{\pbreak}\brackets{\clearpage} \end{dispListing} and \begin{dispListing} \DelcareExerciseCommand{\ptitle}[1]\brackets{\Large\textbf{#1}} \end{dispListing} 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}{exclude}{\marg{exerciseFileName}\marg{Comma separated numbers}}\addcontentsline{toc}{subsubsection}{\refCom{exclude}} \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.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}{buildset}{\oarg{intro|nohead|nointro}\marg{setname}}\addcontentsline{toc}{subsubsection}{\refCom{buildset}} \updated{v0.3.0\\2019/03/18 } This command runs the set given. The set has do be defined by \dac{makeset}. E.eg \begin{dispListing} \makeset{myExerciseSet}{exercisefile1, \select{exercisefile2}{1,2}} \!begin{document} \buildset{myExerciseSet} \!end{document} \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}{buildsets}{\oarg{intro|nohead|nointro}\marg{list}}\addcontentsline{toc}{subsubsection}{\refCom{buildsets}} \updated{v0.2.1\\2018/09/24 } This command will generate multiple sets: \begin{dispListing} \buildsets{set,set2,set3} \end{dispListing} \end{docCommand} \begin{docCommand}{buildtags}{\marg{tagslist}\marg{setslist}}\addcontentsline{toc}{subsubsection}{\refCom{buildtags}} \updated{v0.2.2\\2018/10/04 } This command will generate multiple sets: \begin{dispListing} \buildsets{tag,tag2,tag3}{set,set2,set3} \end{dispListing} \end{docCommand} \begin{docCommand}{buildsprite}{\marg{setslist}}\addcontentsline{toc}{subsubsection}{\refCom{buildsprite}} \defnew{v0.3.0\\2019/03/18 } Builds a sprite from the given comma separated list of sets \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.2.0\\2018/07/21 } Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e.g. 1c) \end{docCommand} \begin{docCommand}{ppgref}{\marg{label}}\addcontentsline{toc}{subsubsection}{\refCom{ppgref}} \defnew{v0.3.0\\2019/03/18 } Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This can be used for \emph{global} exercises. \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} \begin{docCommand}{pgref}{\marg{label}}\addcontentsline{toc}{subsubsection}{\refCom{pgref}} \defnew{v0.3.0\\2019/03/18 } Reference a partproblem created by \dac{pplabel}\{\meta{label\}}. This prints e.g. 1, but have global search. \end{docCommand} \begin{docCommand}{HideTags}{\marg{list}}\addcontentsline{toc}{subsubsection}{\refCom{HideTags}} \updated{v0.3.0\\2019/03/18 } Hide all exercises containing the list of tags when building a set. \end{docCommand} \begin{docCommand}{ShowAllTags}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowAllTags}} \defnew{v0.3.0\\2019/03/18 } Reset tags set by \dac{HideTags} \end{docCommand} \begin{docCommand}{exercisenote}{}\addcontentsline{toc}{subsubsection}{\refCom{exercisenote}} \defnew{v0.3.0\\2019/03/18 } Adds a note below an exercise header. To be used in \dac{makeset} \begin{dispListing} \makeset{\exercisenote{This is a pretty hard exercise}, my/hard/exercise} \end{dispListing} Here the text inside \dac{exercisenote} (This is a pretty hard exercise) will show right below the problem header of my/hard/exercise.tex \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}{ShowNumbers}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowNumbers}} \updated{v0.2.1\\2018/09/24 } 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}{ShowTags}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowTags}} \updated{v0.3.0\\2019/03/18 } Shows the tags in front of the part problems much like \dac{ShowNumbers} \end{docCommand} \begin{docCommand}{ShowFilenames}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowFilenames}} \updated{v0.3.0\\2019/03/18 } Shows the path+filename to the current exercise file \end{docCommand} \begin{docCommand}{exercisebanksetup}{\marg{\oarg{key/values}}}\addcontentsline{toc}{subsubsection}{\refCom{exercisebanksetup}} \updated{v0.2.1\\2018/09/24 } 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. If this is turned Off, then the part problems will be treated as problems } \keyDef{tighten paragraphs}{True/False}{True}{ Disabling this will prevent the package from attempting to prevent part problems to scatter across pages } \keyDef{problem header}{macro}{see below}{ This sets the problem header. To access the translation of the problem text, use \dac{@tr}\{Problem\}, and the problem counter is accessed with \dac{theproblemcounter}.\\ Defaults to\\ \brackets{\dac{normalfont}\dac{Large}\dac{bfseries}\dac{@tr}\{Problem\}~\dac{theproblemcounter}}. } \keyDef{problem needs space}{dimension}{0.2\dac{pageheight}}{ How much space has to be left on the page for a problem to start } \keyDef{no needspace}{bool}{false}{ Don't use \dac{needspace} command (only used in \refKey{problem needs space}) } \keyDef{part problem header}{macro}{see below}{ This sets the problem header. To access the current problem, use \dac{theproblemcounter}, and then the current part problem \dac{thepartproblemcounter}. To make it a letter, as per default use \dac{alph}\{partproblemcounter\}\\ Default is:\\ \dac{large}\dac{textbf}\{(\dac{theproblemcounter}\dac{alph}{partproblemcounter\})} } \keyDef{part problem header suffix}{macro}{\meta{empty}}{ This sets the suffix problem header, and defaults to be the number of points the current exercise is worth. Default is \meta{empty} } \keyDef{solution header}{string}{see below}{ \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. } \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} \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}{true|false}{true}{ Whether or not to put problem headers and part problem headers out in the margins. } \keyDef{show lonely part problems}{true|false}{false}{ Whether or not to show part problems if there is only one part problem within the problem. } \end{docCommand} \keyDef{current points style}{style}{see below}{ This is how the points will be shown in the part problem headers. the default code is by \gh{thorstengrote} (see example below) } \begin{dispListing} ~\ifnum\exb@currentPoints=\z@% \ifnum\totalpoints=\z@\else% \phantom{0p}% \fi% \else% \exb@currentPoints p% \fi~\ignorespaces \end{dispListing} \keyDef{disable points}{bool}{false}{ Whether or not to disable the point system. } \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 \item Solution \end{itemize} The Norwegian translation would then be done with \begin{dispListing} \translateExBank{Problem=Oppgave, Solution=Løsning} \end{dispListing} \end{docCommand} \filbreak\subsection{Problem options: points and tagging} \begin{docCommand}{nextproblem}{}\addcontentsline{toc}{subsubsection}{\refCom{nextproblem}} \updated{v0.3.0\\2019/03/18 } Prior to a problem environment in an exercise file you can pass options using the \dac{nextproblem} command. If you e.g. wanted to hide one regardless of what set it is you'd do \begin{dispListing} \nextproblem{hide} \begin{problem} This problem will be hidden because of the \nextproblem command \end{problem} \end{dispListing} you can also tag problems using this: \begin{dispListing} \nextproblem{tag=hard} \begin{problem} This problem is hard \end{problem} \nextproblem{tag=hard} \begin{problem} This problem is also hard \end{problem} \nextproblem{tag=easy} \begin{problem} This problem is easy \end{problem} \end{dispListing} And you could now build, say, only easy problems using \dac{buildtags}\{hard\}\{SETNAME\}, where SETNAME is chosen by a \dac{makeset} command. \end{docCommand} You can also have multiple tags per exercise \begin{dispListing} \nextproblem{tag={tag1,tag2}} \begin{problem} This problem is easy \end{problem} \end{dispListing} \keyDef{head}{text}{}{ Set the part problem header for the next problem. } \keyDef{solution only}{true|false}{}{ hide next problem unless \dac{DisplaySolutions} are on } Here are the \dac{nextproblem} keys: \keyDef{points}{number}{0}{ The number of points the next exercise is worth. you can retrieve the total points using \dac{totalpoints} } \begin{docCommand}{totalpoints}{}\addcontentsline{toc}{subsubsection}{\refCom{totalpoints}} Contains the total number of points for all exercises in the current set \end{docCommand} \begin{docCommand}{exercisepoints}{}\addcontentsline{toc}{subsubsection}{\refCom{exercisepoints}} \defnew{v0.3.0\\2019/03/18 } Contains the total number of points in the current exercise (or "Problem") \end{docCommand} \filbreak\subsection{Triggers} \begin{docCommand}{Trigger}{\marg{Any Macro}}\addcontentsline{toc}{subsubsection}{\refCom{Trigger}} \updated{v0.2.1\\2018/09/24 } See \refCom{At}\\ Available triggers:\\ \dac{Trigger}\dac{PartProblemHeaderSuffix}:\\ Triggers after the part problem header. anything added to this trigger will happen within the header \dac{Trigger}\dac{PostPPHeader}:\\ Triggers right after the part problem header has been printed. It is also triggered after the PP header for SolutionsOnly. \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{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] \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} \begin{docCommand}{exb@ClearHook}{}\addcontentsline{toc}{subsubsection}{\refCom{exb@ClearHook}} Deletes all information from a hook. Note that if preceded by \dac{rigid}, then the ENTIRE hook will be cleared. Note that the necessary hooks might not be registered as rigid. Thus show caution when deleting hooks \end{docCommand} \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}}\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}{exb@isin}{\marg{haystack}\marg{needle}\marg{True}\marg{False}}\addcontentsline{toc}{subsubsection}{\refCom{exb@isin}} \meta{haystack} is a comma separated list of anything\\ \meta{needle} is an integer\\ Executes \meta{True} if \meta{needle} is found in \meta{haystack} else executes \meta{False} \end{docCommand} \begin{docCommand}{exercisebankversion}{}\addcontentsline{toc}{subsubsection}{\refCom{exercisebankversion}} \defnew{v0.3.0\\2019/03/18 } Prints the current version and build to the error log \end{docCommand} \begin{docCommand}{exercisebankbuild}{}\addcontentsline{toc}{subsubsection}{\refCom{exercisebankbuild}} \defnew{v0.3.0\\2019/03/18 } Prints the current build number to the error log \end{docCommand} This package also includes some extra stuff. For example the \dac{At} and \dac{Trigger} \begin{docCommand}{At}{\marg{AnyMacro}} \updated{v0.2.1\\2018/09/24 }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}{@rigid}{}\addcontentsline{toc}{subsubsection}{\refCom{@rigid}} \defnew{v0.3.0\\2019/03/18 } Used to make \dac{At} so that the contents won't be deleted with \dac{ClearHook}. Note that the necessary hooks might not be registered as rigid. Thus show caution when deleting hooks \end{docCommand} \begin{docCommand}{thisfilepath}{}\addcontentsline{toc}{subsubsection}{\refCom{thisfilepath}} Contains the path to the exercisefile relative to the build file. Useful for inputing files in the same directory as an exercisefile. \end{docCommand} \begin{docCommand}{exerciseFile}{}\addcontentsline{toc}{subsubsection}{\refCom{exerciseFile}} This is a `read-only' macro that contains the name of the current exerciseFile \end{docCommand} \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 (horisontally). \end{docCommand} \begin{docCommand}{introOutdent}{}\addcontentsline{toc}{subsubsection}{\refCom{introOutdent}} The offset of margins for intros \end{docCommand} \filbreak\subsection{Macro definitions} \addcontentsline{mac}{macro}{\refCom{@rigid}}{} \addcontentsline{mac}{macro}{\refCom{At}}{} \addcontentsline{mac}{macro}{\refCom{DeclareExerciseCommand}}{} \addcontentsline{mac}{macro}{\refCom{DisplaySolutions}}{} \addcontentsline{mac}{macro}{\refCom{HideTags}}{} \addcontentsline{mac}{macro}{\refCom{ShowAllTags}}{} \addcontentsline{mac}{macro}{\refCom{ShowFilenames}}{} \addcontentsline{mac}{macro}{\refCom{ShowNumbers}}{} \addcontentsline{mac}{macro}{\refCom{ShowTags}}{} \addcontentsline{mac}{macro}{\refCom{SolutionsOnly}}{} \addcontentsline{mac}{macro}{\refCom{Trigger}}{} \addcontentsline{mac}{macro}{\refCom{about}}{} \addcontentsline{mac}{macro}{\refCom{buildall}}{} \addcontentsline{mac}{macro}{\refCom{buildset}}{} \addcontentsline{mac}{macro}{\refCom{buildsets}}{} \addcontentsline{mac}{macro}{\refCom{buildsprite}}{} \addcontentsline{mac}{macro}{\refCom{buildtags}}{} \addcontentsline{mac}{macro}{\refCom{exb@ClearHook}}{} \addcontentsline{mac}{macro}{\refCom{exb@isin}}{} \addcontentsline{mac}{macro}{\refCom{exclude}}{} \addcontentsline{mac}{macro}{\refCom{exec}}{} \addcontentsline{mac}{macro}{\refCom{exerciseFile}}{} \addcontentsline{mac}{macro}{\refCom{exercisebankbuild}}{} \addcontentsline{mac}{macro}{\refCom{exercisebanksetup}}{} \addcontentsline{mac}{macro}{\refCom{exercisebankversion}}{} \addcontentsline{mac}{macro}{\refCom{exercisenote}}{} \addcontentsline{mac}{macro}{\refCom{exercisepoints}}{} \addcontentsline{mac}{macro}{\refCom{introOutdent}}{} \addcontentsline{mac}{macro}{\refCom{makeset}}{} \addcontentsline{mac}{macro}{\refCom{makesetdefaults}}{} \addcontentsline{mac}{macro}{\refCom{nextproblem}}{} \addcontentsline{mac}{macro}{\refCom{ownLineNoSpacesGotIt}}{} \addcontentsline{mac}{macro}{\refCom{pMarginAbove}}{} \addcontentsline{mac}{macro}{\refCom{pMarginBelow}}{} \addcontentsline{mac}{macro}{\refCom{pMarginLeft}}{} \addcontentsline{mac}{macro}{\refCom{pgref}}{} \addcontentsline{mac}{macro}{\refCom{ppMargin}}{} \addcontentsline{mac}{macro}{\refCom{ppMarginAbove}}{} \addcontentsline{mac}{macro}{\refCom{ppMarginBelow}}{} \addcontentsline{mac}{macro}{\refCom{ppgref}}{} \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{thisfilepath}}{} \addcontentsline{mac}{macro}{\refCom{totalpoints}}{} \addcontentsline{mac}{macro}{\refCom{translateExBank}}{} \macrotable % \newgeometry{lmargin=0.7cm} \section{Changelog} %!TEX root = exercisebank-doc.tex \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{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}.} \newversion{v0.2.1 2018/09/24} \change{Added options for individual part problems using the \dac{nextproblem}-command} \change{Added tagging for part problems using using the \dac{nextproblem}-command and \dac{buildtags}-commands.} \change{Fixed problems related to \dac{ShowNumbers} not showing correctly.} \change{Fixed \dac{exec} so that it now can take paragraphs (made it \dac{long})} \change{Added point system} \change{Fixed bug where vertical space would remain when intro environment hidden} \change{\dac\DeclareExerciseCommand~now takes args} \change{Keys sent to \dac\makeset can now be sent to \dac\buildset~and~\dac\buildsets} \change{Introducing \dac\makesetdefaults} \newversion{v0.2.2 2018/10/04} \change{Made trailing commas ignored in all lists (\dac\makeset,\dac\buildset,\dac\select,\dac\exclude, etc.)} \change{Fixed bug where tags wouldn't hide.} \newversion{v0.3.0 2019/03/18} \change{Added possibility of custom part problem header from \dac\nextproblem} \change{Added possibility of showing problem only when \dac\DisplaySolutions active} \change{Corrected use of the length \dac\ppMarginBelow} \change{Fixed bug where \dac\phead and \dac\ShowFilenames crash} \change{Introduced \dac\SolutionsOnly} \change{Fixed bug where part problem header repeats if solution is itemize.} \change{Introduced the \dac\@rigid command for the \dac\At functionality. Also the \dac\ClearHook for deleting a hook} \change{\dac\buildset now gives error if set does not exist.} \change{Made \dac\HideTags cummulative.} \change{Created \dac\ShowAllTags for clearing tags list} \change{Raises error when pdfTeX(or pdfLaTeX) is not used} \change{Allow underscore for files in \dac\makeset} \change{Added \dac\exercisepoints for getting total number of points in an exercise/problem.} \change{added \dac\pgref and \dac\ppgref} \change{Margins now more manageable} \change{Prevent overwriting of \dac\graphicspath} \change{Set (append) to \dac\input@path no matter what.} % \change{Fixed bug where part problem headers showing weird if problem started with envs. like enumerate or a figure.} \change{Added command \dac\buildall to build all sets} \change{Moved tag placement for when \dac\ShowTags active} \change{Adjusted margins.} \change{Activated \dac\ppMarginAbove (it now does something)} \change{Added \dac\exercisebankversion and \dac\exercisebankbuild} \change{Part problem header now showing if only one part problem is displayed} \change{Possibility to toggle whether part problem header showing if only one part problem is displayed \refKey{show lonely part problems}} \change{Fixed TeX capacity exceeded error for long exercises.} \change{Added \dac\thisfilepath for getting path of current exercisefile} \change{Changed default spacing} \change{Added \dac\buildsprite} \chlogtable % Testers and thanks \tester{\gh{thorstengrothe}} \onethankyou{\gh{tristelune1}} % \thankyou{} \end{document}