This file is indexed.

/usr/share/doc/python-plastex-doc/html/sect0025.html is in python-plastex-doc 0.9.2-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>plasTeX — A Python Framework for Processing LaTeX Documents: Macro Objects</title>

<link href="module-plasTeX-ConfigManager.html" title="plasTeX.ConfigManager — plasConfiguration" rel="next" />
<link href="module-plasTeX.html" title="plasTeX — The Python Macro and Document Interfaces" rel="prev" />
<link href="module-plasTeX.html" title="plasTeX — The Python Macro and Document Interfaces" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="module-plasTeX.html" title="plasTeX — The Python Macro and Document Interfaces"><img alt="Previous: plasTeX — The Python Macro and Document Interfaces" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="module-plasTeX.html" title="plasTeX — The Python Macro and Document Interfaces"><img alt="Up: plasTeX — The Python Macro and Document Interfaces" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="module-plasTeX-ConfigManager.html" title="plasTeX.ConfigManager — plasTeX Configuration"><img alt="Next: plasTeX.ConfigManager — plasTeX Configuration" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">plasTeX — A Python Framework for Processing LaTeX Documents</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>


<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<div class="breadcrumbs">
<span>
<span>
<a href="index.html">plasTeX — A Python Framework for Processing LaTeX Documents</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0024.html">plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X Frameworks and APIs</a> <b>:</b>
</span>

</span><span>
<span>
<a href="module-plasTeX.html"><tt class="ttfamily">plasTeX</tt> — The Python Macro and Document Interfaces</a> <b>:</b>
</span>

</span><span>

<span>
<b class="current">Macro Objects</b>
</span>
</span>
<hr />
</div>

<div><h2 id="a0000000026">6.1.1 Macro Objects</h2>
<p>   <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><b class="bf">class </b><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">Macro</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000092" id="a0000000092"></a>  The <tt class="ttfamily">Macro</tt> class is the base class for all Python based macros although you will generally want to subclass from <tt class="ttfamily">Command</tt> or <tt class="ttfamily">Environment</tt> in real-world use. There are various attributes and methods that affect how Python macros are parsed, constructed and inserted into the resulting DOM. These are described below. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">args</b></tt></span></dt>
    <dd><p><a name="a0000000093" id="a0000000093"></a> specifies the arguments to the L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X macro and their data types. The <tt class="ttfamily">args</tt> attribute gives you a very simple, yet extremely powerful way of parsing L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X macro arguments and converting them into Python objects. Once parsed, each L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X macro argument is set in the <tt class="ttfamily">attributes</tt> dictionary of the Python instance using the name given in the <tt class="ttfamily">args</tt> string. For example, the following <tt class="ttfamily">args</tt> string will direct plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X to parse two mandatory arguments, ‘id’ and ‘title’, and put them into the <tt class="ttfamily">attributes</tt> dictonary. </p><pre>
