Debian Codegraph @

texmf-dist/doc/latex/stex/packages/stex-problem.tex

raw
1 \begin{sfragment}{Introduction}
2 The \pkg{problem} package supplies an infrastructure that allows specify problem.
3 Problems are text fragments that come with auxiliary functions: hints, notes, and
4 solutions. Furthermore, we can specify how long the solution to a given problem is
5 estimated to take and how many points will be awarded for a perfect solution.
6
7 Finally, the \pkg{problem} package facilitates the management of problems in small files,
8 so that problems can be re-used in multiple environment.
9 \end{sfragment}
10
11
12 \begin{sfragment}{Problems and Solutions}
13
14 \begin{function}{solutions,notes,hints,gnotes,pts,min,boxed,test}
15 The \pkg{problem} package takes the options |solutions| (should solutions be output?),
16 |notes| (should the problem notes be presented?), |hints| (do we give the hints?),
17 |gnotes| (do we show grading notes?), |pts| (do we display the points awarded for
18 solving the problem?), |min| (do we display the estimated minutes for problem
19 soling). If theses are specified, then the corresponding auxiliary parts of the problems
20 are output, otherwise, they remain invisible.
21
22 The |boxed| option specifies that problems should be formatted in framed boxes so that
23 they are more visible in the text. Finally, the |test| option signifies that we are in a
24 test situation, so this option does not show the solutions (of course), but leaves space
25 for the students to solve them.
26 \end{function}
27
28 \begin{environment}{problem}
29 The main environment provided by the \pkg{problem}package is (surprise surprise) the
30 |problem| environment. It is used to mark up problems and exercises. The environment
31 takes an optional KeyVal argument with the keys |id| as an identifier that can be
32 reference later, |pts| for the points to be gained from this exercise in homework or
33 quiz situations, |min| for the estimated minutes needed to solve the problem, and
34 finally |title| for an informative title of the problem.
35 \end{environment}
36
37 \stexexample{%
38 \documentclass{article}
39 \usepackage[solutions,hints,pts,min]{problem}
40 \begin{document}
41 \begin{sproblem}[id=elefants,pts=10,min=2,title=Fitting Elefants]
42 How many Elefants can you fit into a Volkswagen beetle?
43 \begin{hint}
44 Think positively, this is simple!
45 \end{hint}
46 \begin{exnote}
47 Justify your answer
48 \end{exnote}
49 \begin{solution}
50 Four, two in the front seats, and two in the back.
51 \begin{gnote}
52 if they do not give the justification deduct 5 pts
53 \end{gnote}
54 \end{solution}
55 \end{sproblem}
56 \end{document}
57 }
58
59 \begin{environment}{solution}
60 The |solution| environment can be to specify a solution to a problem. If the package
61 option |solutions| is set or |\solutionstrue| is set in the text, then the solution will
62 be presented in the output. The |solution| environment takes an optional KeyVal argument
63 with the keys |id| for an identifier that can be reference |for| to specify which
64 problem this is a solution for, and |height| that allows to specify the amount of space
65 to be left in test situations (i.e. if the |test| option is set in the |\usepackage|
66 statement).
67 \end{environment}
68
69 \begin{environment}{hint,exnote,gnote}
70 The |hint| and |exnote| environments can be used in a |problem| environment to give
71 hints and to make notes that elaborate certain aspects of the problem. The |gnote|
72 (grading notes) environment can be used to document situations that may arise in
73 grading.
74 \end{environment}
75
76 \begin{function}{\startsolutions,\stopsolutions}
77 Sometimes we would like to locally override the |solutions| option we have given to the
78 package. To turn on solutions we use the |\startsolutions|, to turn them off,
79 |\stopsolutions|. These two can be used at any point in the documents.
80 \end{function}
81
82 \begin{function}{\ifsolutions}
83 Also, sometimes, we want content (e.g. in an exam with master solutions) conditional on
84 whether solutions are shown. This can be done with the |\ifsolutions| conditional.
85 \end{function}
86 \end{sfragment}
87
88 \begin{sfragment}{Markup for Added-Value Services}
89
90 \begin{sparagraph}
91 The |problem| package is all about specifying the meaning of the various moving parts of
92 practice/exam problems. The motivation for the additional markup is that we can base
93 added-value services from these, for instance auto-grading and immediate feedback.
94
95 The simplest example of this are multiple-choice problems, where the |problem| package
96 allows to annotate answer options with the intended values and possibly feedback that
97 can be delivered to the users in an interactive setting. In this section we will give
98 some infrastructure for these, we expect that this will grow over time.
99 \end{sparagraph}
100
101 \begin{sfragment}{Multiple Choice Blocks}
102 \begin{environment}{mcb}
103 Multiple choice blocks can be formatted using the |mcb| environment, in which single
104 choices are marked up with |\mcc| macro.
105 \end{environment}
106
107 \begin{function}{\mcc}
108 |\mcc[|\meta{keyvals}|]{|\meta{text}|}| takes an optional key/value argument
109 \meta{keyvals} for choice metadata and a required argument \meta{text} for the proposed
110 answer text. The following keys are supported
111 \begin{itemize}
112 \item |T| for true answers, |F| for false ones,
113 \item |Ttext| the verdict for true answers, |Ftext| for false ones, and
114 \item |feedback| for a short feedback text given to the student.
115 \end{itemize}
116 \end{function}
117 What we see when this is formatted to PDF depends on the context. In solutions mode (we
118 start the solutions in the code fragment below) we get
119
120 \stexexample{%
121 \startsolutions
122 \begin{sproblem}[title=Functions,name=functions1]
123 What is the keyword to introduce a function definition in python?
124 \begin{mcb}
125 \mcc[T]{def}
126 \mcc[F,feedback=that is for C and C++]{function}
127 \mcc[F,feedback=that is for Standard ML]{fun}
128 \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
129 \end{mcb}
130 \end{sproblem}
131 }
132
133 In ``exam mode'' where disable solutions (here via |\stopsolutions|)
134 \stexexample{%
135 \stopsolutions
136 \begin{sproblem}[title=Functions,name=functions1]
137 What is the keyword to introduce a function definition in python?
138 \begin{mcb}
139 \mcc[T]{def}
140 \mcc[F,feedback=that is for C and C++]{function}
141 \mcc[F,feedback=that is for Standard ML]{fun}
142 \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
143 \end{mcb}
144 \end{sproblem}
145 }
146 we get the questions without solutions (that is what the students see during the
147 exam/quiz).
148 \end{sfragment}
149
150 \begin{sfragment}{Filling-In Concrete Solutions}
151 The next simplest situation, where we can implement auto-grading is the case where we
152 have fill-in-the-blanks
153
154 \begin{function}{\fillinsol}
155 The |\fillinsol| macro takes a single argument, which contains a concrete solution
156 (i.e. a number, a string, \ldots), which generates a fill-in-box in test mode:
157 \stexexample{%
158 \stopsolutions
159 \begin{sproblem}[id=elefants.fillin,title=Fitting Elefants]
160 How many Elefants can you fit into a Volkswagen beetle? \fillinsol{4}
161 \end{sproblem}}
162 and the actual solution in solutions mode:
163 \end{function}
164 \stexexample{%
165 \begin{sproblem}[id=elefants.fillin,title=Fitting Elefants]
166 How many Elefants can you fit into a Volkswagen beetle? \fillinsol{4}
167 \end{sproblem}}
168 If we do not want to leak information about the solution by the size of the blank we can
169 also give |\fillinsol| an optional argument with a size: |\fillinsol[3cm]{12}| makes a box
170 three cm wide.
171
172 Obviously, the required argument of |\fillinsol| can be used for auto-grading. For
173 concrete data like numbers, this is immediate, for more complex data like strings ``soft
174 comparisons'' might be in order. \footnote{For the moment we only assume a single concrete
175 value as correct. In the future we will almost certainly want to extend the
176 functionality to multiple answer classes that allow different feedback like im
177 MCQ. This still needs a bit of design. Also we want to make the formatting of the
178 answer in solutions/test mode configurable.}
179 \end{sfragment}
180 \end{sfragment}
181
182 \begin{sfragment}{Including Problems}
183 \begin{function}{\includeproblem}
184 The |\includeproblem| macro can be used to include a problem from another file. It takes
185 an optional KeyVal argument and a second argument which is a path to the file containing
186 the problem (the macro assumes that there is only one problem in the include file). The
187 keys |title|, |min|, and |pts| specify the problem title, the estimated minutes for
188 solving the problem and the points to be gained, and their values (if given) overwrite
189 the ones specified in the |problem| environment in the included file.
190 \end{function}
191
192 The sum of the points and estimated minutes (that we specified in the |pts| and |min| keys
193 to the |problem| environment or the |\includeproblem| macro) to the log file and the
194 screen after each run. This is useful in preparing exams, where we want to make sure that
195 the students can indeed solve the problems in an allotted time period.
196
197 The |\min| and |\pts| macros allow to specify (i.e. to print to the margin) the
198 distribution of time and reward to parts of a problem, if the |pts| and |pts| options are
199 set. This allows to give students hints about the estimated time and the points to be
200 awarded.
201 \end{sfragment}
202
203 \begin{sfragment}{Testing and Spacing}
204 The |problem| package is often used by the |hwexam| package, which is used to create
205 homework assignments and exams. Both of these have a ``test mode'' (invoked by the
206 package option |test|), where certain information --master solutions or feedback -- is
207 not shown in the presentation.
208
209 \DescribeMacro{\testspace}|\testspace| takes an argument that expands to a dimension, and
210 leaves vertical space accordingly. Specific instances exist:
211 \DescribeMacro{\testsmallspace}|\testsmallspace|,
212 \DescribeMacro{\testsmallspace}|\testsmallspace|,
213 \DescribeMacro{\testsmallspace}|\testsmallspace| give small (1cm), medium (2cm), and big (3cm)
214 vertical space.
215
216 \DescribeMacro{\testnewpage}|\testnewpage| makes a new page in |test| mode, and
217 \DescribeMacro{\testemptypage}|\testemptypage| generates an empty page with the cautionary
218 message that this page was intentionally left empty.
219 \end{sfragment}
220
221 %%% Local Variables:
222 %%% mode: latex
223 %%% TeX-master: "../stex-manual"
224 %%% End:
225
226 % LocalWords: solutions,notes,hints,gnotes,pts,min,boxed,test gnotes elefants,pts gnote
227 % LocalWords: 2,title exnote hint,exnote,gnote ifsolutions mcb keyvals Ttext Ftext
228 % LocalWords: Functions,name F,feedback Nooooooooo,feedback 2,title includeproblem
229 % LocalWords: elefants.fillin,title