Debian Codegraph @

texmf-dist/doc/latex/sdaps/html/customlayout.html

raw
1
2 <!DOCTYPE html>
3
4 <html>
5 <head>
6 <meta charset="utf-8" />
7 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8 <title>Creating custom layouts using base commands &#8212; sdaps-class 0.1 documentation</title>
9 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
10 <link rel="stylesheet" href="_static/classic.css" type="text/css" />
11 <link rel="stylesheet" type="text/css" href="_static/css/sdapstex.css" />
12
13 <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
14 <script src="_static/jquery.js"></script>
15 <script src="_static/underscore.js"></script>
16 <script src="_static/doctools.js"></script>
17
18 <link rel="index" title="Index" href="genindex.html" />
19 <link rel="search" title="Search" href="search.html" />
20 <link rel="next" title="sdapsclassic class" href="sdapsclassic.html" />
21 <link rel="prev" title="Frequently Asked Questions" href="FAQ.html" />
22 </head><body>
23 <div class="related" role="navigation" aria-label="related navigation">
24 <h3>Navigation</h3>
25 <ul>
26 <li class="right" style="margin-right: 10px">
27 <a href="genindex.html" title="General Index"
28 accesskey="I">index</a></li>
29 <li class="right" >
30 <a href="sdapsclassic.html" title="sdapsclassic class"
31 accesskey="N">next</a> |</li>
32 <li class="right" >
33 <a href="FAQ.html" title="Frequently Asked Questions"
34 accesskey="P">previous</a> |</li>
35 <li class="nav-item nav-item-0"><a href="index.html">sdaps-class 0.1 documentation</a> &#187;</li>
36 <li class="nav-item nav-item-this"><a href="">Creating custom layouts using base commands</a></li>
37 </ul>
38 </div>
39
40 <div class="document">
41 <div class="documentwrapper">
42 <div class="bodywrapper">
43 <div class="body" role="main">
44
45 <div class="section" id="creating-custom-layouts-using-base-commands">
46 <h1>Creating custom layouts using base commands<a class="headerlink" href="#creating-custom-layouts-using-base-commands" title="Permalink to this headline">¶</a></h1>
47 <p>Usually the pre-defined layouts that SDAPS provides are sufficent. However,
48 there may be special cases that need more customization. Such customization is
49 possible, but it does require a more in depth understanding of LaTeX and
50 the SDAPS packages.</p>
51 <p>If you do this, please make sure to properly test the output. The easiest way
52 of such testing is to use the <code class="docutils literal notranslate"><span class="pre">annotate</span></code> command that SDAPS provides, as it
53 visualises the view that SDAPS has of the questionnaire. Doing this testing is
54 essential as small errors and even side effects of how LaTeX executes code may
55 render the information about the questionnaire useless!</p>
56 <p>Even seemingly “simple” environments like <code class="docutils literal notranslate"><span class="pre">tabularx</span></code> may not be usable
57 together with SDAPS!</p>
58 <div class="section" id="general-question-structure">
59 <h2>General question structure<a class="headerlink" href="#general-question-structure" title="Permalink to this headline">¶</a></h2>
60 <p>To define a question, you need to define
61 1. the start of the question and its type,
62 2. the possible answers to the question
63 3. the checkboxes and textboxes, and finally
64 4. the end of the question.</p>
65 <p>A very simple example might look like the following.</p>
66 <div class="figure">
67 <div class="tabs">
68 <input type="radio" id="tab-code-3" class="tab-code" name="tab-group-3" ><label for="tab-code-3" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-3" class="tab-rendering" name="tab-group-3" checked><label for="tab-rendering-3" class="label-rendering">Result</label><input type="radio" id="tab-metadata-3" class="tab-metadata" name="tab-group-3"><label for="tab-metadata-3" class="label-metadata">Metadata</label><div class="content-code">
69 <div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
70 <span class="k">\ExplSyntaxOn</span>
71 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
72 <span class="k">\let\mycheckbox\sdaps</span><span class="nb">_</span>checkbox:nn
73 <span class="k">\let\myanswer\sdaps</span><span class="nb">_</span>answer:n
74 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
75 <span class="k">\ExplSyntaxOff</span>
76
77 <span class="k">\myquestionbegin</span><span class="nb">{</span>name<span class="nb">}{</span>Choice<span class="nb">}{</span>Exported question text<span class="nb">}</span>
78 Please check after reading this text: <span class="k">\mycheckbox</span><span class="nb">{}{}</span>
79 <span class="k">\myanswer</span><span class="nb">{</span>check<span class="nb">}</span>
80 <span class="k">\myquestionend</span><span class="nb">{</span>name<span class="nb">}</span>
81 </pre></div>
82 </div><div class="content-rendering">
83 <p><img src="_images/sdaps-d196d21d38b78b632d8ebed2fa3947c43e7f6fbc.svg" alt="% Prepare some stuff so that we can access the specialized commands more easily.
84 \ExplSyntaxOn
85 \let\myquestionbegin\sdaps_qobject_begin:nnn
86 \let\mycheckbox\sdaps_checkbox:nn
87 \let\myanswer\sdaps_answer:n
88 \let\myquestionend\sdaps_qobject_end:n
89 \ExplSyntaxOff
90
91 \myquestionbegin{name}{Choice}{Exported question text}
92 Please check after reading this text: \mycheckbox{}{}
93 \myanswer{check}
94 \myquestionend{name}" /></p>
95 </div><div class="content-metadata">
96 <pre>
97 [1]Author=Author
98 [2]Title=Title
99 [3]SDAPSVersion=1.9.10
100 [4]Duplex=true
101 [5]PrintQuestionnaireId=0
102 [6]PageSize=597.50793pt,845.04694pt
103 [7]Style=qr
104 [8]CheckMode=checkcorrect
105 [9]GlobalID=
106 [10]GlobalIDLabel=
107 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
108 [12]QObject-Choice=1. Exported question text
109 [13]Box[1]=Checkbox,0,209.5491pt,729.69331pt,9.95845pt,9.95845pt,box,1.00374pt,1_1,1
110 [14]Answer[1]=check
111 [15]Variable[1]=1
112 </pre></div></div><p class="caption">Question with one checkbox</p></div><p>Please have a look at the resulting document and the generated metadata. In particular,
113 please note:</p>
114 <ul class="simple">
115 <li><p>The export shows “<code class="docutils literal notranslate"><span class="pre">QObject-Choice</span></code>” this is from the <code class="docutils literal notranslate"><span class="pre">Choice</span></code> specified and denotes the question type</p></li>
116 <li><p>The <code class="docutils literal notranslate"><span class="pre">name</span></code> argument does not show up. It only needs to match the one at the end and primarily serves error detection purposes.</p></li>
117 <li><p>SDAPS will see the question as “Exported question text” with one answer “check”</p></li>
118 <li><p>The checkbox is automatically exported including its coordinates</p></li>
119 </ul>
120 <div class="admonition warning">
121 <p class="admonition-title">Warning</p>
122 <p>Be careful! The below example shows the effect that <code class="docutils literal notranslate"><span class="pre">tabularx</span></code> has. This environment
123 expands its content multiple times, and the result is that the automatic numbering
124 breaks; making this the 3rd question rather than the first! Other subtle errors like
125 this can occur with certain environments, so make sure to double check everything is OK!</p>
126 <div class="figure">
127 <div class="tabs">
128 <input type="radio" id="tab-code-4" class="tab-code" name="tab-group-4" ><label for="tab-code-4" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-4" class="tab-rendering" name="tab-group-4" checked><label for="tab-rendering-4" class="label-rendering">Result</label><input type="radio" id="tab-metadata-4" class="tab-metadata" name="tab-group-4"><label for="tab-metadata-4" class="label-metadata">Metadata</label><div class="content-code">
129 <div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
130 <span class="k">\ExplSyntaxOn</span>
131 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
132 <span class="k">\let\mycheckbox\sdaps</span><span class="nb">_</span>checkbox:nn
133 <span class="k">\let\myanswer\sdaps</span><span class="nb">_</span>answer:n
134 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
135 <span class="k">\ExplSyntaxOff</span>
136
137 <span class="k">\begin</span><span class="nb">{</span>tabularx<span class="nb">}{</span><span class="k">\textwidth</span><span class="nb">}{</span>|X|<span class="nb">}</span>
138 <span class="k">\myquestionbegin</span><span class="nb">{</span>name<span class="nb">}{</span>Choice<span class="nb">}{</span>The tabularx environment breaks everything ...<span class="nb">}</span>
139 Please check after reading this text: <span class="k">\mycheckbox</span><span class="nb">{}{}</span>
140 <span class="k">\myanswer</span><span class="nb">{</span>check<span class="nb">}</span>
141 <span class="k">\myquestionend</span><span class="nb">{</span>name<span class="nb">}</span>
142 <span class="k">\end</span><span class="nb">{</span>tabularx<span class="nb">}</span>
143 </pre></div>
144 Required code in preamble:<div class="highlight"><pre><span></span><span class="k">\usepackage</span><span class="nb">{</span>tabularx<span class="nb">}</span>
145 </pre></div>
146 </div><div class="content-rendering">
147 <p><img src="_images/sdaps-57001c6bc38f0fa621278b10dceb4618c957f915.svg" alt="% Prepare some stuff so that we can access the specialized commands more easily.
148 \ExplSyntaxOn
149 \let\myquestionbegin\sdaps_qobject_begin:nnn
150 \let\mycheckbox\sdaps_checkbox:nn
151 \let\myanswer\sdaps_answer:n
152 \let\myquestionend\sdaps_qobject_end:n
153 \ExplSyntaxOff
154
155 \begin{tabularx}{\textwidth}{|X|}
156 \myquestionbegin{name}{Choice}{The tabularx environment breaks everything ...}
157 Please check after reading this text: \mycheckbox{}{}
158 \myanswer{check}
159 \myquestionend{name}
160 \end{tabularx}" /></p>
161 </div><div class="content-metadata">
162 <pre>
163 [1]Author=Author
164 [2]Title=Title
165 [3]SDAPSVersion=1.9.10
166 [4]Duplex=true
167 [5]PrintQuestionnaireId=0
168 [6]PageSize=597.50793pt,845.04694pt
169 [7]Style=qr
170 [8]CheckMode=checkcorrect
171 [9]GlobalID=
172 [10]GlobalIDLabel=
173 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
174 [20]QObject-Choice=3. The tabularx environment breaks everything ...
175 [21]Box[3]=Checkbox,0,215.9491pt,719.40335pt,9.95845pt,9.95845pt,box,1.00374pt,3_1,1
176 [22]Answer[3]=check
177 [23]Variable[3]=3
178 </pre></div></div><p class="caption">Question inside tabularx</p></div></div>
179 </div>
180 </div>
181 <div class="section" id="the-different-question-types">
182 <h1>The different question types<a class="headerlink" href="#the-different-question-types" title="Permalink to this headline">¶</a></h1>
183 <div class="section" id="headings">
184 <h2>Headings<a class="headerlink" href="#headings" title="Permalink to this headline">¶</a></h2>
185 <p>This is the easiest case, and it can be used for structuring the document.</p>
186 <p>For example, the <code class="docutils literal notranslate"><span class="pre">\section</span></code> command simply calls
187 <code class="docutils literal notranslate"><span class="pre">\sdaps_qobject_begin:nnn</span> <span class="pre">{</span> <span class="pre">section</span> <span class="pre">}{</span> <span class="pre">Head</span> <span class="pre">}{</span> <span class="pre">#1</span> <span class="pre">}</span></code>
188 and <code class="docutils literal notranslate"><span class="pre">\sdaps_qobject_end:n</span> <span class="pre">{</span> <span class="pre">section</span> <span class="pre">}</span></code> for you. Something similar happens for
189 the <code class="docutils literal notranslate"><span class="pre">choicegroup</span></code> and other grouping environments where a heading is defined
190 for all questions.</p>
191 <div class="figure">
192 <div class="tabs">
193 <input type="radio" id="tab-code-5" class="tab-code" name="tab-group-5" ><label for="tab-code-5" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-5" class="tab-rendering" name="tab-group-5" checked><label for="tab-rendering-5" class="label-rendering">Result</label><input type="radio" id="tab-metadata-5" class="tab-metadata" name="tab-group-5"><label for="tab-metadata-5" class="label-metadata">Metadata</label><div class="content-code">
194 <div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
195 <span class="k">\ExplSyntaxOn</span>
196 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
197 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
198 <span class="k">\ExplSyntaxOff</span>
199
200 <span class="k">\myquestionbegin</span><span class="nb">{</span>heading<span class="nb">}{</span>Head<span class="nb">}{</span>Heading<span class="nb">}</span>
201 Something inside the section.
202 <span class="k">\myquestionend</span><span class="nb">{</span>heading<span class="nb">}</span>
203 </pre></div>
204 </div><div class="content-rendering">
205 <p><img src="_images/sdaps-4b5478f94507ac6c56e58574248ecab3aa49c6eb.svg" alt="% Prepare some stuff so that we can access the specialized commands more easily.
206 \ExplSyntaxOn
207 \let\myquestionbegin\sdaps_qobject_begin:nnn
208 \let\myquestionend\sdaps_qobject_end:n
209 \ExplSyntaxOff
210
211 \myquestionbegin{heading}{Head}{Heading}
212 Something inside the section.
213 \myquestionend{heading}" /></p>
214 </div><div class="content-metadata">
215 <pre>
216 [1]Author=Author
217 [2]Title=Title
218 [3]SDAPSVersion=1.9.10
219 [4]Duplex=true
220 [5]PrintQuestionnaireId=0
221 [6]PageSize=597.50793pt,845.04694pt
222 [7]Style=qr
223 [8]CheckMode=checkcorrect
224 [9]GlobalID=
225 [10]GlobalIDLabel=
226 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
227 [12]QObject-Head=1. Heading
228 [13]Variable[1]=1
229 </pre></div></div><p class="caption">Grouping questions</p></div></div>
230 <div class="section" id="multiple-choice">
231 <h2>Multiple choice<a class="headerlink" href="#multiple-choice" title="Permalink to this headline">¶</a></h2>
232 <p>The simple multiple choice question is of type <code class="docutils literal notranslate"><span class="pre">Choice</span></code>. We already saw the
233 first example earlier. Simply add more checkboxes and answers as needed. SDAPS
234 will match each checkbox to one answer in the order that it finds the defintions.</p>
235 <div class="figure">
236 <div class="tabs">
237 <input type="radio" id="tab-code-6" class="tab-code" name="tab-group-6" ><label for="tab-code-6" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-6" class="tab-rendering" name="tab-group-6" checked><label for="tab-rendering-6" class="label-rendering">Result</label><input type="radio" id="tab-metadata-6" class="tab-metadata" name="tab-group-6"><label for="tab-metadata-6" class="label-metadata">Metadata</label><div class="content-code">
238 <div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
239 <span class="k">\ExplSyntaxOn</span>
240 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
241 <span class="k">\let\mycheckbox\sdaps</span><span class="nb">_</span>checkbox:nn
242 <span class="k">\let\myanswer\sdaps</span><span class="nb">_</span>answer:n
243 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
244 <span class="k">\ExplSyntaxOff</span>
245
246 <span class="k">\myquestionbegin</span><span class="nb">{</span>name<span class="nb">}{</span>Choice<span class="nb">}{</span>Attended events<span class="nb">}</span>
247 Which of the following events did you attend?
248 <span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
249 <span class="k">\item</span><span class="na">[\mycheckbox{}{}]</span> <span class="k">\myanswer</span><span class="nb">{</span>Keynote<span class="nb">}</span> The Keynote
250 <span class="k">\item</span><span class="na">[\mycheckbox{}{}]</span> <span class="k">\myanswer</span><span class="nb">{</span>Workshop<span class="nb">}</span> A workshop
251 <span class="k">\item</span><span class="na">[\mycheckbox{}{}]</span> <span class="k">\myanswer</span><span class="nb">{</span>Party<span class="nb">}</span> Our glorious party
252 <span class="k">\item</span> Something else entirely <span class="k">\myanswer</span><span class="nb">{</span>other<span class="nb">}</span>
253 <span class="k">\ExplSyntaxOn</span>
254 <span class="k">\sdaps</span><span class="nb">_</span>textbox<span class="nb">_</span>hstretch:nnnnn<span class="nb">{}{</span>2mm<span class="nb">}{</span>5mm<span class="nb">}{</span>40mm<span class="nb">}{</span>1<span class="nb">}</span>
255 <span class="k">\ExplSyntaxOff</span>
256 <span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
257 <span class="k">\myquestionend</span><span class="nb">{</span>name<span class="nb">}</span>
258 </pre></div>
259 </div><div class="content-rendering">
260 <p><img src="_images/sdaps-15a7c595951dc9c4d6cfe9d89f7174d3ae95bf57.svg" alt="% Prepare some stuff so that we can access the specialized commands more easily.
261 \ExplSyntaxOn
262 \let\myquestionbegin\sdaps_qobject_begin:nnn
263 \let\mycheckbox\sdaps_checkbox:nn
264 \let\myanswer\sdaps_answer:n
265 \let\myquestionend\sdaps_qobject_end:n
266 \ExplSyntaxOff
267
268 \myquestionbegin{name}{Choice}{Attended events}
269 Which of the following events did you attend?
270 \begin{itemize}
271 \item[\mycheckbox{}{}] \myanswer{Keynote} The Keynote
272 \item[\mycheckbox{}{}] \myanswer{Workshop} A workshop
273 \item[\mycheckbox{}{}] \myanswer{Party} Our glorious party
274 \item Something else entirely \myanswer{other}
275 \ExplSyntaxOn
276 \sdaps_textbox_hstretch:nnnnn{}{2mm}{5mm}{40mm}{1}
277 \ExplSyntaxOff
278 \end{itemize}
279 \myquestionend{name}" /></p>
280 </div><div class="content-metadata">
281 <pre>
282 [1]Author=Author
283 [2]Title=Title
284 [3]SDAPSVersion=1.9.10
285 [4]Duplex=true
286 [5]PrintQuestionnaireId=0
287 [6]PageSize=597.50793pt,845.04694pt
288 [7]Style=qr
289 [8]CheckMode=checkcorrect
290 [9]GlobalID=
291 [10]GlobalIDLabel=
292 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
293 [12]QObject-Choice=1. Attended events
294 [14]Answer[1]=Keynote
295 [13]Box[1]=Checkbox,0,46.08492pt,712.58836pt,9.95845pt,9.95845pt,box,1.00374pt,1_1,1
296 [16]Answer[1]=Workshop
297 [15]Box[1]=Checkbox,0,46.08492pt,694.27495pt,9.95845pt,9.95845pt,box,1.00374pt,1_2,2
298 [18]Answer[1]=Party
299 [17]Box[1]=Checkbox,0,46.08492pt,675.96153pt,9.95845pt,9.95845pt,box,1.00374pt,1_3,3
300 [19]Answer[1]=other
301 [20]Box[1]=Textbox,0,178.93889pt,659.36952pt,384.42575pt,19.9169pt,1.00374pt,1_4,
302 [21]Variable[1]=1
303 </pre></div></div><p class="caption">Multiple choice question using itemize</p></div><p>Note that we placed a textbox rather than a checkbox as one of the possible
304 answers.</p>
305 </div>
306 <div class="section" id="single-choice">
307 <h2>Single choice<a class="headerlink" href="#single-choice" title="Permalink to this headline">¶</a></h2>
308 <p>We can also define a single choice question. For this, we need to make two
309 small adjustments. The first is to use the <code class="docutils literal notranslate"><span class="pre">Option</span></code> question type. The second
310 is to tell SDAPS that we would like to use the <code class="docutils literal notranslate"><span class="pre">singlechoice</span></code> style for
311 checkboxes.</p>
312 <p>The checkbox style change will be in effect for the scope of the question.</p>
313 <div class="figure">
314 <div class="tabs">
315 <input type="radio" id="tab-code-7" class="tab-code" name="tab-group-7" ><label for="tab-code-7" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-7" class="tab-rendering" name="tab-group-7" checked><label for="tab-rendering-7" class="label-rendering">Result</label><input type="radio" id="tab-metadata-7" class="tab-metadata" name="tab-group-7"><label for="tab-metadata-7" class="label-metadata">Metadata</label><div class="content-code">
316 <div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
317 <span class="k">\ExplSyntaxOn</span>
318 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
319 <span class="k">\let\mycheckbox\sdaps</span><span class="nb">_</span>checkbox:nn
320 <span class="k">\let\myanswer\sdaps</span><span class="nb">_</span>answer:n
321 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
322 <span class="k">\let\mysetcheckboxtype\sdaps</span><span class="nb">_</span>checkbox<span class="nb">_</span>set<span class="nb">_</span>type:n
323 <span class="k">\ExplSyntaxOff</span>
324
325 <span class="k">\myquestionbegin</span><span class="nb">{</span>name<span class="nb">}{</span>Option<span class="nb">}{</span>Attended events<span class="nb">}</span>
326 <span class="k">\mysetcheckboxtype</span><span class="nb">{</span>singlechoice<span class="nb">}</span>
327 Which one of the following events did you attend?
328 <span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
329 <span class="k">\item</span><span class="na">[\mycheckbox{}{}]</span> <span class="k">\myanswer</span><span class="nb">{</span>Talk room A<span class="nb">}</span> Talk in room A
330 <span class="k">\item</span><span class="na">[\mycheckbox{}{}]</span> <span class="k">\myanswer</span><span class="nb">{</span>Talk room B<span class="nb">}</span> Talk in room B
331 <span class="k">\item</span> Something else entirely <span class="k">\myanswer</span><span class="nb">{</span>other<span class="nb">}</span>
332 <span class="k">\ExplSyntaxOn</span>
333 <span class="k">\sdaps</span><span class="nb">_</span>textbox<span class="nb">_</span>hstretch:nnnnn<span class="nb">{}{</span>2mm<span class="nb">}{</span>5mm<span class="nb">}{</span>40mm<span class="nb">}{</span>1<span class="nb">}</span>
334 <span class="k">\ExplSyntaxOff</span>
335 <span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
336 <span class="k">\myquestionend</span><span class="nb">{</span>name<span class="nb">}</span>
337 </pre></div>
338 </div><div class="content-rendering">
339 <p><img src="_images/sdaps-e0c44b7ccedea9b3cbbd2df1f1130048d795175a.svg" alt="% Prepare some stuff so that we can access the specialized commands more easily.
340 \ExplSyntaxOn
341 \let\myquestionbegin\sdaps_qobject_begin:nnn
342 \let\mycheckbox\sdaps_checkbox:nn
343 \let\myanswer\sdaps_answer:n
344 \let\myquestionend\sdaps_qobject_end:n
345 \let\mysetcheckboxtype\sdaps_checkbox_set_type:n
346 \ExplSyntaxOff
347
348 \myquestionbegin{name}{Option}{Attended events}
349 \mysetcheckboxtype{singlechoice}
350 Which one of the following events did you attend?
351 \begin{itemize}
352 \item[\mycheckbox{}{}] \myanswer{Talk room A} Talk in room A
353 \item[\mycheckbox{}{}] \myanswer{Talk room B} Talk in room B
354 \item Something else entirely \myanswer{other}
355 \ExplSyntaxOn
356 \sdaps_textbox_hstretch:nnnnn{}{2mm}{5mm}{40mm}{1}
357 \ExplSyntaxOff
358 \end{itemize}
359 \myquestionend{name}" /></p>
360 </div><div class="content-metadata">
361 <pre>
362 [1]Author=Author
363 [2]Title=Title
364 [3]SDAPSVersion=1.9.10
365 [4]Duplex=true
366 [5]PrintQuestionnaireId=0
367 [6]PageSize=597.50793pt,845.04694pt
368 [7]Style=qr
369 [8]CheckMode=checkcorrect
370 [9]GlobalID=
371 [10]GlobalIDLabel=
372 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
373 [12]QObject-Option=1. Attended events
374 [14]Answer[1]=Talk room A
375 [13]Box[1]=Checkbox,0,46.08492pt,712.58836pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_1,1
376 [16]Answer[1]=Talk room B
377 [15]Box[1]=Checkbox,0,46.08492pt,694.27495pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_2,2
378 [17]Answer[1]=other
379 [18]Box[1]=Textbox,0,178.93889pt,678.60309pt,384.42575pt,19.9169pt,1.00374pt,1_3,
380 [19]Variable[1]=1
381 </pre></div></div><p class="caption">Single choice question using itemize</p></div><p>Note that we placed a textbox rather than a checkbox as one of the possible
382 answers.</p>
383 </div>
384 <div class="section" id="ranges">
385 <h2>Ranges<a class="headerlink" href="#ranges" title="Permalink to this headline">¶</a></h2>
386 <p>Quite often one has single choice question which represent a value on a range.
387 One could create these using the <code class="docutils literal notranslate"><span class="pre">Option</span></code> type question, but with <code class="docutils literal notranslate"><span class="pre">Range</span></code>
388 it becomes more convenient.</p>
389 <p>Range questions can contain a single range and further answers like
390 “Not applicable”.</p>
391 <p>The range is specified with a separate command. For the purpose of this command,
392 the first and last box that is part of the range needs to be specified. This is
393 done with a zero based index (i.e. the first checkbox is 0, the second 1, …).</p>
394 <div class="figure">
395 <div class="tabs">
396 <input type="radio" id="tab-code-8" class="tab-code" name="tab-group-8" ><label for="tab-code-8" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-8" class="tab-rendering" name="tab-group-8" checked><label for="tab-rendering-8" class="label-rendering">Result</label><input type="radio" id="tab-metadata-8" class="tab-metadata" name="tab-group-8"><label for="tab-metadata-8" class="label-metadata">Metadata</label><div class="content-code">
397 <div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
398 <span class="k">\ExplSyntaxOn</span>
399 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
400 <span class="k">\let\mycheckbox\sdaps</span><span class="nb">_</span>checkbox:nn
401 <span class="k">\let\myanswer\sdaps</span><span class="nb">_</span>answer:n
402 <span class="k">\let\myrange\sdaps</span><span class="nb">_</span>range:nnn
403 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
404 <span class="k">\let\mysetcheckboxtype\sdaps</span><span class="nb">_</span>checkbox<span class="nb">_</span>set<span class="nb">_</span>type:n
405 <span class="k">\ExplSyntaxOff</span>
406
407 <span class="k">\myquestionbegin</span><span class="nb">{</span>name<span class="nb">}{</span>Option<span class="nb">}{</span>Attended events<span class="nb">}</span>
408 <span class="k">\mysetcheckboxtype</span><span class="nb">{</span>singlechoice<span class="nb">}</span>
409 Did you like the keynote?
410 <span class="k">\begin</span><span class="nb">{</span>itemize<span class="nb">}</span>
411 <span class="k">\item</span>
412 it was bad
413 <span class="k">\mycheckbox</span><span class="nb">{}{}</span> ~
414 <span class="k">\mycheckbox</span><span class="nb">{}{}</span> ~
415 <span class="k">\mycheckbox</span><span class="nb">{}{}</span> ~
416 <span class="k">\mycheckbox</span><span class="nb">{}{}</span> ~
417 <span class="k">\mycheckbox</span><span class="nb">{}{}</span> ~
418 it was great
419 <span class="k">\item</span><span class="na">[\mycheckbox{}{}]</span> I did not attend the keynote
420 <span class="k">\end</span><span class="nb">{</span>itemize<span class="nb">}</span>
421 <span class="k">\myrange</span><span class="nb">{</span>lower<span class="nb">}{</span>0<span class="nb">}{</span>bad<span class="nb">}</span>
422 <span class="k">\myrange</span><span class="nb">{</span>upper<span class="nb">}{</span>4<span class="nb">}{</span>great<span class="nb">}</span>
423 <span class="k">\myanswer</span><span class="nb">{</span>did not attend<span class="nb">}</span>
424 <span class="k">\myquestionend</span><span class="nb">{</span>name<span class="nb">}</span>
425 </pre></div>
426 </div><div class="content-rendering">
427 <p><img src="_images/sdaps-e6f41b54e84049a7613982bd4f6a7ac2c5e3fa53.svg" alt="% Prepare some stuff so that we can access the specialized commands more easily.
428 \ExplSyntaxOn
429 \let\myquestionbegin\sdaps_qobject_begin:nnn
430 \let\mycheckbox\sdaps_checkbox:nn
431 \let\myanswer\sdaps_answer:n
432 \let\myrange\sdaps_range:nnn
433 \let\myquestionend\sdaps_qobject_end:n
434 \let\mysetcheckboxtype\sdaps_checkbox_set_type:n
435 \ExplSyntaxOff
436
437 \myquestionbegin{name}{Option}{Attended events}
438 \mysetcheckboxtype{singlechoice}
439 Did you like the keynote?
440 \begin{itemize}
441 \item
442 it was bad
443 \mycheckbox{}{} ~
444 \mycheckbox{}{} ~
445 \mycheckbox{}{} ~
446 \mycheckbox{}{} ~
447 \mycheckbox{}{} ~
448 it was great
449 \item[\mycheckbox{}{}] I did not attend the keynote
450 \end{itemize}
451 \myrange{lower}{0}{bad}
452 \myrange{upper}{4}{great}
453 \myanswer{did not attend}
454 \myquestionend{name}" /></p>
455 </div><div class="content-metadata">
456 <pre>
457 [1]Author=Author
458 [2]Title=Title
459 [3]SDAPSVersion=1.9.10
460 [4]Duplex=true
461 [5]PrintQuestionnaireId=0
462 [6]PageSize=597.50793pt,845.04694pt
463 [7]Style=qr
464 [8]CheckMode=checkcorrect
465 [9]GlobalID=
466 [10]GlobalIDLabel=
467 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
468 [12]QObject-Option=1. Attended events
469 [13]Box[1]=Checkbox,0,114.51073pt,712.58836pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_1,1
470 [14]Box[1]=Checkbox,0,131.73024pt,712.58836pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_2,2
471 [15]Box[1]=Checkbox,0,148.94975pt,712.58836pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_3,3
472 [16]Box[1]=Checkbox,0,166.16927pt,712.58836pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_4,4
473 [17]Box[1]=Checkbox,0,183.38878pt,712.58836pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_5,5
474 [18]Box[1]=Checkbox,0,46.08492pt,694.27495pt,9.95845pt,9.95845pt,ellipse,1.00374pt,1_6,6
475 [19]Range-lower[1]=0,bad
476 [20]Range-upper[1]=4,great
477 [21]Answer[1]=did not attend
478 [22]Variable[1]=1
479 </pre></div></div><p class="caption">Range question</p></div><p>Note that <code class="docutils literal notranslate"><span class="pre">lower</span></code> must always be the earlier checkbox. You can however assign
480 different values to each checkbox using the second parameter to the checkbox
481 command, thereby redefining the numeric value. The main different to the
482 <code class="docutils literal notranslate"><span class="pre">Option</span></code> question is simply how the question will be represented in the
483 report.</p>
484 </div>
485 <div class="section" id="codeboxes">
486 <span id="id1"></span><h2>Codeboxes<a class="headerlink" href="#codeboxes" title="Permalink to this headline">¶</a></h2>
487 <p>There is experimental support for code boxes, that is not yet available using a
488 nice wrapper. This can be used to create QR code read fields.</p>
489 <div class="figure">
490 <div class="tabs">
491 <input type="radio" id="tab-code-9" class="tab-code" name="tab-group-9" ><label for="tab-code-9" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-9" class="tab-rendering" name="tab-group-9" checked><label for="tab-rendering-9" class="label-rendering">Result</label><input type="radio" id="tab-metadata-9" class="tab-metadata" name="tab-group-9"><label for="tab-metadata-9" class="label-metadata">Metadata</label><div class="content-code">
492 <div class="highlight"><pre><span></span><span class="k">\myquestionbegin</span><span class="nb">{</span>name<span class="nb">}{</span>Text<span class="nb">}{</span>This is a QR code question<span class="nb">}</span>
493 <span class="k">\mysettextboxtype</span><span class="nb">{</span>codebox<span class="nb">}</span>
494
495 Place barcode sticker into the box:
496 <span class="c">% Note that we use hspace + vrule for sizing here, that is a bit weird but</span>
497 <span class="c">% a reasonable method of setting a size</span>
498 <span class="k">\mytexthbox</span><span class="nb">{}{</span>3bp<span class="nb">}{</span> <span class="k">\hspace</span><span class="nb">{</span>8cm<span class="nb">}</span> <span class="k">\vrule</span> width 0pt height 3cm depth 2cm <span class="nb">}</span>
499 <span class="k">\myquestionend</span><span class="nb">{</span>name<span class="nb">}</span>
500 </pre></div>
501 Required code in preamble:<div class="highlight"><pre><span></span><span class="c">% Prepare some stuff so that we can access the specialized commands more easily.</span>
502 <span class="k">\ExplSyntaxOn</span>
503 <span class="k">\let\myquestionbegin\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>begin:nnn
504 <span class="k">\let\mytexthbox\sdaps</span><span class="nb">_</span>textbox<span class="nb">_</span>hbox:nnn
505 <span class="k">\let\myquestionend\sdaps</span><span class="nb">_</span>qobject<span class="nb">_</span>end:n
506 <span class="k">\let\mysettextboxtype\sdaps</span><span class="nb">_</span>textbox<span class="nb">_</span>set<span class="nb">_</span>type:n
507 <span class="c">% Set a global overlay with a nice icon (quite likely, you will just want</span>
508 <span class="c">% to place text into the hbox below rather than just placing spacing).</span>
509 <span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span>
510 codebox = <span class="nb">{</span>
511 centered<span class="nb">_</span>text = <span class="nb">{</span>
512 <span class="k">\begin</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>[yscale=-0.1, xscale=0.1]
513 <span class="k">\path</span><span class="na">[draw=black,fill=black,stroke=]</span> (-1,0)
514 -- (-1,5) -- (4,5) -- (4,0) -- cycle(7,0) -- (7,5) -- (12,5) -- (12,0) -- cycle(0,1) -- (3,1) -- (3,4)
515 -- (0,4) -- cycle(8,1) -- (11,1) -- (11,4) -- (8,4) -- cycle(1,2) -- (1,3) -- (2,3) -- (2,2) -- cycle(5,2) --
516 (5,3) -- (6,3) -- (6,2) -- cycle(9,2) -- (9,3) -- (10,3) -- (10,2) -- cycle(5,4) -- (5,6) -- (2,6) -- (2,7)
517 -- (6,7) -- (6,4) -- cycle(0,6) -- (0,7) -- (1,7) -- (1,6) -- cycle(7,6) -- (7,7) -- (8,7) -- (8,6) --
518 cycle(-1,8) -- (-1,13) -- (4,13) -- (4,8) -- cycle(5,8) -- (5,13) -- (6,13) -- (6,8) -- cycle(7,8) -- (7,9)
519 -- (8,9) -- (8,10) -- (7,10) -- (7,13) -- (8,13) -- (8,11) -- (9,11) -- (9,10) -- (10,10) -- (10,9) -- (9,9)
520 -- (9,8) -- cycle(10,9) -- (12,9) -- (12,8) -- (10,8) -- cycle(0,9) -- (3,9) -- (3,12) -- (0,12) --
521 cycle(1,10) -- (1,11) -- (2,11) -- (2,10) -- cycle(11,10) -- (11,11) -- (12,11) -- (12,10) -- cycle(11,11) --
522 (10,11) -- (10,12) -- (9,12) -- (9,13) -- (12,13) -- (12,12) -- (11,12) -- cycle;
523 <span class="k">\end</span><span class="nb">{</span>tikzpicture<span class="nb">}</span>
524 <span class="nb">}</span>,
525 <span class="nb">}</span>
526 <span class="nb">}</span>
527 <span class="k">\ExplSyntaxOff</span>
528 </pre></div>
529 </div><div class="content-rendering">
530 <p><img src="_images/sdaps-49b0c5bc05b02f591b5a13cf5d1d27b20a0aef17.svg" alt="\myquestionbegin{name}{Text}{This is a QR code question}
531 \mysettextboxtype{codebox}
532
533 Place barcode sticker into the box:
534 % Note that we use hspace + vrule for sizing here, that is a bit weird but
535 % a reasonable method of setting a size
536 \mytexthbox{}{3bp}{ \hspace{8cm} \vrule width 0pt height 3cm depth 2cm }
537 \myquestionend{name}" /></p>
538 </div><div class="content-metadata">
539 <pre>
540 [1]Author=Author
541 [2]Title=Title
542 [3]SDAPSVersion=1.9.10
543 [4]Duplex=true
544 [5]PrintQuestionnaireId=0
545 [6]PageSize=597.50793pt,845.04694pt
546 [7]Style=qr
547 [8]CheckMode=checkcorrect
548 [9]GlobalID=
549 [10]GlobalIDLabel=
550 [11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt
551 [12]QObject-Text=1. This is a QR code question
552 [13]Box[1]=Codebox,0,204.34308pt,729.6933pt,237.27507pt,148.28625pt,1.00374pt,1_1,
553 [14]Variable[1]=1
554 </pre></div></div><p class="caption">Codebox question and field</p></div></div>
555 </div>
556
557
558 <div class="clearer"></div>
559 </div>
560 </div>
561 </div>
562 <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
563 <div class="sphinxsidebarwrapper">
564 <h3><a href="index.html">Table of Contents</a></h3>
565 <ul>
566 <li><a class="reference internal" href="#">Creating custom layouts using base commands</a><ul>
567 <li><a class="reference internal" href="#general-question-structure">General question structure</a></li>
568 </ul>
569 </li>
570 <li><a class="reference internal" href="#the-different-question-types">The different question types</a><ul>
571 <li><a class="reference internal" href="#headings">Headings</a></li>
572 <li><a class="reference internal" href="#multiple-choice">Multiple choice</a></li>
573 <li><a class="reference internal" href="#single-choice">Single choice</a></li>
574 <li><a class="reference internal" href="#ranges">Ranges</a></li>
575 <li><a class="reference internal" href="#codeboxes">Codeboxes</a></li>
576 </ul>
577 </li>
578 </ul>
579
580 <h4>Previous topic</h4>
581 <p class="topless"><a href="FAQ.html"
582 title="previous chapter">Frequently Asked Questions</a></p>
583 <h4>Next topic</h4>
584 <p class="topless"><a href="sdapsclassic.html"
585 title="next chapter">sdapsclassic class</a></p>
586 <div role="note" aria-label="source link">
587 <h3>This Page</h3>
588 <ul class="this-page-menu">
589 <li><a href="_sources/customlayout.rst.txt"
590 rel="nofollow">Show Source</a></li>
591 </ul>
592 </div>
593 <div id="searchbox" style="display: none" role="search">
594 <h3 id="searchlabel">Quick search</h3>
595 <div class="searchformwrapper">
596 <form class="search" action="search.html" method="get">
597 <input type="text" name="q" aria-labelledby="searchlabel" />
598 <input type="submit" value="Go" />
599 </form>
600 </div>
601 </div>
602 <script>$('#searchbox').show(0);</script>
603 </div>
604 </div>
605 <div class="clearer"></div>
606 </div>
607 <div class="related" role="navigation" aria-label="related navigation">
608 <h3>Navigation</h3>
609 <ul>
610 <li class="right" style="margin-right: 10px">
611 <a href="genindex.html" title="General Index"
612 >index</a></li>
613 <li class="right" >
614 <a href="sdapsclassic.html" title="sdapsclassic class"
615 >next</a> |</li>
616 <li class="right" >
617 <a href="FAQ.html" title="Frequently Asked Questions"
618 >previous</a> |</li>
619 <li class="nav-item nav-item-0"><a href="index.html">sdaps-class 0.1 documentation</a> &#187;</li>
620 <li class="nav-item nav-item-this"><a href="">Creating custom layouts using base commands</a></li>
621 </ul>
622 </div>
623 <div class="footer" role="contentinfo">
624 &#169; Copyright 2016, Benjamin Berg.
625 Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
626 </div>
627 </body>
628 </html>