| 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>sdapsbase package — 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="prev" title="sdapsarray package" href="sdapsarray.html" /> |
| 21 |
</head><body> |
| 22 |
<div class="related" role="navigation" aria-label="related navigation"> |
| 23 |
<h3>Navigation</h3> |
| 24 |
<ul> |
| 25 |
<li class="right" style="margin-right: 10px"> |
| 26 |
<a href="genindex.html" title="General Index" |
| 27 |
accesskey="I">index</a></li> |
| 28 |
<li class="right" > |
| 29 |
<a href="sdapsarray.html" title="sdapsarray package" |
| 30 |
accesskey="P">previous</a> |</li> |
| 31 |
<li class="nav-item nav-item-0"><a href="index.html">sdaps-class 0.1 documentation</a> »</li> |
| 32 |
<li class="nav-item nav-item-this"><a href="">sdapsbase package</a></li> |
| 33 |
</ul> |
| 34 |
</div> |
| 35 |
|
| 36 |
<div class="document"> |
| 37 |
<div class="documentwrapper"> |
| 38 |
<div class="bodywrapper"> |
| 39 |
<div class="body" role="main"> |
| 40 |
|
| 41 |
<div class="section" id="sdapsbase-package"> |
| 42 |
<span id="sdapsbase"></span><h1>sdapsbase package<a class="headerlink" href="#sdapsbase-package" title="Permalink to this headline">¶</a></h1> |
| 43 |
<p>This base package handles many of the core functionalities to make the SDAPS |
| 44 |
class work (together with <a class="reference internal" href="sdapsarray.html#sdapsarray" title="sdapsarray"><code class="xref tex tex-environ docutils literal notranslate"><span class="pre">sdapsarray</span></code></a>). It implements a number of features |
| 45 |
which should however not be relevant for many end users. It should not be |
| 46 |
neccessary to dive into the <a class="reference internal" href="#sdapsbase"><span class="std std-ref">sdapsbase</span></a> implementation unless you want to use |
| 47 |
some of the more advanced features or even create completely custom layouts.</p> |
| 48 |
<div class="section" id="the-context-subsystem"> |
| 49 |
<h2>The context subsystem<a class="headerlink" href="#the-context-subsystem" title="Permalink to this headline">¶</a></h2> |
| 50 |
<p>SDAPS has a system to handle context for the questions. This context is managed |
| 51 |
in the global TeX scope. This means that modifications done for example inside |
| 52 |
a <cite>multicols</cite> environment will still be seen in the rest of the document. The |
| 53 |
context system itself is also hirarchical, so that it is possible to define |
| 54 |
different defaults for sections of the document. The most obvious use case for |
| 55 |
this might be prefixing all variables within parts of the document with a |
| 56 |
certain string. But one could also imagine changing the size of checkboxes |
| 57 |
for parts of the document.</p> |
| 58 |
<div class="section" id="handling-context-nesting"> |
| 59 |
<h3>Handling context nesting<a class="headerlink" href="#handling-context-nesting" title="Permalink to this headline">¶</a></h3> |
| 60 |
<p>The following commands can be used to handle context nesting. Note that SDAPS |
| 61 |
makes a best effort to detect errors where begin/end was not used in a balanced |
| 62 |
fashion.</p> |
| 63 |
<dl class="tex macro"> |
| 64 |
<dt id="\sdaps_context_begin:n"> |
| 65 |
<code class="sig-name descname">\sdaps_context_begin:n</code><span class="sig"> <span class="sig-paren">{</span><em>context name</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_begin:n" title="Permalink to this definition">¶</a></dt> |
| 66 |
<dd><p>Begins a context with the given name</p> |
| 67 |
</dd></dl> |
| 68 |
|
| 69 |
<dl class="tex macro"> |
| 70 |
<dt id="\sdaps_context_end:n"> |
| 71 |
<code class="sig-name descname">\sdaps_context_end:n</code><span class="sig"> <span class="sig-paren">{</span><em>context name</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_end:n" title="Permalink to this definition">¶</a></dt> |
| 72 |
<dd><p>Ends the context again, ensuring the name is correct</p> |
| 73 |
</dd></dl> |
| 74 |
|
| 75 |
<dl class="tex macro"> |
| 76 |
<dt id="\sdaps_context_begin:"> |
| 77 |
<code class="sig-name descname">\sdaps_context_begin:</code><a class="headerlink" href="#\sdaps_context_begin:" title="Permalink to this definition">¶</a></dt> |
| 78 |
<dd><p>Begins a context with an empty name</p> |
| 79 |
</dd></dl> |
| 80 |
|
| 81 |
<dl class="tex macro"> |
| 82 |
<dt id="\sdaps_context_end:"> |
| 83 |
<code class="sig-name descname">\sdaps_context_end:</code><a class="headerlink" href="#\sdaps_context_end:" title="Permalink to this definition">¶</a></dt> |
| 84 |
<dd><p>Ends a context started with <a class="reference internal" href="#\sdaps_context_begin:" title="\sdaps_context_begin:"><code class="xref tex tex-macro docutils literal notranslate"><span class="pre">\sdaps_context_begin:</span></code></a></p> |
| 85 |
</dd></dl> |
| 86 |
|
| 87 |
<dl class="tex macro"> |
| 88 |
<dt id="\sdaps_context_begin_local:"> |
| 89 |
<code class="sig-name descname">\sdaps_context_begin_local:</code><a class="headerlink" href="#\sdaps_context_begin_local:" title="Permalink to this definition">¶</a></dt> |
| 90 |
<dd><p>Begins a context which automatically ends together with the current TeX group.</p> |
| 91 |
</dd></dl> |
| 92 |
|
| 93 |
<dl class="tex macro"> |
| 94 |
<dt id="\sdaps_context_enable_writing:"> |
| 95 |
<code class="sig-name descname">\sdaps_context_enable_writing:</code><a class="headerlink" href="#\sdaps_context_enable_writing:" title="Permalink to this definition">¶</a></dt> |
| 96 |
<dd><p>Enable metadata writing for the remainder of the current context. Note that |
| 97 |
this package disables writing at start and you need to enable it before |
| 98 |
calling <code class="xref tex tex-macro docutils literal notranslate"><span class="pre">\sdaps_begin:</span></code> (and <code class="xref tex tex-macro docutils literal notranslate"><span class="pre">\sdaps_end:</span></code>). Classes such as |
| 99 |
the <a class="reference internal" href="sdapsclassic.html#sdapsclassic"><span class="std std-ref">sdapsclassic class</span></a> will enable metadata writing for you.</p> |
| 100 |
</dd></dl> |
| 101 |
|
| 102 |
<dl class="tex macro"> |
| 103 |
<dt id="\sdaps_context_disable_writing:"> |
| 104 |
<code class="sig-name descname">\sdaps_context_disable_writing:</code><a class="headerlink" href="#\sdaps_context_disable_writing:" title="Permalink to this definition">¶</a></dt> |
| 105 |
<dd><p>Disable metadata writing for the remainder of the current context. Note that |
| 106 |
disabling metadata writing may have some side effects with regard to |
| 107 |
variables and automatic numbering of questions and answers. The exact |
| 108 |
behaviour is currently <em>not</em> well defined.</p> |
| 109 |
</dd></dl> |
| 110 |
|
| 111 |
<dl class="tex macro"> |
| 112 |
<dt id="\sdaps_context_hook_end:n"> |
| 113 |
<code class="sig-name descname">\sdaps_context_hook_end:n</code><a class="headerlink" href="#\sdaps_context_hook_end:n" title="Permalink to this definition">¶</a></dt> |
| 114 |
<dd><p>Register a token list which will be executed at the end of the current |
| 115 |
context. This is primarily useful as a context might be ended implicitly |
| 116 |
in some circumstances.</p> |
| 117 |
</dd></dl> |
| 118 |
|
| 119 |
<dl class="tex macro"> |
| 120 |
<dt id="\sdaps_context_hook_post_end:n"> |
| 121 |
<code class="sig-name descname">\sdaps_context_hook_post_end:n</code><a class="headerlink" href="#\sdaps_context_hook_post_end:n" title="Permalink to this definition">¶</a></dt> |
| 122 |
<dd><p>Register a token list which will be executed <em>after</em> the end of the current |
| 123 |
context has ended (i.e. in the parent context). This is primarily useful |
| 124 |
as a context might be ended implicitly in some circumstances.</p> |
| 125 |
</dd></dl> |
| 126 |
|
| 127 |
</div> |
| 128 |
<div class="section" id="managing-context-variables"> |
| 129 |
<h3>Managing context variables<a class="headerlink" href="#managing-context-variables" title="Permalink to this headline">¶</a></h3> |
| 130 |
<dl class="tex macro"> |
| 131 |
<dt id="\sdaps_context_put:n"> |
| 132 |
<code class="sig-name descname">\sdaps_context_put:n</code><span class="sig"> <span class="sig-paren">{</span><em>key</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_put:n" title="Permalink to this definition">¶</a></dt> |
| 133 |
<dd><p>Set the given variable (or key) to <code class="docutils literal notranslate"><span class="pre">\\undefined</span></code>.</p> |
| 134 |
</dd></dl> |
| 135 |
|
| 136 |
<dl class="tex macro"> |
| 137 |
<dt id="\sdaps_context_put:nn"> |
| 138 |
<code class="sig-name descname">\sdaps_context_put:nn</code><span class="sig"> <span class="sig-paren">{</span><em>key</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>value</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_put:nn" title="Permalink to this definition">¶</a></dt> |
| 139 |
<dd><p>Set the given variable to the given value (Variants: <code class="docutils literal notranslate"><span class="pre">nV</span></code>)</p> |
| 140 |
</dd></dl> |
| 141 |
|
| 142 |
<dl class="tex macro"> |
| 143 |
<dt id="\sdaps_context_remove:n"> |
| 144 |
<code class="sig-name descname">\sdaps_context_remove:n</code><span class="sig"> <span class="sig-paren">{</span><em>key</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_remove:n" title="Permalink to this definition">¶</a></dt> |
| 145 |
<dd><p>Remove the given variable from the context.</p> |
| 146 |
</dd></dl> |
| 147 |
|
| 148 |
<dl class="tex macro"> |
| 149 |
<dt id="\sdaps_context_set:n"> |
| 150 |
<code class="sig-name descname">\sdaps_context_set:n</code><span class="sig"> <em class="sig-param">{ key=value, key={a=b, c=d} }</em> </span><a class="headerlink" href="#\sdaps_context_set:n" title="Permalink to this definition">¶</a></dt> |
| 151 |
<dd><p>Set context variables from the given <code class="docutils literal notranslate"><span class="pre">key=value</span></code> parameters</p> |
| 152 |
</dd></dl> |
| 153 |
|
| 154 |
<dl class="tex macro"> |
| 155 |
<dt id="\sdaps_context_append:nn"> |
| 156 |
<code class="sig-name descname">\sdaps_context_append:nn</code><span class="sig"> <span class="sig-paren">{</span><em>key</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>value</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_append:nn" title="Permalink to this definition">¶</a></dt> |
| 157 |
<dd><p>The first argument being a variable to modify, append the given value to the |
| 158 |
existing value. This can for example be used to change only one aspect of |
| 159 |
checkbox drawing (e.g. <code class="docutils literal notranslate"><span class="pre">form</span></code>) without affecting resetting another one |
| 160 |
that was defined earlier (e.g. <code class="docutils literal notranslate"><span class="pre">width</span></code> or <code class="docutils literal notranslate"><span class="pre">height</span></code>).</p> |
| 161 |
<p>Generally it is a good idea to use this macro as nested options are common.</p> |
| 162 |
<p>Identical to <a class="reference internal" href="#\sdaps_context_append:nnn" title="\sdaps_context_append:nnn"><code class="xref tex tex-macro docutils literal notranslate"><span class="pre">\sdaps_context_append:nnn</span></code></a> with “<code class="docutils literal notranslate"><span class="pre">,</span></code>” as the separator.</p> |
| 163 |
</dd></dl> |
| 164 |
|
| 165 |
<dl class="tex macro"> |
| 166 |
<dt id="\sdaps_context_append:nnn"> |
| 167 |
<code class="sig-name descname">\sdaps_context_append:nnn</code><span class="sig"> <span class="sig-paren">{</span><em>key</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>value</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>separator</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_context_append:nnn" title="Permalink to this definition">¶</a></dt> |
| 168 |
<dd><p>Append the value to the given <code class="docutils literal notranslate"><span class="pre">key</span></code> in the context. If <code class="docutils literal notranslate"><span class="pre">key</span></code> is set, |
| 169 |
inserts <code class="docutils literal notranslate"><span class="pre">separator</span></code> between them. If key is not set, simply sets the |
| 170 |
<code class="docutils literal notranslate"><span class="pre">key</span></code> to the given value.</p> |
| 171 |
<dl class="field-list simple"> |
| 172 |
<dt class="field-odd">Variants</dt> |
| 173 |
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">nVn</span></code></p> |
| 174 |
</dd> |
| 175 |
</dl> |
| 176 |
</dd></dl> |
| 177 |
|
| 178 |
</div> |
| 179 |
<div class="section" id="defining-questions-and-headings"> |
| 180 |
<h3>Defining questions and headings<a class="headerlink" href="#defining-questions-and-headings" title="Permalink to this headline">¶</a></h3> |
| 181 |
<dl class="tex macro"> |
| 182 |
<dt id="\sdaps_qobject_begin:nnn"> |
| 183 |
<code class="sig-name descname">\sdaps_qobject_begin:nnn</code><span class="sig"> <span class="sig-paren">{</span><em>name</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>type</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>title</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_qobject_begin:nnn" title="Permalink to this definition">¶</a></dt> |
| 184 |
<dd><p>Start a new qobject, giving the following arguments:</p> |
| 185 |
<ul class="simple"> |
| 186 |
<li><p>The name of the context group to start</p></li> |
| 187 |
<li><p>The type of the qobject (to be consumed by the SDAPS main program)</p></li> |
| 188 |
<li><p>The title for the metadata</p></li> |
| 189 |
</ul> |
| 190 |
</dd></dl> |
| 191 |
|
| 192 |
<dl class="tex macro"> |
| 193 |
<dt id="\sdaps_qobject_end:n"> |
| 194 |
<code class="sig-name descname">\sdaps_qobject_end:n</code><span class="sig"> <span class="sig-paren">{</span><em>name</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_qobject_end:n" title="Permalink to this definition">¶</a></dt> |
| 195 |
<dd><p>Finish a qobject again, must pass the correct name to verify correct nesting.</p> |
| 196 |
</dd></dl> |
| 197 |
|
| 198 |
<dl class="tex macro"> |
| 199 |
<dt id="\sdaps_qobject_begin:nn"> |
| 200 |
<code class="sig-name descname">\sdaps_qobject_begin:nn</code><span class="sig"> <span class="sig-paren">{</span><em>type</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>title</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_qobject_begin:nn" title="Permalink to this definition">¶</a></dt> |
| 201 |
<dd><p>Same as <code class="xref tex tex-macro docutils literal notranslate"><span class="pre">sdaps_qobject_begin:nnn</span></code> but without giving a context name.</p> |
| 202 |
</dd></dl> |
| 203 |
|
| 204 |
<dl class="tex macro"> |
| 205 |
<dt id="\sdaps_qobject_begin_local:nn"> |
| 206 |
<code class="sig-name descname">\sdaps_qobject_begin_local:nn</code><span class="sig"> <span class="sig-paren">{</span><em>type</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>title</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_qobject_begin_local:nn" title="Permalink to this definition">¶</a></dt> |
| 207 |
<dd><p>Same as <code class="xref tex tex-macro docutils literal notranslate"><span class="pre">sdaps_qobject_begin:nnn</span></code> but will automatically end with |
| 208 |
the current TeX group (using <code class="xref tex tex-macro docutils literal notranslate"><span class="pre">sdaps_context_begin_local:</span></code>).</p> |
| 209 |
</dd></dl> |
| 210 |
|
| 211 |
<dl class="tex macro"> |
| 212 |
<dt id="\sdaps_qobject_end:"> |
| 213 |
<code class="sig-name descname">\sdaps_qobject_end:</code><a class="headerlink" href="#\sdaps_qobject_end:" title="Permalink to this definition">¶</a></dt> |
| 214 |
<dd><p>End a question which did not have a defined context name</p> |
| 215 |
</dd></dl> |
| 216 |
|
| 217 |
<p>You can write further metadata using the following macros:</p> |
| 218 |
<dl class="tex macro"> |
| 219 |
<dt id="\sdaps_qobject_append_var:n"> |
| 220 |
<code class="sig-name descname">\sdaps_qobject_append_var:n</code><span class="sig"> <span class="sig-paren">{</span><em>var</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_qobject_append_var:n" title="Permalink to this definition">¶</a></dt> |
| 221 |
<dd><p>Appends the given string to the variable name of the question. An <code class="docutils literal notranslate"><span class="pre">_</span></code> |
| 222 |
will be used to separate the new variable name with any piece that was |
| 223 |
defined earlier (either on the same question or on a surrounding question |
| 224 |
object).</p> |
| 225 |
<p>If <code class="docutils literal notranslate"><span class="pre">var</span></code> starts with an underscore (<code class="docutils literal notranslate"><span class="pre">_</span></code>) then an implicit variable name |
| 226 |
for all surrounding question object (i.e. headings/sections) will be |
| 227 |
generated based on their automatic numbering. This is similar to the |
| 228 |
mechanism used by <a class="reference internal" href="sdapslayout.html#choicearray" title="choicearray"><code class="xref tex tex-environ docutils literal notranslate"><span class="pre">choicearray</span></code></a> to ensure that the different questions |
| 229 |
can always be told appart, even if the user did not specify a variable name |
| 230 |
for all of them.</p> |
| 231 |
</dd></dl> |
| 232 |
|
| 233 |
<dl class="tex macro"> |
| 234 |
<dt id="\sdaps_answer:n"> |
| 235 |
<code class="sig-name descname">\sdaps_answer:n</code><span class="sig"> <span class="sig-paren">{</span><em>answer text</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_answer:n" title="Permalink to this definition">¶</a></dt> |
| 236 |
<dd><p>Write metadata for an answer which belongs to the current question (context)</p> |
| 237 |
</dd></dl> |
| 238 |
|
| 239 |
<dl class="tex macro"> |
| 240 |
<dt id="\sdaps_range:nnn"> |
| 241 |
<code class="sig-name descname">\sdaps_range:nnn</code><span class="sig"> <span class="sig-paren">{</span><em>lower|upper</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>ID</em><span class="sig-paren">}</span> <span class="sig-paren">{</span><em>answer text</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_range:nnn" title="Permalink to this definition">¶</a></dt> |
| 242 |
<dd><p>Writes metadata for a range.</p> |
| 243 |
<dl class="field-list simple"> |
| 244 |
<dt class="field-odd">Arguments</dt> |
| 245 |
<dd class="field-odd"><ul class="simple"> |
| 246 |
<li><p><strong>lower|upper</strong> – Give either <code class="docutils literal notranslate"><span class="pre">lower</span></code> or <code class="docutils literal notranslate"><span class="pre">upper</span></code> for each end of the range.</p></li> |
| 247 |
<li><p><strong>ID</strong> – The ID of the checkbox which corresponds to the first/lower or |
| 248 |
last/upper box in the range. Other boxes are considered outside and need a |
| 249 |
separate answer. Boxes are counted zero based and the given range is inclusive.</p></li> |
| 250 |
<li><p><strong>answer text</strong> – The string for the metadata.</p></li> |
| 251 |
</ul> |
| 252 |
</dd> |
| 253 |
<dt class="field-even">Variants</dt> |
| 254 |
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">nno</span></code>, <code class="docutils literal notranslate"><span class="pre">nnf</span></code>, <code class="docutils literal notranslate"><span class="pre">nnV</span></code></p> |
| 255 |
</dd> |
| 256 |
</dl> |
| 257 |
</dd></dl> |
| 258 |
|
| 259 |
<p>Generic commands are also provided to write to</p> |
| 260 |
<dl class="tex macro"> |
| 261 |
<dt id="\sdaps_info_write:n"> |
| 262 |
<code class="sig-name descname">\sdaps_info_write:n</code><span class="sig"> <span class="sig-paren">{</span><em>text</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_info_write:n" title="Permalink to this definition">¶</a></dt> |
| 263 |
<dd><p>Write given text to metadatafile at shipout. Some output may be reordered due |
| 264 |
to this, but all SDAPS classes ensure that the metadata can still be decoded |
| 265 |
correctly. As this macro leaves elements in the output stream it can affect |
| 266 |
layouting in a few cases (e.g. row headers of <a class="reference internal" href="sdapsarray.html#sdapsarray" title="sdapsarray"><code class="xref tex tex-environ docutils literal notranslate"><span class="pre">sdapsarray</span></code></a>).</p> |
| 267 |
<p>The tokens <strong>will not be expanded</strong> again before writing. This implies that coordinates |
| 268 |
cannot be written using this macro.</p> |
| 269 |
<dl class="field-list simple"> |
| 270 |
<dt class="field-odd">Arguments</dt> |
| 271 |
<dd class="field-odd"><p><strong>text</strong> – Text to write to the metadata file.</p> |
| 272 |
</dd> |
| 273 |
<dt class="field-even">Variants</dt> |
| 274 |
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">x</span></code></p> |
| 275 |
</dd> |
| 276 |
</dl> |
| 277 |
</dd></dl> |
| 278 |
|
| 279 |
<dl class="tex macro"> |
| 280 |
<dt id="\sdaps_info_write_x:n"> |
| 281 |
<code class="sig-name descname">\sdaps_info_write_x:n</code><a class="headerlink" href="#\sdaps_info_write_x:n" title="Permalink to this definition">¶</a></dt> |
| 282 |
<dd><p>Write given text to metadatafile at shipout. Some output may be reordered due |
| 283 |
to this, but all SDAPS classes ensure that the metadata can still be decoded |
| 284 |
correctly. As this macro leaves elements in the output stream it can affect |
| 285 |
layouting in a few cases (e.g. row headers of <a class="reference internal" href="sdapsarray.html#sdapsarray" title="sdapsarray"><code class="xref tex tex-environ docutils literal notranslate"><span class="pre">sdapsarray</span></code></a>).</p> |
| 286 |
<p>The tokens <strong>will be expanded</strong> again before writing. This implies that coordinates |
| 287 |
can be written using this macro if one takes care not to protect them from |
| 288 |
being expanded at macro execution time.</p> |
| 289 |
<dl class="field-list simple"> |
| 290 |
<dt class="field-odd">Arguments</dt> |
| 291 |
<dd class="field-odd"><p><strong>text</strong> – Text to write to the metadata file.</p> |
| 292 |
</dd> |
| 293 |
<dt class="field-even">Variants</dt> |
| 294 |
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">x</span></code></p> |
| 295 |
</dd> |
| 296 |
</dl> |
| 297 |
</dd></dl> |
| 298 |
|
| 299 |
</div> |
| 300 |
</div> |
| 301 |
<div class="section" id="overrides"> |
| 302 |
<h2>Overrides<a class="headerlink" href="#overrides" title="Permalink to this headline">¶</a></h2> |
| 303 |
<p>Overrides allow setting defaults based on the questionnaire ID or based on the |
| 304 |
variable name and value of items. Using this feature it would for example be |
| 305 |
possible to fill in names into text fields for printing.</p> |
| 306 |
<div class="admonition note"> |
| 307 |
<p class="admonition-title">Note</p> |
| 308 |
<p>Overrides are independent of the context itself.</p> |
| 309 |
</div> |
| 310 |
<p>Commands which adhere to overrides are currently:</p> |
| 311 |
<ul class="simple"> |
| 312 |
<li><p>all <code class="docutils literal notranslate"><span class="pre">multichoice</span></code> or <code class="docutils literal notranslate"><span class="pre">singlechoice</span></code> checkboxes</p></li> |
| 313 |
<li><p>all <code class="docutils literal notranslate"><span class="pre">textboxes</span></code></p></li> |
| 314 |
</ul> |
| 315 |
<p>There is only one command to set the overrides string:</p> |
| 316 |
<dl class="tex macro"> |
| 317 |
<dt id="\sdaps_set_questionnaire_id:n"> |
| 318 |
<code class="sig-name descname">\sdaps_set_questionnaire_id:n</code><span class="sig"> <span class="sig-paren">{</span><em>ID</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_set_questionnaire_id:n" title="Permalink to this definition">¶</a></dt> |
| 319 |
<dd><p>Set the current questionnaire ID. This should generally not change unless |
| 320 |
some sort of concatenation is done. It is only relevant for writing new |
| 321 |
environments.</p> |
| 322 |
</dd></dl> |
| 323 |
|
| 324 |
<dl class="tex macro"> |
| 325 |
<dt id="\sdaps_overrides_init:n"> |
| 326 |
<code class="sig-name descname">\sdaps_overrides_init:n</code><span class="sig"> <span class="sig-paren">{</span><em>overrides</em><span class="sig-paren">}</span></span><a class="headerlink" href="#\sdaps_overrides_init:n" title="Permalink to this definition">¶</a></dt> |
| 327 |
<dd><dl class="field-list simple"> |
| 328 |
<dt class="field-odd">Arguments</dt> |
| 329 |
<dd class="field-odd"><p><strong>overrides</strong> – A key=value argument with all the override definitions.</p> |
| 330 |
</dd> |
| 331 |
</dl> |
| 332 |
<p>Each of the override definitions will be appened to the items keys if it is |
| 333 |
matching. Matching happens first based on the questionnaire ID with <code class="docutils literal notranslate"><span class="pre">*</span></code> |
| 334 |
being allowed as a wildcard, and then based on variable name and value. The |
| 335 |
second level (name and value) is either just the variable name or the variable |
| 336 |
name and value separated by an <code class="docutils literal notranslate"><span class="pre">&</span></code> character.</p> |
| 337 |
<p>This gives six matches with increasing priority:</p> |
| 338 |
<ul class="simple"> |
| 339 |
<li><p>wildcard questionnaire ID, wildcard target</p></li> |
| 340 |
<li><p>wildcard questionnaire ID, matching variable</p></li> |
| 341 |
<li><p>wildcard questionnaire ID, matching variable, matching value</p></li> |
| 342 |
<li><p>matching questionnaire ID, wildcard target</p></li> |
| 343 |
<li><p>matching questionnaire ID, matching variable</p></li> |
| 344 |
<li><p>matching questionnaire ID, matching variable, matching value</p></li> |
| 345 |
</ul> |
| 346 |
<div class="figure"> |
| 347 |
<div class="tabs"> |
| 348 |
<input type="radio" id="tab-code-13" class="tab-code" name="tab-group-13" ><label for="tab-code-13" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-13" class="tab-rendering" name="tab-group-13" checked><label for="tab-rendering-13" class="label-rendering">Result</label><input type="radio" id="tab-metadata-13" class="tab-metadata" name="tab-group-13"><label for="tab-metadata-13" class="label-metadata">Metadata</label><div class="content-code"> |
| 349 |
<div class="highlight"><pre><span></span><span class="k">\begin</span><span class="nb">{</span>choicegroup<span class="nb">}</span>[var=flower]<span class="nb">{</span>A group of questions with variable "flower"<span class="nb">}</span> |
| 350 |
<span class="k">\groupaddchoice</span><span class="na">[var=alice]</span><span class="nb">{</span>Choice "alice"<span class="nb">}</span> |
| 351 |
<span class="k">\groupaddchoice</span><span class="na">[var=eve]</span><span class="nb">{</span>Choice "eve"<span class="nb">}</span> |
| 352 |
<span class="k">\choiceline</span><span class="na">[var=adam]</span><span class="nb">{</span>Question "adam"<span class="nb">}</span> |
| 353 |
<span class="k">\choiceline</span><span class="na">[var=bob]</span><span class="nb">{</span>Question "bob"<span class="nb">}</span> |
| 354 |
<span class="k">\end</span><span class="nb">{</span>choicegroup<span class="nb">}</span> |
| 355 |
|
| 356 |
<span class="c">% Force a different questionnaire ID (never do this in a real document!)</span> |
| 357 |
<span class="k">\ExplSyntaxOn</span> |
| 358 |
<span class="k">\sdaps</span><span class="nb">_</span>set<span class="nb">_</span>questionnaire<span class="nb">_</span>id:n <span class="nb">{</span> testid <span class="nb">}</span> |
| 359 |
<span class="k">\ExplSyntaxOff</span> |
| 360 |
<span class="k">\begin</span><span class="nb">{</span>choicegroup<span class="nb">}</span>[var=flower]<span class="nb">{</span>A group of questions with variable "flower"<span class="nb">}</span> |
| 361 |
<span class="k">\groupaddchoice</span><span class="na">[var=alice]</span><span class="nb">{</span>Choice "alice"<span class="nb">}</span> |
| 362 |
<span class="k">\groupaddchoice</span><span class="na">[var=eve]</span><span class="nb">{</span>Choice "eve"<span class="nb">}</span> |
| 363 |
<span class="k">\choiceline</span><span class="na">[var=adam]</span><span class="nb">{</span>Question "adam"<span class="nb">}</span> |
| 364 |
<span class="k">\choiceline</span><span class="na">[var=bob]</span><span class="nb">{</span>Question "bob"<span class="nb">}</span> |
| 365 |
<span class="k">\end</span><span class="nb">{</span>choicegroup<span class="nb">}</span> |
| 366 |
</pre></div> |
| 367 |
Required code in preamble:<div class="highlight"><pre><span></span><span class="k">\ExplSyntaxOn</span> |
| 368 |
<span class="k">\sdaps</span><span class="nb">_</span>overrides<span class="nb">_</span>init:n<span class="nb">{</span> |
| 369 |
<span class="c">% For all questoinnaires independent of their ID</span> |
| 370 |
*=<span class="nb">{</span> |
| 371 |
<span class="c">% For all elements which use the overrides</span> |
| 372 |
*=<span class="nb">{</span>fill=green<span class="nb">}</span>, |
| 373 |
<span class="c">% Specific element with that variable name</span> |
| 374 |
flower<span class="nb">_</span>bob<span class="nb">_</span>alice=<span class="nb">{</span>draw<span class="nb">_</span>check=true<span class="nb">}</span>, |
| 375 |
<span class="c">% Specific element with variable "var" and value 1</span> |
| 376 |
var<span class="nb">&</span>1=<span class="nb">{</span>draw<span class="nb">_</span>check=true<span class="nb">}</span>, |
| 377 |
<span class="nb">}</span>, |
| 378 |
<span class="c">% Specific questionnaire ID</span> |
| 379 |
testid=<span class="nb">{</span> |
| 380 |
<span class="c">% We need to explicitly unset it again!</span> |
| 381 |
flower<span class="nb">_</span>bob<span class="nb">_</span>alice=<span class="nb">{</span>draw<span class="nb">_</span>check=false<span class="nb">}</span>, |
| 382 |
flower<span class="nb">_</span>adam<span class="nb">_</span>alice=<span class="nb">{</span>draw<span class="nb">_</span>check=true<span class="nb">}</span>, |
| 383 |
<span class="nb">}</span>, |
| 384 |
<span class="nb">}</span> |
| 385 |
<span class="k">\ExplSyntaxOff</span> |
| 386 |
</pre></div> |
| 387 |
</div><div class="content-rendering"> |
| 388 |
<p><img src="_images/sdaps-82e64d3b5db11a81613e2242fc073ca0506aeec4.svg" alt="\begin{choicegroup}[var=flower]{A group of questions with variable "flower"} |
| 389 |
\groupaddchoice[var=alice]{Choice "alice"} |
| 390 |
\groupaddchoice[var=eve]{Choice "eve"} |
| 391 |
\choiceline[var=adam]{Question "adam"} |
| 392 |
\choiceline[var=bob]{Question "bob"} |
| 393 |
\end{choicegroup} |
| 394 |
|
| 395 |
% Force a different questionnaire ID (never do this in a real document!) |
| 396 |
\ExplSyntaxOn |
| 397 |
\sdaps_set_questionnaire_id:n { testid } |
| 398 |
\ExplSyntaxOff |
| 399 |
\begin{choicegroup}[var=flower]{A group of questions with variable "flower"} |
| 400 |
\groupaddchoice[var=alice]{Choice "alice"} |
| 401 |
\groupaddchoice[var=eve]{Choice "eve"} |
| 402 |
\choiceline[var=adam]{Question "adam"} |
| 403 |
\choiceline[var=bob]{Question "bob"} |
| 404 |
\end{choicegroup}" /></p> |
| 405 |
</div><div class="content-metadata"> |
| 406 |
<pre> |
| 407 |
[1]Author=Author |
| 408 |
[2]Title=Title |
| 409 |
[3]SDAPSVersion=1.9.10 |
| 410 |
[4]Duplex=true |
| 411 |
[5]PrintQuestionnaireId=0 |
| 412 |
[6]PageSize=597.50793pt,845.04694pt |
| 413 |
[7]Style=qr |
| 414 |
[8]CheckMode=checkcorrect |
| 415 |
[9]GlobalID= |
| 416 |
[10]GlobalIDLabel= |
| 417 |
[11]CornerMarkMargin=28.45274pt,28.45274pt,34.1433pt,34.1433pt |
| 418 |
[12]QObject-Head=1. A group of questions with variable "flower" |
| 419 |
[13]QObject-Choice=1.1. Question "adam" |
| 420 |
[14]Answer[1.1]=Choice "alice" |
| 421 |
[15]Answer[1.1]=Choice "eve" |
| 422 |
[16]Box[1.1]=Checkbox,0,444.80862pt,699.3666pt,9.95845pt,9.95845pt,box,1.00374pt,flower_adam_alice,1 |
| 423 |
[17]Box[1.1]=Checkbox,0,521.53519pt,699.3666pt,9.95845pt,9.95845pt,box,1.00374pt,flower_adam_eve,2 |
| 424 |
[18]Variable[1.1]=flower_adam |
| 425 |
[19]QObject-Choice=1.2. Question "bob" |
| 426 |
[20]Answer[1.2]=Choice "alice" |
| 427 |
[21]Answer[1.2]=Choice "eve" |
| 428 |
[22]Box[1.2]=Checkbox,0,444.80862pt,685.76659pt,9.95845pt,9.95845pt,box,1.00374pt,flower_bob_alice,1 |
| 429 |
[23]Box[1.2]=Checkbox,0,521.53519pt,685.76659pt,9.95845pt,9.95845pt,box,1.00374pt,flower_bob_eve,2 |
| 430 |
[24]Variable[1.2]=flower_bob |
| 431 |
[25]Variable[1]=flower |
| 432 |
[26]QObject-Head=2. A group of questions with variable "flower" |
| 433 |
[27]QObject-Choice=2.1. Question "adam" |
| 434 |
[28]Answer[2.1]=Choice "alice" |
| 435 |
[29]Answer[2.1]=Choice "eve" |
| 436 |
[30]Box[2.1]=Checkbox,0,444.80862pt,637.89645pt,9.95845pt,9.95845pt,box,1.00374pt,flower_adam_alice,1 |
| 437 |
[31]Box[2.1]=Checkbox,0,521.53519pt,637.89645pt,9.95845pt,9.95845pt,box,1.00374pt,flower_adam_eve,2 |
| 438 |
[32]Variable[2.1]=flower_adam |
| 439 |
[33]QObject-Choice=2.2. Question "bob" |
| 440 |
[34]Answer[2.2]=Choice "alice" |
| 441 |
[35]Answer[2.2]=Choice "eve" |
| 442 |
[36]Box[2.2]=Checkbox,0,444.80862pt,624.29645pt,9.95845pt,9.95845pt,box,1.00374pt,flower_bob_alice,1 |
| 443 |
[37]Box[2.2]=Checkbox,0,521.53519pt,624.29645pt,9.95845pt,9.95845pt,box,1.00374pt,flower_bob_eve,2 |
| 444 |
[38]Variable[2.2]=flower_bob |
| 445 |
[39]Variable[2]=flower |
| 446 |
</pre></div></div><p class="caption">Overriding checkbox color and pre-filled value based on |
| 447 |
questionnaire ID and variables.</p></div></dd></dl> |
| 448 |
|
| 449 |
</div> |
| 450 |
<div class="section" id="the-rendering-subsystem"> |
| 451 |
<h2>The rendering subsystem<a class="headerlink" href="#the-rendering-subsystem" title="Permalink to this headline">¶</a></h2> |
| 452 |
<div class="section" id="checkbox"> |
| 453 |
<h3>Checkbox<a class="headerlink" href="#checkbox" title="Permalink to this headline">¶</a></h3> |
| 454 |
<table class="docutils align-default"> |
| 455 |
<colgroup> |
| 456 |
<col style="width: 14%" /> |
| 457 |
<col style="width: 86%" /> |
| 458 |
</colgroup> |
| 459 |
<thead> |
| 460 |
<tr class="row-odd"><th class="head"><p>Option</p></th> |
| 461 |
<th class="head"><p>Description</p></th> |
| 462 |
</tr> |
| 463 |
</thead> |
| 464 |
<tbody> |
| 465 |
<tr class="row-even"><td><p>linewidth</p></td> |
| 466 |
<td><p>The width of the outline (default: 1bp)</p></td> |
| 467 |
</tr> |
| 468 |
<tr class="row-odd"><td><p>width</p></td> |
| 469 |
<td><p>The width of the checkbox (default 3.5mm)</p></td> |
| 470 |
</tr> |
| 471 |
<tr class="row-even"><td><p>height</p></td> |
| 472 |
<td><p>The height of the checkbox (default: 3.5mm)</p></td> |
| 473 |
</tr> |
| 474 |
<tr class="row-odd"><td><p>form</p></td> |
| 475 |
<td><p>The form, either <cite>box</cite> or <cite>ellipse</cite> (default: <cite>box</cite> for <cite>multichoice</cite> and <cite>ellipse</cite> for <cite>singlechoice</cite>)</p></td> |
| 476 |
</tr> |
| 477 |
<tr class="row-even"><td><p>value</p></td> |
| 478 |
<td><p>The value of the checkbox (for internal use)</p></td> |
| 479 |
</tr> |
| 480 |
<tr class="row-odd"><td><p>fill</p></td> |
| 481 |
<td><p>The colour to fill the checkbox with (default: <cite>white</cite>)</p></td> |
| 482 |
</tr> |
| 483 |
<tr class="row-even"><td><p>draw</p></td> |
| 484 |
<td><p>The colour to draw the checkbox frame with (default: <cite>.</cite>, i.e. current text colour)</p></td> |
| 485 |
</tr> |
| 486 |
<tr class="row-odd"><td><p>draw_check</p></td> |
| 487 |
<td><p>Whether to draw a checkmark on top of the box (default: <cite>false</cite>)</p></td> |
| 488 |
</tr> |
| 489 |
<tr class="row-even"><td><p>centered_text</p></td> |
| 490 |
<td><p>Text to overlay over the checkmark (default: <cite>none</cite>)</p></td> |
| 491 |
</tr> |
| 492 |
<tr class="row-odd"><td><p>text</p></td> |
| 493 |
<td><p>Text to overlay over the checkmark using a minipage (default: <cite>none</cite>)</p></td> |
| 494 |
</tr> |
| 495 |
<tr class="row-even"><td><p>text_align</p></td> |
| 496 |
<td><p>The minipage alignment of the overlay (default: <cite>c</cite>, valid are <cite>c</cite>, <cite>t</cite>, <cite>b</cite>, <cite>s</cite> for center, top, bottom or spread)</p></td> |
| 497 |
</tr> |
| 498 |
<tr class="row-odd"><td><p>text_padding</p></td> |
| 499 |
<td><p>The minipages padding from the outside border of the box (default: <cite>2bp</cite>)</p></td> |
| 500 |
</tr> |
| 501 |
<tr class="row-even"><td><p>ellipse</p></td> |
| 502 |
<td><p>Pass as a short form for <cite>form=ellipse</cite></p></td> |
| 503 |
</tr> |
| 504 |
<tr class="row-odd"><td><p>box</p></td> |
| 505 |
<td><p>Pass as a short form for <cite>form=box</cite></p></td> |
| 506 |
</tr> |
| 507 |
</tbody> |
| 508 |
</table> |
| 509 |
<p>There is only one user facing command to render a checkbox:</p> |
| 510 |
<ul class="simple"> |
| 511 |
<li><p><cite>\sdaps_checkbox:nn</cite> |
| 512 |
The following arguments can be given:</p> |
| 513 |
<ul> |
| 514 |
<li><p>Variable name</p></li> |
| 515 |
<li><p>Value</p></li> |
| 516 |
</ul> |
| 517 |
</li> |
| 518 |
</ul> |
| 519 |
<p>The behaviour of the checkbox should be changed through the context. On a first |
| 520 |
level this works by using <cite>\sdaps_checkbox_set_type:n</cite> and setting either |
| 521 |
<cite>singlechoice</cite> or <cite>multichoice</cite>. Other than that you can also change the style |
| 522 |
for <cite>singlechoice</cite> and <cite>multichoice</cite> through the context and overrides. The |
| 523 |
following example demonstrates the use of context modification.</p> |
| 524 |
<div class="figure"> |
| 525 |
<div class="tabs"> |
| 526 |
<input type="radio" id="tab-code-14" class="tab-code" name="tab-group-14" ><label for="tab-code-14" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-14" class="tab-rendering" name="tab-group-14" checked><label for="tab-rendering-14" class="label-rendering">Result</label><div class="content-code"> |
| 527 |
<div class="highlight"><pre><span></span><span class="k">\noindent</span> |
| 528 |
<span class="k">\ExplSyntaxOn</span> |
| 529 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 530 |
|
| 531 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 532 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> * <span class="nb">}</span> <span class="nb">{</span> linewidth=2bp <span class="nb">}</span> |
| 533 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 534 |
|
| 535 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 536 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> multichoice <span class="nb">}</span> <span class="nb">{</span> fill=red <span class="nb">}</span> |
| 537 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 538 |
|
| 539 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 540 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> * = <span class="nb">{}</span> <span class="nb">}</span> |
| 541 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 542 |
|
| 543 |
|
| 544 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 545 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> multichoice=<span class="nb">{</span>ellipse<span class="nb">}</span> <span class="nb">}</span> |
| 546 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 547 |
|
| 548 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 549 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> * <span class="nb">}</span> <span class="nb">{</span> linewidth=2bp <span class="nb">}</span> |
| 550 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 551 |
|
| 552 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 553 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> multichoice <span class="nb">}</span> <span class="nb">{</span> fill=red <span class="nb">}</span> |
| 554 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 555 |
|
| 556 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 557 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> * = <span class="nb">{}</span> <span class="nb">}</span> |
| 558 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 559 |
|
| 560 |
<span class="k">\newline</span> |
| 561 |
|
| 562 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> * = <span class="nb">{</span> centered<span class="nb">_</span>text = X <span class="nb">}</span>, multichoice = <span class="nb">{</span> width=5mm, height=5mm<span class="nb">}</span> <span class="nb">}</span> |
| 563 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 564 |
|
| 565 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 566 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> * <span class="nb">}</span> <span class="nb">{</span> linewidth=2bp <span class="nb">}</span> |
| 567 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 568 |
|
| 569 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 570 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> checkbox <span class="nb">}</span> <span class="nb">{</span> fill=red <span class="nb">}</span> |
| 571 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 572 |
|
| 573 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 574 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> * = <span class="nb">{}</span> <span class="nb">}</span> |
| 575 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 576 |
|
| 577 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 578 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> multichoice=<span class="nb">{</span>draw<span class="nb">_</span>check<span class="nb">}</span> <span class="nb">}</span> |
| 579 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 580 |
|
| 581 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 582 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> * <span class="nb">}</span> <span class="nb">{</span> linewidth=2bp <span class="nb">}</span> |
| 583 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 584 |
|
| 585 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 586 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn <span class="nb">{</span> multichoice <span class="nb">}</span> <span class="nb">{</span> fill=red <span class="nb">}</span> |
| 587 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 588 |
|
| 589 |
<span class="k">\hspace</span><span class="nb">{</span>1em<span class="nb">}</span> |
| 590 |
<span class="k">\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:n <span class="nb">{</span> * = <span class="nb">{}</span> <span class="nb">}</span> |
| 591 |
<span class="k">\sdaps</span><span class="nb">_</span>checkbox:nn <span class="nb">{}</span> <span class="nb">{}</span> |
| 592 |
|
| 593 |
<span class="k">\ExplSyntaxOff</span> |
| 594 |
</pre></div> |
| 595 |
</div><div class="content-rendering"> |
| 596 |
<p><img src="_images/sdaps-5ef726a659f638b38aabe9893a665cf541e4117b.svg" alt="\noindent |
| 597 |
\ExplSyntaxOn |
| 598 |
\sdaps_checkbox:nn {} {} |
| 599 |
|
| 600 |
\hspace{1em} |
| 601 |
\sdaps_context_append:nn { * } { linewidth=2bp } |
| 602 |
\sdaps_checkbox:nn {} {} |
| 603 |
|
| 604 |
\hspace{1em} |
| 605 |
\sdaps_context_append:nn { multichoice } { fill=red } |
| 606 |
\sdaps_checkbox:nn {} {} |
| 607 |
|
| 608 |
\hspace{1em} |
| 609 |
\sdaps_context_set:n { * = {} } |
| 610 |
\sdaps_checkbox:nn {} {} |
| 611 |
|
| 612 |
|
| 613 |
\hspace{1em} |
| 614 |
\sdaps_context_set:n { multichoice={ellipse} } |
| 615 |
\sdaps_checkbox:nn {} {} |
| 616 |
|
| 617 |
\hspace{1em} |
| 618 |
\sdaps_context_append:nn { * } { linewidth=2bp } |
| 619 |
\sdaps_checkbox:nn {} {} |
| 620 |
|
| 621 |
\hspace{1em} |
| 622 |
\sdaps_context_append:nn { multichoice } { fill=red } |
| 623 |
\sdaps_checkbox:nn {} {} |
| 624 |
|
| 625 |
\hspace{1em} |
| 626 |
\sdaps_context_set:n { * = {} } |
| 627 |
\sdaps_checkbox:nn {} {} |
| 628 |
|
| 629 |
\newline |
| 630 |
|
| 631 |
\sdaps_context_set:n { * = { centered_text = X }, multichoice = { width=5mm, height=5mm} } |
| 632 |
\sdaps_checkbox:nn {} {} |
| 633 |
|
| 634 |
\hspace{1em} |
| 635 |
\sdaps_context_append:nn { * } { linewidth=2bp } |
| 636 |
\sdaps_checkbox:nn {} {} |
| 637 |
|
| 638 |
\hspace{1em} |
| 639 |
\sdaps_context_append:nn { checkbox } { fill=red } |
| 640 |
\sdaps_checkbox:nn {} {} |
| 641 |
|
| 642 |
\hspace{1em} |
| 643 |
\sdaps_context_set:n { * = {} } |
| 644 |
\sdaps_checkbox:nn {} {} |
| 645 |
|
| 646 |
\hspace{1em} |
| 647 |
\sdaps_context_set:n { multichoice={draw_check} } |
| 648 |
\sdaps_checkbox:nn {} {} |
| 649 |
|
| 650 |
\hspace{1em} |
| 651 |
\sdaps_context_append:nn { * } { linewidth=2bp } |
| 652 |
\sdaps_checkbox:nn {} {} |
| 653 |
|
| 654 |
\hspace{1em} |
| 655 |
\sdaps_context_append:nn { multichoice } { fill=red } |
| 656 |
\sdaps_checkbox:nn {} {} |
| 657 |
|
| 658 |
\hspace{1em} |
| 659 |
\sdaps_context_set:n { * = {} } |
| 660 |
\sdaps_checkbox:nn {} {} |
| 661 |
|
| 662 |
\ExplSyntaxOff" /></p> |
| 663 |
</div></div><p class="caption">Example showing modification of the context for checkbox rendering</p></div><div class="admonition-todo admonition" id="id1"> |
| 664 |
<p class="admonition-title">Todo</p> |
| 665 |
<p>It appears the text is not centered correctly.</p> |
| 666 |
</div> |
| 667 |
</div> |
| 668 |
</div> |
| 669 |
</div> |
| 670 |
|
| 671 |
|
| 672 |
<div class="clearer"></div> |
| 673 |
</div> |
| 674 |
</div> |
| 675 |
</div> |
| 676 |
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
| 677 |
<div class="sphinxsidebarwrapper"> |
| 678 |
<h3><a href="index.html">Table of Contents</a></h3> |
| 679 |
<ul> |
| 680 |
<li><a class="reference internal" href="#">sdapsbase package</a><ul> |
| 681 |
<li><a class="reference internal" href="#the-context-subsystem">The context subsystem</a><ul> |
| 682 |
<li><a class="reference internal" href="#handling-context-nesting">Handling context nesting</a></li> |
| 683 |
<li><a class="reference internal" href="#managing-context-variables">Managing context variables</a></li> |
| 684 |
<li><a class="reference internal" href="#defining-questions-and-headings">Defining questions and headings</a></li> |
| 685 |
</ul> |
| 686 |
</li> |
| 687 |
<li><a class="reference internal" href="#overrides">Overrides</a></li> |
| 688 |
<li><a class="reference internal" href="#the-rendering-subsystem">The rendering subsystem</a><ul> |
| 689 |
<li><a class="reference internal" href="#checkbox">Checkbox</a></li> |
| 690 |
</ul> |
| 691 |
</li> |
| 692 |
</ul> |
| 693 |
</li> |
| 694 |
</ul> |
| 695 |
|
| 696 |
<h4>Previous topic</h4> |
| 697 |
<p class="topless"><a href="sdapsarray.html" |
| 698 |
title="previous chapter">sdapsarray package</a></p> |
| 699 |
<div role="note" aria-label="source link"> |
| 700 |
<h3>This Page</h3> |
| 701 |
<ul class="this-page-menu"> |
| 702 |
<li><a href="_sources/sdapsbase.rst.txt" |
| 703 |
rel="nofollow">Show Source</a></li> |
| 704 |
</ul> |
| 705 |
</div> |
| 706 |
<div id="searchbox" style="display: none" role="search"> |
| 707 |
<h3 id="searchlabel">Quick search</h3> |
| 708 |
<div class="searchformwrapper"> |
| 709 |
<form class="search" action="search.html" method="get"> |
| 710 |
<input type="text" name="q" aria-labelledby="searchlabel" /> |
| 711 |
<input type="submit" value="Go" /> |
| 712 |
</form> |
| 713 |
</div> |
| 714 |
</div> |
| 715 |
<script>$('#searchbox').show(0);</script> |
| 716 |
</div> |
| 717 |
</div> |
| 718 |
<div class="clearer"></div> |
| 719 |
</div> |
| 720 |
<div class="related" role="navigation" aria-label="related navigation"> |
| 721 |
<h3>Navigation</h3> |
| 722 |
<ul> |
| 723 |
<li class="right" style="margin-right: 10px"> |
| 724 |
<a href="genindex.html" title="General Index" |
| 725 |
>index</a></li> |
| 726 |
<li class="right" > |
| 727 |
<a href="sdapsarray.html" title="sdapsarray package" |
| 728 |
>previous</a> |</li> |
| 729 |
<li class="nav-item nav-item-0"><a href="index.html">sdaps-class 0.1 documentation</a> »</li> |
| 730 |
<li class="nav-item nav-item-this"><a href="">sdapsbase package</a></li> |
| 731 |
</ul> |
| 732 |
</div> |
| 733 |
<div class="footer" role="contentinfo"> |
| 734 |
© Copyright 2016, Benjamin Berg. |
| 735 |
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3. |
| 736 |
</div> |
| 737 |
</body> |
| 738 |
</html> |