1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
|
%% exercisebank v0.2.2b97 - 2018/10/04
%% The LaTeX package exercisebank - version v0.2.2 (2018/10/04) build 97
%% 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\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\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.2.2{\\[-0.5em]\footnotesize(build 97)}}}
\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!
\if\thankyous\relax\else Special thanks to these contributors: \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{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}{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}{orderedselect}{}\addcontentsline{toc}{subsubsection}{\refCom{orderedselect}}
\defnew{v0.2.1\\2018/09/24 }
\end{docCommand}
\begin{docCommand}{buildset}{\oarg{intro|nohead|nointro}\marg{setname}}\addcontentsline{toc}{subsubsection}{\refCom{buildset}}
\updated{v0.2.1\\2018/09/24 }
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}{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}{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}{HideTags}{\marg{list}}\addcontentsline{toc}{subsubsection}{\refCom{HideTags}}
\defnew{v0.2.1\\2018/09/24 }
Hide all exercises containing the list of tags when building a set.
\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}}
\defnew{v0.2.1\\2018/09/24 }
Shows the tags in front of the part problems much like \dac{ShowNumbers}
\end{docCommand}
\begin{docCommand}{ShowFilenames}{}\addcontentsline{toc}{subsubsection}{\refCom{ShowFilenames}}
\defnew{v0.2.1\\2018/09/24 }
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}{yes/no}{yes}{
Whether or not to put problem headers and part problem headers out in the margins.
}
\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}
\texttt{~\dac{ifnum}\dac{exb@currentPoints}=\dac{z@}\dac{ifnum}\dac{totalpoints}=\dac{z@}\dac{else}\dac{phantom}\{0p\}\dac{fi}\dac{else}\dac{exb@currentPoints} p\dac{fi}~\dac{ignorespaces}}
}
\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 and tagging}
\begin{docCommand}{nextproblem}{}\addcontentsline{toc}{subsubsection}{\refCom{nextproblem}}
\updated{v0.2.2\\2018/10/04 }
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}
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}
}
\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{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}
\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}
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}{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.
\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}}{}
\addcontentsline{mac}{macro}{\refCom{DeclareExerciseCommand}}{}
\addcontentsline{mac}{macro}{\refCom{DisplaySolutions}}{}
\addcontentsline{mac}{macro}{\refCom{HideTags}}{}
\addcontentsline{mac}{macro}{\refCom{ShowFilenames}}{}
\addcontentsline{mac}{macro}{\refCom{ShowNumbers}}{}
\addcontentsline{mac}{macro}{\refCom{ShowTags}}{}
\addcontentsline{mac}{macro}{\refCom{Trigger}}{}
\addcontentsline{mac}{macro}{\refCom{about}}{}
\addcontentsline{mac}{macro}{\refCom{buildset}}{}
\addcontentsline{mac}{macro}{\refCom{buildsets}}{}
\addcontentsline{mac}{macro}{\refCom{buildtags}}{}
\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{exercisebanksetup}}{}
\addcontentsline{mac}{macro}{\refCom{introMargin}}{}
\addcontentsline{mac}{macro}{\refCom{makeset}}{}
\addcontentsline{mac}{macro}{\refCom{makesetdefaults}}{}
\addcontentsline{mac}{macro}{\refCom{nextproblem}}{}
\addcontentsline{mac}{macro}{\refCom{orderedselect}}{}
\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}}{}
\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
\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.}
\chlogtable
% Testers and thanks
\tester{\gh{thorstengrothe}}
\tester{\gh{tristelune1}}
\end{document}
|