args = 'id title'
</pre><p>You can also parse optional arguments, usually surrounded by square brackets ([ ]). However, in plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X, any arguments specified in the <tt class="ttfamily">args</tt> string that aren’t mandatory (i.e. no braces surrounding it) are automatically considered optional. This may not truly be the case, but it doesn’t make much difference. If they truly are mandatory, then your L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X source file will always have them and plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X will simply always find them even though it considers them to be optional. </p><p>Optional arguments in the <tt class="ttfamily">args</tt> string are surround by matching square brackets ([ ]), angle brackets (&lt; &gt;), or parentheses (( )). The name for the attribute is placed between the matching symbols as follows: </p><pre>
args = '[ toc ] title'
args = '( position ) object'
args = '&lt; markup &gt; ref'
</pre><p> You can have as many optional arguments as you wish. It is also possible to have optional arguments using braces ({ }), but this requires you to change T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X’s category codes and is not common. </p><p>Modifiers such as asterisks (*) are also allowed in the <tt class="ttfamily">args</tt> string. You can also use the plus (+) and minus (-) signs as modifiers although these are not common. Using modifiers can affect the incrementing of counters (see the <tt class="ttfamily">parse()</tt> method for more information). </p><p>In addition to specifying which arguments to parse, you can also specify what the data type should be. By default, all arguments are processed and stored as document fragments. However, some arguments may be simpler than that. They may contain an integer, a string, an ID, etc. Others may be collections like a list or dictionary. There are even more esoteric types for mostly internal use that allow you to get unexpanded tokens, T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X dimensions, and the like. Regardless, all of these directives are specified in the same way, using the typecast operator: ‘:’. To cast an argument, simply place a colon (:) and the name of the argument type immediately after the name of the argument. The following example casts the ‘filename’ argument to a string. </p><pre>
args = 'filename:str'
</pre><p>Parsing compound arguments such as lists and dictionaries is very similar. </p><pre>
args = 'filenames:list'
</pre><p> By default, compound arguments are assumed to be comma separated. If you are using a different separator, it is specified in parentheses after the type. </p><pre>
args = 'filenames:list(;)'
</pre><p> Again, each element element in the list, by default, is a document fragment. However, you can also give the data type of the elements with another typecast. </p><pre>
args = 'filenames:list(;):str'
</pre><p>Parsing dictionaries is a bit more restrictive. plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X assumes that dictionary arguments are always key-value pairs, that the key is always a string and the separator between the key and value is an equals sign (=). Other than that, they operate in the same manner. </p><p>A full list of the supported data types as well as more examples are discussed in section <a href="sec-macros.html">4</a>. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">argSource</b></tt></span></dt>
    <dd><p><a name="a0000000094" id="a0000000094"></a> the source for the L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X arguments to this macro. This is a read-only attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">arguments</b></tt></span></dt>
    <dd><p><a name="a0000000095" id="a0000000095"></a> gives the arguments in the <tt class="ttfamily">args</tt> attribute in object form (i.e. <tt class="ttfamily">Argument</tt> objects). <b class="bf">Note:</b> This is a read-only attribute. <b class="bf">Note:</b> This is generally an internal-use-only attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">blockType</b></tt></span></dt>
    <dd><p><a name="a0000000096" id="a0000000096"></a> indicates whether the macro node should be considered a block-level element. If true, this node will be put into its own paragraph node (which also has the <tt class="ttfamily">blockType</tt> set to <span class="rmfamily"><i class="itshape">True</i></span>) to make it easier to generate output that requires block-level to exist outside of paragraphs. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">counter</b></tt></span></dt>
    <dd><p><a name="a0000000097" id="a0000000097"></a> specifies the name of the counter to associate with this macro. Each time an instance of this macro is created, this counter is incremented. The incrementing of this counter, of course, resets any “child” counters just like in L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X. By default and L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X convention, if the macro’s first argument is an asterisk (i.e. *), the counter is not incremented. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">id</b></tt></span></dt>
    <dd><p><a name="a0000000098" id="a0000000098"></a> specifies a unique ID for the object. If the object has an associated label (i.e. \<tt class="ttfamily">label</tt>), that is its ID. You can also set the ID manually. Otherwise, an ID will be generated based on the result of Python’s <tt class="ttfamily">id()</tt> function. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">idref</b></tt></span></dt>
    <dd><p><a name="a0000000099" id="a0000000099"></a> a dictionary containing all of the objects referenced by “idref” type arguments. Each idref attribute is stored under the name of the argument in the <tt class="ttfamily">idref</tt> dictionary. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">level</b></tt></span></dt>
    <dd><p><a name="a0000000100" id="a0000000100"></a> specifies the hierarchical level of the node in the DOM. For most macros, this will be set to <tt class="ttfamily">Node.COMMAND_LEVEL</tt> or <tt class="ttfamily">Node.ENVIRONMENT_LEVEL</tt> by the <tt class="ttfamily">Command</tt> and <tt class="ttfamily">Environment</tt> macros, respectively. However, there are other levels that invoke special processing. In particular, sectioning commands such as \<tt class="ttfamily">section</tt> and \<tt class="ttfamily">subsection</tt> have levels set to <tt class="ttfamily">Node.SECTION_LEVEL</tt> and <tt class="ttfamily">Node.SUBSECTION_LEVEL</tt>. These levels assist in the building of an appropriate DOM. Unless you are creating a sectioning command or a command that should act like a paragraph, you should leave the value of this attribute alone. See section <a href="module-plasTeX-DOM.html">6.3</a> for more information. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">macroName</b></tt></span></dt>
    <dd><p><a name="a0000000101" id="a0000000101"></a> specifies the name of the L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X macro that this class corresponds to. By default, the Python class name is the name that is used, but there are some legal L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X macro names that are not legal Python class names. In those cases, you would use <tt class="ttfamily">macroName</tt> to specify the correct name. Below is an example. </p><pre>
