| 1 |
.. _sdapsclassic: |
| 2 |
|
| 3 |
sdapsclassic class |
| 4 |
================== |
| 5 |
|
| 6 |
This is the main class which currently should be used to create questionnaires. |
| 7 |
It builds on top of the other packages and adds new macros and environments |
| 8 |
which are similar to the ones from the original SDAPS LaTeX class. |
| 9 |
|
| 10 |
Please note that the environments from the sdapslayout package cannot be used |
| 11 |
directly as using these environments will cause conflicting macro definitions. |
| 12 |
Instead one can simply use the aliases provided in this class. |
| 13 |
|
| 14 |
The entire document should be wrapped using the :environ:`questionnaire` environment. |
| 15 |
|
| 16 |
The following macros and environments exist: |
| 17 |
|
| 18 |
* :environ:`questionnaire`: Main environment wrapping everything |
| 19 |
* :environ:`info`: Style definition for information block |
| 20 |
* :macro:`\\addinfo`: Add metadata to the project |
| 21 |
* :macro:`\\sdapsinfo`: Print the standard instructions for filling out |
| 22 |
|
| 23 |
The following question types exists for your use: |
| 24 |
|
| 25 |
* :macro:`\\singlemark`: A single range or mark question |
| 26 |
* :macro:`\\singlemarkother`: A single range or makr question with an alternative answer in case it isn't applicable |
| 27 |
* :macro:`\\textbox`: A large and optionally scalable textbox for freeform content |
| 28 |
* :environ:`choicequestion`: A multiple choice question with a number of answers |
| 29 |
* :environ:`choicegroup`: A list of multiple choice questions layed out in rows (or columns) |
| 30 |
* :environ:`optionquestion`: A single choice question with a number of answers |
| 31 |
* :environ:`optiongroup`: A list of single choice questions layed out in rows (or columns) |
| 32 |
* :environ:`markgroup`: A list of range or mark questions layed out in rows (or columns) |
| 33 |
|
| 34 |
You should only use ``\section{}`` for structuring the document. |
| 35 |
|
| 36 |
Class Options |
| 37 |
------------- |
| 38 |
|
| 39 |
=========================== ========================= |
| 40 |
Argument Description |
| 41 |
=========================== ========================= |
| 42 |
sdaps_style The markings style to use. Either "code128", "qr" (default: code128) |
| 43 |
checkmode The mode for checkbox recognition can be any of: |
| 44 |
* **checkcorrect**: check to mark, fill to correct (unmark) (default) |
| 45 |
* **check**: check or fill to mark |
| 46 |
* **fill**: fill to mark |
| 47 |
disable_recognition Disable all recognition related page markings. This must not be used |
| 48 |
when intending to ues the SDAPS program for optical mark recognition. |
| 49 |
An example use case would be creating a PDF form using the SDAPS |
| 50 |
LaTeX classes. (default: not set) |
| 51 |
twoside_barcode Where to draw barcodes if in twoside/duplex mode: |
| 52 |
* **both**: draw on front and back (default) |
| 53 |
* **front**: only draw on the front of the page |
| 54 |
* **back**: only draw on the back of the page |
| 55 |
globalid A global identifier to be printed on the document (as barcode) |
| 56 |
globalidlabel The label for the barcode (only code128) |
| 57 |
no_print_questionnaire_id Disable printing of questionnaire IDs |
| 58 |
print_questionnaire_id Enable printing of questionnaire IDs |
| 59 |
=========================== ========================= |
| 60 |
|
| 61 |
General macros and environments |
| 62 |
------------------------------- |
| 63 |
|
| 64 |
.. environ:: |
| 65 |
\begin{questionnaire}[kwargs] |
| 66 |
content |
| 67 |
\end{questionnaire} |
| 68 |
|
| 69 |
:kwarg noinfo: Suppress the generation of the standard information text |
| 70 |
|
| 71 |
This is the main environment. You should have exactly one of these |
| 72 |
environments containing the entire document. |
| 73 |
|
| 74 |
.. environ:: |
| 75 |
\begin{info} |
| 76 |
content |
| 77 |
\end{info} |
| 78 |
|
| 79 |
A simple environment which places a line on top and below the content. |
| 80 |
|
| 81 |
.. macro:: \addinfo{key}{value} |
| 82 |
|
| 83 |
Attach further metadata to the SDAPS project. This may be used for any |
| 84 |
purpose and the information will also appear on the cover page when |
| 85 |
generating a report using the main SDAPS program. |
| 86 |
|
| 87 |
.. macro:: \sdapsinfo |
| 88 |
|
| 89 |
Print the instruction text that is printed at the top of the page |
| 90 |
unless the `noinfo` keyword argument is given to :environ:`questionnaire`. |
| 91 |
|
| 92 |
Place into a :environ:`info` block to get the same visual appearance as the |
| 93 |
default information text. |
| 94 |
|
| 95 |
.. macro:: \sdapspagemark |
| 96 |
|
| 97 |
This macro must be executed once for every page. By default it is placed |
| 98 |
into the center footer and as such should not be executed unless the footer |
| 99 |
is modified. |
| 100 |
|
| 101 |
While this command is provided, use it at your own risk. No guarantees are |
| 102 |
made on how the class uses this macro internally. If you use it, you need |
| 103 |
to verify the behaviour whenever the class is updated and ensure that |
| 104 |
everything is functioning appropriately. In particular, this macro must not |
| 105 |
be executed twice per page. |
| 106 |
|
| 107 |
Question related macros |
| 108 |
----------------------- |
| 109 |
|
| 110 |
.. macro:: \checkbox* |
| 111 |
|
| 112 |
:arg *: If given, a single choice checkbox is shown instead of a multi choice. |
| 113 |
|
| 114 |
Shows an unchecked checkbox for demonstration purposes. |
| 115 |
|
| 116 |
.. macro:: \checkedbox* |
| 117 |
|
| 118 |
:arg *: If given, a single choice checkbox is shown instead of a multi choice. |
| 119 |
|
| 120 |
Shows a checked checkbox for demonstration purposes. |
| 121 |
|
| 122 |
.. macro:: \filledbox* |
| 123 |
|
| 124 |
:arg *: If given, a single choice checkbox is shown instead of a multi choice. |
| 125 |
|
| 126 |
Shows a filled checkbox for demonstration purposes. |
| 127 |
|
| 128 |
.. macro:: \correctedbox* |
| 129 |
|
| 130 |
:arg *: If given, a single choice checkbox is shown instead of a multi choice. |
| 131 |
|
| 132 |
Shows a filled and checked checkbox for demonstration purposes. |
| 133 |
|
| 134 |
.. macro:: \singlemark[kwargs]{question}{lower}{upper} |
| 135 |
|
| 136 |
A simple "mark" question, i.e. a range. The command does not currently allow adding |
| 137 |
an alternate answer in a way similar to the markgroup or rangearray environments. |
| 138 |
|
| 139 |
:arg question: The question text |
| 140 |
:arg lower: The text for the lower label |
| 141 |
:arg upper: The text for the upper label |
| 142 |
|
| 143 |
:kwarg var: The variable for the question (to be appended to context). |
| 144 |
:kwarg count: The number of checkboxes (default: ``markcheckboxcount``). |
| 145 |
|
| 146 |
.. sdaps:: Simplest form of a range question |
| 147 |
:sdapsclassic: |
| 148 |
|
| 149 |
\singlemark{A range question}{lower}{upper} |
| 150 |
\singlemark[count=6]{A range question with 6 answers}{lower}{upper} |
| 151 |
\setcounter{markcheckboxcount}{7} |
| 152 |
\singlemark{A range question with 7 answers}{lower}{upper} |
| 153 |
|
| 154 |
.. macro:: \singlemarkother[kwargs]{question}{lower}{upper}{other} |
| 155 |
|
| 156 |
Similar to :macro:`\\singlemark` but also takes an alternative answer. |
| 157 |
|
| 158 |
:arg question: The question text |
| 159 |
:arg lower: The text for the lower label |
| 160 |
:arg upper: The text for the upper label |
| 161 |
:arg other: The text for the other label |
| 162 |
|
| 163 |
:kwarg var: The variable for the question (to be appended to context). |
| 164 |
:kwarg count: The number of checkboxes (default: ``markcheckboxcount``). |
| 165 |
|
| 166 |
.. sdaps:: A range question with an alternative answer |
| 167 |
:sdapsclassic: |
| 168 |
|
| 169 |
\singlemarkother{A range question}{lower}{upper}{other} |
| 170 |
\singlemarkother[count=6]{A range question with 6 answers}{lower}{upper}{other} |
| 171 |
\setcounter{markcheckboxcount}{7} |
| 172 |
\singlemarkother{A range question with 7 answers}{lower}{upper}{other} |
| 173 |
|
| 174 |
|
| 175 |
.. macro:: \textbox*[kwargs]{height}{question} |
| 176 |
|
| 177 |
:arg *: If given, the textbox is scalable in height |
| 178 |
:arg height: The height of the text including a unit. If the `*` parameter is given, then this is the minimal height only |
| 179 |
:arg question: The question text, may not contain fragile content |
| 180 |
|
| 181 |
:kwarg text: The question text for the metadata. Fragile content is currently *not* supported. |
| 182 |
:kwarg var: The variable name for this textbox (to be appended to context) |
| 183 |
|
| 184 |
.. todo:: :macro:`\\textbox` should be able to handle an optional keyword |
| 185 |
argument and then allow the question text to include fragile content. |
| 186 |
|
| 187 |
.. sdaps:: A textbox |
| 188 |
:sdapsclassic: |
| 189 |
|
| 190 |
\textbox*{2cm}{A textbox which is 2cm high, not scaling up to the page size} |
| 191 |
\textbox{2cm}{A textbox which is at least 2cm high and can scale up to the page size} |
| 192 |
\textbox{10cm}{A textbox which is at least 10cm high sharing the rest of the page with the previous one} |
| 193 |
|
| 194 |
Note that the SDAPS class supports rather fancy textbox handling including textboxes around |
| 195 |
other content! |
| 196 |
|
| 197 |
.. warning:: The following examples are missing code for proper use! They mostly exist to show off the features but are not quite ready for easy consumption. |
| 198 |
|
| 199 |
.. sdaps:: Fancy textboxes, for real use additional metadata writing is required! |
| 200 |
:sdapsclassic: |
| 201 |
:metadata: |
| 202 |
|
| 203 |
% Prepare some stuff so that we can access the specialized commands more easily. |
| 204 |
\ExplSyntaxOn |
| 205 |
\let\sdapshbox\sdaps_textbox_hbox:nnn |
| 206 |
\let\sdapshstretch\sdaps_textbox_hstretch:nnnnn |
| 207 |
\let\sdapsvbox\sdaps_textbox_vbox:nnnn |
| 208 |
\ExplSyntaxOff |
| 209 |
|
| 210 |
\sdapshbox {} {3bp} { This hbox } should have the same baseline. And one can see that a hbox on the left edge |
| 211 |
is \sdapshbox{}{3bp}{ nicely aligned } with the edge. And some in a formula: $ f(x) = \frac{1}{c\,\sdapshbox{}{3bp}{box}} \sdapshstretch{}{2mm}{5mm}{40mm}{1} $ |
| 212 |
|
| 213 |
See how even the horizontally stretching box in math mode works fine and fills up to the whole width! |
| 214 |
|
| 215 |
Some complex inline content: |
| 216 |
\sdapsvbox {} {0.6\linewidth} {3bp} { |
| 217 |
\begin{tabularx}{\linewidth}{l|l|X} |
| 218 |
adsf lkasjd lksj flkjsfd & blub & gah \\ |
| 219 |
\hline |
| 220 |
asdf & & \\ |
| 221 |
\end{tabularx} |
| 222 |
|
| 223 |
This is a paragraph with more text. This is a paragraph with more text. This is a paragraph with more text. |
| 224 |
This is a paragraph with more text. This is a paragraph with more text. This is a paragraph with more text. |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
.. macro:: \addinfo{key}{value} |
| 229 |
|
| 230 |
Adds a bit of metadata. This metadata will for example appear on the cover page of the report. |
| 231 |
|
| 232 |
:arg key: The key to set |
| 233 |
:arg value: The value to set the key to |
| 234 |
|
| 235 |
.. sdaps:: An example showing the generated metadata |
| 236 |
:sdapsclassic: |
| 237 |
:metadata: |
| 238 |
|
| 239 |
\addinfo{Key 1}{Value 1} |
| 240 |
\addinfo{Key 2}{Value 2} |
| 241 |
\addinfo{Key 3}{Value 3} |
| 242 |
\addinfo{Key 4}{Value 4} |
| 243 |
|
| 244 |
Almost empty document, look at the metadata to see what this is about. |
| 245 |
|
| 246 |
|
| 247 |
Question Environments |
| 248 |
--------------------- |
| 249 |
|
| 250 |
.. environ:: |
| 251 |
\begin{choicequestion}[kwargs]{text} |
| 252 |
content |
| 253 |
\end{choicequestion} |
| 254 |
|
| 255 |
:param text: Text of the choice question. Fragile content is currently *not* supported. |
| 256 |
:kwarg cols: Number of columns |
| 257 |
:kwarg colsep: Spacing added on the left/right of every cell. This defaults to `6pt`. |
| 258 |
:kwarg rowsep: Extra distance between rows. This defaults to `0pt`. |
| 259 |
:kwarg var: Variable name for this question (to be appended to context). |
| 260 |
:kwarg text: Replacement text for metadata |
| 261 |
:kwarg type: the question type "multichoice" or "singlechoice" |
| 262 |
:kwarg multichoice: switch to multichoice "Choice" question mode |
| 263 |
:kwarg singlechoice: switch to singlechoice "Option" question mode |
| 264 |
|
| 265 |
The content should only contain :macro:`\\choiceitem`, :macro:`\\choicemulticolitem` and :macro:`\\choiceitemtext`. |
| 266 |
|
| 267 |
.. sdaps:: A choicequestion |
| 268 |
:sdapsclassic: |
| 269 |
|
| 270 |
\begin{choicequestion}[cols=3]{This is a choice question} |
| 271 |
\choiceitem{First choice} |
| 272 |
\choicemulticolitem{2}{Second choice with a lot of text} |
| 273 |
\choiceitemtext{1.2cm}{3}{Other:} |
| 274 |
\end{choicequestion} |
| 275 |
|
| 276 |
.. macro:: \choiceitem[kwargs]{text} |
| 277 |
|
| 278 |
A possible choice in a :environ:`choicequestion`. Will span exactly one column. |
| 279 |
|
| 280 |
:param text: The text for the choice. Fragile content is currently *not* supported. |
| 281 |
:kwarg var: Variable name for this answer for multichoice (to be appended to context). |
| 282 |
:kwarg val: Value for this answer for singlechoice. |
| 283 |
:kwarg text: Replacement text for metadata. |
| 284 |
|
| 285 |
.. macro:: \choicemulticolitem[kwargs]{cols}{text} |
| 286 |
|
| 287 |
A possible choice in a :environ:`choicequestion`. Will span exactly `cols` columns. |
| 288 |
|
| 289 |
:param cols: The number of columns to span. |
| 290 |
:param text: The text for the choice. Fragile content is currently *not* supported. |
| 291 |
:kwarg var: Variable name for this answer for multichoice (to be appended to context). |
| 292 |
:kwarg val: Value for this answer for singlechoice. |
| 293 |
:kwarg text: Replacement text for metadata. |
| 294 |
|
| 295 |
.. macro:: \choiceitemtext[kwargs]{height}{cols}{text} |
| 296 |
|
| 297 |
A possible freeform choice in a :environ:`choicequestion`. The text field |
| 298 |
will be of height `height` and it will span exactly `cols` columns. |
| 299 |
|
| 300 |
The text item can currently only be used in multichoice environments. |
| 301 |
|
| 302 |
:param cols: The number of columns to span. |
| 303 |
:param text: The text for the choice. Fragile content is currently *not* supported. |
| 304 |
:kwarg var: Variable name for this question (to be appended to context). |
| 305 |
:kwarg text: Replacement text for metadata. |
| 306 |
|
| 307 |
.. environ:: |
| 308 |
\begin{optionquestion}[kwargs]{text} |
| 309 |
content |
| 310 |
\end{optionquestion} |
| 311 |
|
| 312 |
Alias for :environ:`choicequestion` which simply sets it into ``singlechoice`` mode by default. |
| 313 |
|
| 314 |
.. sdaps:: A choicequestion |
| 315 |
:sdapsclassic: |
| 316 |
|
| 317 |
\begin{optionquestion}[cols=3,singlechoice]{This is a single choice question} |
| 318 |
\choiceitem{First choice} |
| 319 |
\choicemulticolitem{2}{Second choice with a lot of text} |
| 320 |
\end{optionquestion} |
| 321 |
|
| 322 |
.. environ:: |
| 323 |
\begin{info} |
| 324 |
content |
| 325 |
\end{info} |
| 326 |
|
| 327 |
A simple block to typeset important information differently. |
| 328 |
|
| 329 |
.. sdaps:: An info block |
| 330 |
:sdapsclassic: |
| 331 |
|
| 332 |
\begin{info} |
| 333 |
Just a block to write some information in, will have a line above and below. |
| 334 |
\end{info} |
| 335 |
|
| 336 |
|
| 337 |
.. environ:: |
| 338 |
\begin{markgroup}[kwargs]{text} |
| 339 |
content |
| 340 |
\end{markgroup} |
| 341 |
|
| 342 |
:param text: Common question for all subquestions. Fragile content is currently *not* supported |
| 343 |
:param kwags: Same as :environ:`rangearray` |
| 344 |
|
| 345 |
.. sdaps:: A group of range questions (used to be called mark) |
| 346 |
:sdapsclassic: |
| 347 |
|
| 348 |
\begin{markgroup}[align=mygroupalignment]{A set of mark questions} |
| 349 |
\markline{First question}{lower}{upper} |
| 350 |
\markline{Second question}{lower 2}{upper 2} |
| 351 |
\end{markgroup} |
| 352 |
|
| 353 |
\begin{markgroup}[align=mygroupalignment]{Another set of mark questions which is aligned to the first} |
| 354 |
\markline{First question}{a}{c} |
| 355 |
\markline{Second question}{b}{d} |
| 356 |
\end{markgroup} |
| 357 |
|
| 358 |
\begin{markgroup}[other]{Another further set of questions with an alternative answer} |
| 359 |
\markline{First question}{lower}{upper}{other} |
| 360 |
\markline{Second question}{a}{b}{c} |
| 361 |
\end{markgroup} |
| 362 |
|
| 363 |
.. todo:: |
| 364 |
The spacing in the "other" case is not sane, we need a larger default spacing in general. |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
.. environ:: |
| 369 |
\begin{choicegroup}[kwargs]{text} |
| 370 |
content |
| 371 |
\end{choicegroup} |
| 372 |
|
| 373 |
:param text: Common question for all subquestions. Fragile content is currently *not* supported |
| 374 |
:param kwags: Same as :environ:`choicearray` |
| 375 |
|
| 376 |
.. note:: The choicegroup environment is an alias for the :environ:`choicearray` environment. At this |
| 377 |
point the only difference is that the choicegroup environment correctly prints the |
| 378 |
header and that it creates the :macro:`\\groupaddchoice` and :macro:`\\choiceline` aliases. |
| 379 |
|
| 380 |
.. macro:: \choice[kwargs]{text} |
| 381 |
|
| 382 |
A possible choice inside inside the group. |
| 383 |
|
| 384 |
:param text: The choices (header) text. |
| 385 |
:kwarg text: A replacement text for the metadata, if set fragile content is |
| 386 |
permitted inside the `text` argument. |
| 387 |
:kwarg var: Variable name for this answer for multichoice (to be appended to context). |
| 388 |
:kwarg val: Value for this answer for singlechoice. |
| 389 |
|
| 390 |
.. macro:: \groupaddchoice[kwargs]{text} |
| 391 |
|
| 392 |
Alias for :macro:`\\choice` for compatibility. |
| 393 |
|
| 394 |
.. macro:: \question[kwargs]{text} |
| 395 |
|
| 396 |
A single question inside the group. All choices need to be defined earlier using :macro:`\\choice`. |
| 397 |
|
| 398 |
:param text: Question text. |
| 399 |
:kwarg text: A replacement text for the metadata, if set fragile content is |
| 400 |
permitted inside the `text` argument. |
| 401 |
:kwarg var: Variable name for this question (to be appended to context). |
| 402 |
:kwarg range: Specify which chekcboxes to show. Needs ot be given an **in order list** of variables (multichoice) or values (singlechoice) also allowing specifying `...` for any amount of items. |
| 403 |
|
| 404 |
.. macro:: \choiceline[kwargs]{text} |
| 405 |
|
| 406 |
Alias for :macro:`\\question` for compatibility. |
| 407 |
|
| 408 |
.. sdaps:: Example of a choicegroup environment |
| 409 |
:sdapsclassic: |
| 410 |
|
| 411 |
\begin{choicegroup}{A group of questions} |
| 412 |
\choice{Choice 1} |
| 413 |
\choice{Choice 2} |
| 414 |
\question{Question one} |
| 415 |
\question{Question two} |
| 416 |
\end{choicegroup} |
| 417 |
|
| 418 |
\begin{choicegroup}[align=something]{Another question} |
| 419 |
\choice{Some choice 1} |
| 420 |
\choice{Some choice 2} |
| 421 |
\question{Question one} |
| 422 |
\question{Question two} |
| 423 |
\end{choicegroup} |
| 424 |
|
| 425 |
\begin{choicegroup}[align=something]{Another group of questions which is automatically aligned to the previous} |
| 426 |
\groupaddchoice{1} |
| 427 |
\groupaddchoice{2} |
| 428 |
\choiceline{Question one} |
| 429 |
\choiceline{Question two} |
| 430 |
\end{choicegroup} |
| 431 |
|
| 432 |
.. sdaps:: Example of a vertical choicegroup environment also showing the "rotated" header layouter |
| 433 |
:sdapsclassic: |
| 434 |
|
| 435 |
\begin{choicegroup}[layouter=rotated,vertical]{A group of questions} |
| 436 |
\groupaddchoice{Choice 1} |
| 437 |
\groupaddchoice{Choice 2} |
| 438 |
\choiceline{Question one} |
| 439 |
\choiceline{Question two} |
| 440 |
\end{choicegroup} |
| 441 |
|
| 442 |
\begin{choicegroup}[layouter=rotated,angle=45,vertical]{A group of questions with a smaller angle} |
| 443 |
\groupaddchoice{Choice 1} |
| 444 |
\groupaddchoice{Choice 2} |
| 445 |
\choiceline{Question one} |
| 446 |
\choiceline{Question two} |
| 447 |
\end{choicegroup} |
| 448 |
|
| 449 |
.. sdaps:: Example of choice filtering |
| 450 |
:sdapsclassic: |
| 451 |
|
| 452 |
\begin{choicegroup}[colsep=2pt,singlechoice]{Please select a date} |
| 453 |
\groupaddchoice{1} |
| 454 |
\groupaddchoice{2} |
| 455 |
\groupaddchoice{3} |
| 456 |
\groupaddchoice{4} |
| 457 |
\groupaddchoice{5} |
| 458 |
\groupaddchoice{6} |
| 459 |
\groupaddchoice{7} |
| 460 |
\groupaddchoice{8} |
| 461 |
\groupaddchoice{9} |
| 462 |
\groupaddchoice{10} |
| 463 |
\groupaddchoice{11} |
| 464 |
\groupaddchoice{12} |
| 465 |
\groupaddchoice{13} |
| 466 |
\groupaddchoice{14} |
| 467 |
\groupaddchoice{15} |
| 468 |
\groupaddchoice{16} |
| 469 |
\groupaddchoice{17} |
| 470 |
\groupaddchoice{18} |
| 471 |
\groupaddchoice{19} |
| 472 |
\groupaddchoice{20} |
| 473 |
\groupaddchoice{21} |
| 474 |
\groupaddchoice{22} |
| 475 |
\groupaddchoice{23} |
| 476 |
\groupaddchoice{24} |
| 477 |
\groupaddchoice{25} |
| 478 |
\groupaddchoice{26} |
| 479 |
\groupaddchoice{27} |
| 480 |
\groupaddchoice{28} |
| 481 |
\groupaddchoice{29} |
| 482 |
\groupaddchoice{30} |
| 483 |
\groupaddchoice{31} |
| 484 |
% Note that the automatically assigned values match the choices. |
| 485 |
\question{Day} |
| 486 |
\question[range={...,12}]{Month} |
| 487 |
\question[range={2,5,...,9,28,...}]{Range} |
| 488 |
\end{choicegroup} |
| 489 |
|
| 490 |
.. environ:: |
| 491 |
\begin{optiongroup}[kwargs]{text} |
| 492 |
content |
| 493 |
\end{optiongroup} |
| 494 |
|
| 495 |
Alias for :environ:`choicegroup` which simply sets it into ``singlechoice`` mode by default. |
| 496 |
|
| 497 |
.. sdaps:: Example of a choicegroup environment |
| 498 |
:sdapsclassic: |
| 499 |
|
| 500 |
\begin{optiongroup}{A group of questions} |
| 501 |
\choice{Choice 1} |
| 502 |
\choice{Choice 2} |
| 503 |
\question{Question one} |
| 504 |
\question{Question two} |
| 505 |
\end{optiongroup} |
| 506 |
|
| 507 |
\begin{optiongroup}[align=something]{Another question} |
| 508 |
\choice{Some choice 1} |
| 509 |
\choice{Some choice 2} |
| 510 |
\question{Question one} |
| 511 |
\question{Question two} |
| 512 |
\end{optiongroup} |
| 513 |
|
| 514 |
\begin{choicegroup}[align=something,singlechoice]{Another group of questions which is automatically aligned to the previous} |
| 515 |
\groupaddchoice{1} |
| 516 |
\groupaddchoice{2} |
| 517 |
\choiceline{Question one} |
| 518 |
\choiceline{Question two} |
| 519 |
\end{choicegroup} |
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
Complex typesetting and images |
| 524 |
------------------------------ |
| 525 |
|
| 526 |
SDAPS allows replacing the text which is exported for the metadata (i.e. what will show |
| 527 |
up in the report). This can make sense for convenience reasons, if shortened answers |
| 528 |
are sufficient for e.g. the report, but it also allows inserting complicated LaTeX |
| 529 |
expressions into the document without having to fear any issues. |
| 530 |
|
| 531 |
Apart from the advantage of having a better string in the report or similar you |
| 532 |
also get the advantage that more TeX commands can be used in the document. Usually |
| 533 |
environments like `verbatim` or `array` would not work inside an SDAPS environment, |
| 534 |
but they will work if a replacement text is specified. |
| 535 |
|
| 536 |
.. sdaps:: Example of using fragile content together with metadata text replacement |
| 537 |
:sdapsclassic: |
| 538 |
:metadata: |
| 539 |
|
| 540 |
\begin{choicegroup}[layouter=rotated]{A group of questions} |
| 541 |
\groupaddchoice[text=choice 1]{$\left( \begin{array}{cc} a & b \\ c & d \end{array} \right) + \log{\alpha}$} |
| 542 |
\groupaddchoice[text=choice 2]{Choice 2 -- \LaTeX} |
| 543 |
\choiceline[text=question 1]{\verb^Inline verbatim^} |
| 544 |
\choiceline[text=question 2]{ |
| 545 |
\begin{tabularx}{0.5\linewidth}{llX} |
| 546 |
cell 1 & cell 2 & tabularx over half the page width fit used as the question text. This cell is the X column filling the rest of the half page. |
| 547 |
\end{tabularx}% |
| 548 |
} |
| 549 |
\choiceline[text=question 3]{ |
| 550 |
\begin{verbatim}Even such things as verbatim environments work. |
| 551 |
However, verbatim does have some weird spacing issues (which can be partially |
| 552 |
solved by wrapping it into a vbox or similar). |
| 553 |
\end{verbatim} |
| 554 |
} |
| 555 |
\choiceline{Question 4 ends up unmodified in the metadata} |
| 556 |
\end{choicegroup} |
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
Variables |
| 561 |
--------- |
| 562 |
|
| 563 |
.. sdaps:: A choicegroup example using variables. Notice that the boxes in the metadata |
| 564 |
have variables named e.g. "flower_adam_alice". The first group of questions does |
| 565 |
not have a common prefix. The second group of questions has the common "flowerd" prefix. |
| 566 |
:sdapsclassic: |
| 567 |
:metadata: |
| 568 |
|
| 569 |
\begin{choicegroup}{A group of questions} |
| 570 |
\groupaddchoice[var=alice]{Choice "alice"} |
| 571 |
\groupaddchoice[var=eve]{Choice "eve"} |
| 572 |
\groupaddchoice{Unnamed choice} |
| 573 |
\choiceline[var=adam]{Question "adam"} |
| 574 |
\choiceline[var=bob]{Question "bob"} |
| 575 |
\choiceline{Unnamed question} |
| 576 |
\end{choicegroup} |
| 577 |
|
| 578 |
\begin{choicegroup}[var=flower]{A group of questions with variable "flower"} |
| 579 |
\groupaddchoice[var=alice]{Choice "alice"} |
| 580 |
\groupaddchoice[var=eve]{Choice "eve"} |
| 581 |
\groupaddchoice{Unnamed choice} |
| 582 |
\choiceline[var=adam]{Question "adam"} |
| 583 |
\choiceline[var=bob]{Question "bob"} |
| 584 |
\choiceline{Unnamed question} |
| 585 |
\end{choicegroup} |
| 586 |
|
| 587 |
|
| 588 |
.. sdaps:: A markgroup example using variables. The variable is e.g. "car_alice" |
| 589 |
and the boxes have a value assigned to them. Grouping is handled as in the |
| 590 |
previous case, adding the prefix when given. |
| 591 |
:sdapsclassic: |
| 592 |
:metadata: |
| 593 |
|
| 594 |
\begin{markgroup}{A group of questions} |
| 595 |
\markline[var=alice]{Question "alice"}{lower}{upper} |
| 596 |
\markline[var=bob]{Question "bob"}{lower}{upper} |
| 597 |
\markline{Unnamed question}{lower}{upper} |
| 598 |
\end{markgroup} |
| 599 |
|
| 600 |
\begin{markgroup}[var=car]{A group of questions with variable "car"} |
| 601 |
\markline[var=alice]{Question "alice"}{lower}{upper} |
| 602 |
\markline[var=bob]{Question "bob"}{lower}{upper} |
| 603 |
\markline{Unnamed question}{lower}{upper} |
| 604 |
\end{markgroup} |
| 605 |
|
| 606 |
|
| 607 |
|