class _illegalname(Command):
    macroName = '@illegalname'
</pre><p> <b class="bf">Note:</b> This is a class attribute, not an instance attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">macroMode</b></tt></span></dt>
    <dd><p><a name="a0000000102" id="a0000000102"></a> specifies what the current parsing mode is for this macro. Macro classes are instantiated for every invocation including each \<tt class="ttfamily">begin</tt> and \<tt class="ttfamily">end</tt>. This attribute is set to <tt class="ttfamily">Macro.MODE_NONE</tt> for normal commands, <tt class="ttfamily">Macro.MODE_BEGIN</tt> for the beginning of an environment, and <tt class="ttfamily">Macro.MODE_END</tt> for the end of an environment. </p><p>These attributes are used in the <tt class="ttfamily">invoke()</tt> method to determine the scope of macros used within the environment. They are also used in printing the source of the macro in the <tt class="ttfamily">source</tt> attribute. Unless you really know what you are doing, this should be treated as a read-only attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">mathMode</b></tt></span></dt>
    <dd><p><a name="a0000000103" id="a0000000103"></a> boolean that indicates that the macro is in T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X’s “math mode.” This is a read-only attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">nodeName</b></tt></span></dt>
    <dd><p><a name="a0000000104" id="a0000000104"></a> the name of the node in the DOM. This will either be the name given in <tt class="ttfamily">macroName</tt>, if defined, or the name of the class itself. <b class="bf">Note:</b> This is a read-only attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">ref</b></tt></span></dt>
    <dd><p><a name="a0000000105" id="a0000000105"></a> specifies the value to return when this macro is referenced (i.e. \<tt class="ttfamily">ref</tt>). This is set automatically when the counter associated with the macro is incremented. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">source</b></tt></span></dt>
    <dd><p><a name="a0000000106" id="a0000000106"></a> specifies the L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X source that was parsed to create the object. This is most useful in the renderer if you need to generate an image of a document node. You can simply retrieve the L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X source from this attribute, create a L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X document including the source, then convert the DVI file to the appropriate image type. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">style</b></tt></span></dt>
    <dd><p><a name="a0000000107" id="a0000000107"></a> specifies style overrides, in CSS format, that should be applied to the output. This object is a dictionary, so style property names are given as the key and property values are given as the values. </p><pre>
inst.style['color'] = 'red'
inst.style['background-color'] = 'blue'
</pre><p> <b class="bf">Note:</b> Not all renderers are going to support CSS styles. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">tagName</b></tt></span></dt>
    <dd><p><a name="a0000000108" id="a0000000108"></a> same as <tt class="ttfamily">nodeName</tt> </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd> </dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">title</b></tt></span></dt>
    <dd><p><a name="a0000000109" id="a0000000109"></a> specifies the title of the current object. If the attributes dictionary contains a title, that object is returned. An <tt class="ttfamily">AttributeError</tt> is thrown if there is no ‘title’ key in that dictionary. A title can also be set manually by setting this attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">digest</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tokens</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000110" id="a0000000110"></a> absorb the tokens from the given output stream that belong to the current object. In most commands, this does nothing. However, L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X environments have a \<tt class="ttfamily">begin</tt> and an \<tt class="ttfamily">end</tt> that surround content that belong to them. In this case, these environments need to absorb those tokens and construct them into the appropriate document object model (see the <tt class="ttfamily">Environment</tt> class for more information). </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">digestUntil</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tokens, endclass</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000111" id="a0000000111"></a> utility method to help macros like lists and tables digest their contents. In lists and tables, the items, rows, and cells are delimited by \<tt class="ttfamily">begin</tt> and \<tt class="ttfamily">end</tt> tokens. They are simply delimited by the occurrence of another item, row, or cell. This method allows you to absorb tokens until a particular class is reached. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">expand</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000112" id="a0000000112"></a> the <tt class="ttfamily">expand</tt> method is a thin wrapper around the <tt class="ttfamily">invoke</tt> method. The <tt class="ttfamily">expand</tt> method makes sure that all tokens are expanded and will not return a <span class="rmfamily"><i class="itshape">None</i></span> value like <tt class="ttfamily">invoke</tt>. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">invoke</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000113" id="a0000000113"></a> invakes the macro. Invoking the macro, in the general case, includes creating a new context, parsing the options of the macro, and removing the context. L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X environments are slightly different. If <tt class="ttfamily">macroMode</tt> is set to <tt class="ttfamily">Macro.MODE_BEGIN</tt>, the new context is kept on the stack. If <tt class="ttfamily">macroMode</tt> is set to <tt class="ttfamily">Macro.MODE_END</tt>, no arguments are parsed, the context is simply popped. For most macros, the default implementation will work fine. </p><p>The return value for this method is generally <span class="rmfamily"><i class="itshape">None</i></span> (an empty return statement or simply no return statement). In this case, the current object is simply put into the resultant output stream. However, you can also return a list of tokens. In this case, the returned tokens will be put into the output stream in place of the current object. You can even return an empty list to indicate that you don’t want anything to be inserted into the output stream. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">locals</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000114" id="a0000000114"></a> retrieves all of the L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X macros that belong to the scope of the current Python based macro. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">paragraphs</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">force=True</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000115" id="a0000000115"></a> group content into paragraphs. Paragraphs are grouped once all other content has been <tt class="ttfamily">digest</tt>ed. The paragraph grouping routine works like T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X’s, in that environments are included inside paragraphs. This is unlike HTML’s model, where lists and tables are not included inside paragraphs. The <span class="rmfamily"><i class="itshape">force</i></span> argument allows you to decide whether or not paragraphs should be forced. By default, all content of the node is grouped into paragraphs whether or not the content originally contained a paragraph node. However, with <span class="rmfamily"><i class="itshape">force</i></span> set to <span class="rmfamily"><i class="itshape">False</i></span>, a node will only be grouped into paragraphs if the original content contained at least one paragraph node. </p><p>Even though the paragraph method follow’s T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X’s model, it is still possible to generate valid HTML content. Any node with the <span class="rmfamily"><i class="itshape">blockType</i></span> attribute set to <span class="rmfamily"><i class="itshape">True</i></span> is considered to be a block-level node. This means that it will be contained in its own paragraph node. This paragraph node will also have the <span class="rmfamily"><i class="itshape">blockType</i></span> attribute set to <span class="rmfamily"><i class="itshape">True</i></span> so that in the renderer the paragraph can be inserted or ignored based on this attribute. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">parse</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000116" id="a0000000116"></a> parses the arguments defined in the <tt class="ttfamily">args</tt> attribute from the given token stream. This method also calls several hooks as described in the table below. </p><p><center><table cellspacing="0" class="tabular">
<tr>

    
    <td style="text-align:left; border-right:1px solid black"><p><b class="bf">Method Name</b>&amp;<b class="bf">Description</b> </p></td>

</tr><tr>

    
    <td style="border-top-style:solid; text-align:left; border-top-color:black; border-top-width:1px; border-right:1px solid black"><p> <tt class="ttfamily">preParse()</tt>&amp;called at the beginning of the argument parsing process</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black"><p><tt class="ttfamily">preArgument()</tt>&amp;called before parsing each argument</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black"><p><tt class="ttfamily">postArgument()</tt>&amp;called after parsing each argument</p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black"><p><tt class="ttfamily">postParse()</tt>&amp;called at the end of the argument parsing process</p></td>

</tr>
</table></center> </p><p>The methods are called to assist in labeling and counting. For example, by default, the counter associated with a macro is automatically incremented when the macro is parsed. However, if the first argument is a modifier (i.e. *, +, -), the counter will not be incremented. This is handled in the <tt class="ttfamily">preArgument()</tt> and <tt class="ttfamily">postArgument()</tt> methods. </p><p>Each time an argument is parsed, the result is put into the <tt class="ttfamily">attributes</tt> dictionary. The key in the dictionary is, of course, the name given to that argument in the <tt class="ttfamily">args</tt> string. Modifiers such as *, +, and - are stored under the special key ‘*modifier*’. </p><p>The return value for this method is simply a reference to the <tt class="ttfamily">attributes</tt> dictionary. </p><p><b class="bf">Note:</b> If <tt class="ttfamily">parse()</tt> is called on an instance with <tt class="ttfamily">macroMode</tt> set to <tt class="ttfamily">Macro.MODE_END</tt>, no parsing takes place. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">postArgument</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">arg, tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000117" id="a0000000117"></a> called after parsing each argument. This is generally where label and counter mechanisms are handled. </p><p><span class="rmfamily"><i class="itshape">arg</i></span> is the Argument instance that holds all argument meta-data including the argument’s name, source, and options. </p><p><span class="rmfamily"><i class="itshape">tex</i></span> is the TeX instance containing the current context </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">postParse</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000118" id="a0000000118"></a> do any operations required immediately after parsing the arguments. This generally includes setting up the value that will be returned when referencing the object. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">preArgument</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">arg, tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000119" id="a0000000119"></a> called before parsing each argument. This is generally where label and counter mechanisms are handled. </p><p><span class="rmfamily"><i class="itshape">arg</i></span> is the Argument instance that holds all argument meta-data including the argument’s name, source, and options. </p><p><span class="rmfamily"><i class="itshape">tex</i></span> is the TeX instance containing the current context </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">preParse</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000120" id="a0000000120"></a> do any operations required immediately before parsing the arguments. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">refstepcounter</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000121" id="a0000000121"></a> set the object as the current labellable object and increment its counter. When an object is set as the current labellable object, the next \<tt class="ttfamily">label</tt> command will point to that object. </p></dd>

</dl> </p><p>  <dl class="description">

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd>  </dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt></dt>
    <dd></dd>

    <dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">stepcounter</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">tex</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
    <dd><p><a name="a0000000122" id="a0000000122"></a> step the counter associated with the macro </p></dd>

</dl>  </p></div>





<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="module-plasTeX.html" title="plasTeX — The Python Macro and Document Interfaces"><img alt="Previous: plasTeX — The Python Macro and Document Interfaces" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="module-plasTeX.html" title="plasTeX — The Python Macro and Document Interfaces"><img alt="Up: plasTeX — The Python Macro and Document Interfaces" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="module-plasTeX-ConfigManager.html" title="plasTeX.ConfigManager — plasTeX Configuration"><img alt="Next: plasTeX.ConfigManager — plasTeX Configuration" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">plasTeX — A Python Framework for Processing LaTeX Documents</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>


<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>

</body>
</html>