/usr/share/doc/python-plastex-doc/html/sect0040.html is in python-plastex-doc 0.9.2-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 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | <!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: Context Objects</title>
<link href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasRendering Framework" rel="next" />
<link href="module-plasTeX-Context.html" title="plasTeX.Context — The Context" rel="prev" />
<link href="module-plasTeX-Context.html" title="plasTeX.Context — The Context" 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-Context.html" title="plasTeX.Context — The TeX Context"><img alt="Previous: plasTeX.Context — The TeX Context" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Context.html" title="plasTeX.Context — The TeX Context"><img alt="Up: plasTeX.Context — The TeX Context" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasTeX Rendering Framework"><img alt="Next: plasTeX.Renderers — The plasTeX Rendering Framework" 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-Context.html"><tt class="ttfamily">plasTeX.Context</tt> — The T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X Context</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">Context Objects</b>
</span>
</span>
<hr />
</div>
<div><h2 id="a0000000041">6.5.1 Context 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">Context</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"><span class="textnormal"><big class="xlarge">[</big></span>load<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000281" id="a0000000281"></a> Instantiate a new context. </p><p>If the <span class="rmfamily"><i class="itshape">load</i></span> argument is set to true, the context will load all of the base macros defined in plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X. This includes all of the macros used in the standard T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X 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 distributions. </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">contexts</b></tt></span></dt>
<dd><p><a name="a0000000282" id="a0000000282"></a> stack of all macro and category code collections currently in the document being processed. The item at index 0 include the global macro set and default category codes. </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">counters</b></tt></span></dt>
<dd><p><a name="a0000000283" id="a0000000283"></a> a dictionary of counters. </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">currentlabel</b></tt></span></dt>
<dd><p><a name="a0000000284" id="a0000000284"></a> the object that is given the label when a \<tt class="ttfamily">label</tt> macro is invoked. </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">isMathMode</b></tt></span></dt>
<dd><p><a name="a0000000285" id="a0000000285"></a> boolean that specifies if we are currently in T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X’s math mode or not. </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">labels</b></tt></span></dt>
<dd><p><a name="a0000000286" id="a0000000286"></a> a dictionary of labels and the objects that they refer to. </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">addGlobal</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">key, value</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000287" id="a0000000287"></a> add a macro <span class="rmfamily"><i class="itshape">value</i></span> with name <span class="rmfamily"><i class="itshape">key</i></span> to the global namespace. </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">addLocal</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">key, value</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000288" id="a0000000288"></a> add a macro <span class="rmfamily"><i class="itshape">value</i></span> with name <span class="rmfamily"><i class="itshape">key</i></span> to the current namespace. </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">append</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"><span class="textnormal"><big class="xlarge">[</big></span>context<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000289" id="a0000000289"></a> same as <tt class="ttfamily">push()</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">catcode</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">char, code</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000290" id="a0000000290"></a> set the category code for a character in the current scope. <span class="rmfamily"><i class="itshape">char</i></span> is the character that will have its category code changed. <span class="rmfamily"><i class="itshape">code</i></span> is the T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X category code (0-15) to change it to. </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">chardef</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name, num</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000291" id="a0000000291"></a> create a new T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X chardef like \<tt class="ttfamily">chardef</tt>. </p><p><span class="rmfamily"><i class="itshape">name</i></span> is the name of the command to create. </p><p><span class="rmfamily"><i class="itshape">num</i></span> is the character number to use. </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">__getitem__</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">key</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000292" id="a0000000292"></a> look through the stack of macros and return the one with the name <span class="rmfamily"><i class="itshape">key</i></span>. The return value is an <em>instance</em> of the requested macro, not a reference to the macro class. This method allows you to use Python’s dictionary syntax to retrieve the item from the context as shown below. </p><pre>
tex.context['section']
</pre></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">importMacros</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">context</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000293" id="a0000000293"></a> import macros from another context into the global namespace. The argument, <span class="rmfamily"><i class="itshape">context</i></span>, must be a dictionary of macros. </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">label</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">label</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000294" id="a0000000294"></a> set the given label to the currently labelable object. An object can only have one label associated with it. </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">let</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">dest, source</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000295" id="a0000000295"></a> create a new T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X let like \<tt class="ttfamily">let</tt>. </p><p><span class="rmfamily"><i class="itshape">dest</i></span> is the command sequence to create. </p><p><span class="rmfamily"><i class="itshape">source</i></span> is the token to set the command sequence equivalent to. </p><p><b class="bfseries">Example</b> </p><pre>
c.let('bgroup', BeginGroup('{'))
</pre></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">loadBaseMacros</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="a0000000296" id="a0000000296"></a> imports all of the base macros defined by plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X. This includes all of the macros specified by the T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X 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 systems. </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">loadLanguage</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">language, document</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000297" id="a0000000297"></a> loads a language package to configure names such as \<tt class="ttfamily">figurename</tt>, \<tt class="ttfamily">tablename</tt>, etc. </p><p><span class="rmfamily"><i class="itshape">language</i></span> is a string containing the name of the language file to load. </p><p><span class="rmfamily"><i class="itshape">document</i></span> is the document object being processed. </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">loadINIPackage</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">inifile</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000298" id="a0000000298"></a> load an INI formatted package file (see section <a href="sec-packages.html">4.3</a> 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">loadPackage</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, file, <span class="textnormal"><big class="xlarge">[</big></span>options<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000299" id="a0000000299"></a> loads 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 package. </p><p><span class="rmfamily"><i class="itshape">tex</i></span> is the T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X processor to use in parsing the package content </p><p><span class="rmfamily"><i class="itshape">file</i></span> is the name of the package to load </p><p><span class="rmfamily"><i class="itshape">options</i></span> is a dictionary containing the options to pass to the package. This generally comes from the optional argument on a \<tt class="ttfamily">usepackage</tt> or \<tt class="ttfamily">documentclass</tt> macro. </p><p>The package being loaded by this method can be one of three type: 1) a native 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 package, 2) a Python package, or 3) an INI formatted file. The Python version of the package is searched for first. If it is found, it is loaded and an INI version of the package is also loaded if it exists. If there is no Python version, the true 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 version of the package is loaded. If there is an INI version of the package in the same directory as 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 version, that file is loaded also. </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">newcommand</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, nargs<span class="textnormal"><big class="xlarge">[</big></span>, definition<span class="textnormal"><big class="xlarge">[</big></span>, opt<span class="textnormal"><big class="xlarge">]</big></span><span class="textnormal"><big class="xlarge">]</big></span><span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000300" id="a0000000300"></a> create a new 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 command like \<tt class="ttfamily">newcommand</tt>. </p><p><span class="rmfamily"><i class="itshape">name</i></span> is the name of the macro to create. </p><p><span class="rmfamily"><i class="itshape">nargs</i></span> is the number of arguments including optional arguments. </p><p><span class="rmfamily"><i class="itshape">definition</i></span> is a string containing the macro definition. </p><p><span class="rmfamily"><i class="itshape">opt</i></span> is a string containing the default optional value. </p><p><b class="bfseries">Examples</b> </p><pre>
c.newcommand('bold', 1, r'\\textbf{#1}')
c.newcommand('foo', 2, r'{\\bf #1#2}', opt='myprefix')
</pre></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">newcount</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, initial<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000301" id="a0000000301"></a> create a new count like \<tt class="ttfamily">newcount</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">newcounter</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name, <span class="textnormal"><big class="xlarge">[</big></span>resetby, initial, format<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000302" id="a0000000302"></a> create a new counter like \<tt class="ttfamily">newcounter</tt>. </p><p><span class="rmfamily"><i class="itshape">name</i></span> is the name of the counter to create. </p><p><span class="rmfamily"><i class="itshape">resetby</i></span> is the counter that, when incremented, will reset the new counter. </p><p><span class="rmfamily"><i class="itshape">initial</i></span> is the initial value for the counter. </p><p><span class="rmfamily"><i class="itshape">format</i></span> is the printed format of the counter. </p><p>In addition to creating a new counter macro, another macro corresponding to the \<tt class="ttfamily">the<span class="rmfamily"><i class="itshape">name</i></span></tt> is created which prints the value of the counter 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. </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">newdef</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, args<span class="textnormal"><big class="xlarge">[</big></span>, definition<span class="textnormal"><big class="xlarge">[</big></span>, local<span class="textnormal"><big class="xlarge">]</big></span><span class="textnormal"><big class="xlarge">]</big></span><span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000303" id="a0000000303"></a> create a new T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X definition like \<tt class="ttfamily">def</tt>. </p><p><span class="rmfamily"><i class="itshape">name</i></span> is the name of the definition to create. </p><p><span class="rmfamily"><i class="itshape">args</i></span> is a string containing the T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X argument profile. </p><p><span class="rmfamily"><i class="itshape">definition</i></span> is a string containing the macro code to expand when the definition is invoked. </p><p><span class="rmfamily"><i class="itshape">local</i></span> is a boolean that specifies that the definition should only exist in the local scope. The default value is true. </p><p><b class="bfseries">Examples</b> </p><pre>
c.newdef('bold', '#1', '{\\bf #1}')
c.newdef('put', '(#1,#2)#3', '\\dostuff{#1}{#2}{#3}')
</pre></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">newdimen</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, initial<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000304" id="a0000000304"></a> create a new dimen like \<tt class="ttfamily">newdimen</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">newenvironment</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, nargs<span class="textnormal"><big class="xlarge">[</big></span>, definition<span class="textnormal"><big class="xlarge">[</big></span>, opt<span class="textnormal"><big class="xlarge">]</big></span><span class="textnormal"><big class="xlarge">]</big></span><span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000305" id="a0000000305"></a> create a new 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 environment like \<tt class="ttfamily">newenvironment</tt>. This works exactly like the <tt class="ttfamily">newcommand()</tt> method, except that the <span class="rmfamily"><i class="itshape">definition</i></span> argument is a two element tuple where the first element is a string containing the macro content to expand at the \<tt class="ttfamily">begin</tt>, and the second element is the macro content to expand at the \<tt class="ttfamily">end</tt>. </p><p><b class="bfseries">Example</b> </p><pre>
c.newenvironment('mylist', 0, (r'\\begin{itemize}', r'\\end{itemize}'))
</pre></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">newif</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, initial<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000306" id="a0000000306"></a> create a new if like \<tt class="ttfamily">newif</tt>. This also creates macros corresponding to \<tt class="ttfamily"><span class="rmfamily"><i class="itshape">name</i></span>true</tt> and \<tt class="ttfamily"><span class="rmfamily"><i class="itshape">name</i></span>false</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">newmuskip</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, initial<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000307" id="a0000000307"></a> create a new muskip like \<tt class="ttfamily">newmuskip</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">newskip</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">name<span class="textnormal"><big class="xlarge">[</big></span>, initial<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000308" id="a0000000308"></a> create a new skip like \<tt class="ttfamily">newskip</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">packages</b></tt></span></dt>
<dd><p><a name="a0000000309" id="a0000000309"></a> a dictionary of 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 packages. The keys are the names of the packages. The values are dictionaries containing the options that were specified when the package was loaded. </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">pop</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"><span class="textnormal"><big class="xlarge">[</big></span>obj<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000310" id="a0000000310"></a> pop the top scope off of the stack. If <span class="rmfamily"><i class="itshape">obj</i></span> is specified, continue to pop scopes off of the context stack until the scope that was originally added by <span class="rmfamily"><i class="itshape">obj</i></span> is found. </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">push</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"><span class="textnormal"><big class="xlarge">[</big></span>context<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000311" id="a0000000311"></a> add a new scope to the stack. If a macro instance <span class="rmfamily"><i class="itshape">context</i></span> is specified, the new scope’s namespace is given by 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">ref</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">obj, label</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000312" id="a0000000312"></a> set up a reference for resolution. </p><p><span class="rmfamily"><i class="itshape">obj</i></span> is the macro object that is doing the referencing. </p><p><span class="rmfamily"><i class="itshape">label</i></span> is the label of the node that <span class="rmfamily"><i class="itshape">obj</i></span> is looking for. </p><p>If the item that <span class="rmfamily"><i class="itshape">obj</i></span> is looking for has already been labeled, the <tt class="ttfamily">idref</tt> attribute of <span class="rmfamily"><i class="itshape">obj</i></span> is set to the abject. Otherwise, the reference is stored away to be resolved later. </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">setVerbatimCatcodes</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="a0000000313" id="a0000000313"></a> set the current set of category codes to the set used for the verbatim environment. </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">whichCode</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">char</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000314" id="a0000000314"></a> return the character code that <span class="rmfamily"><i class="itshape">char</i></span> belongs to. The category codes are the same codes used by T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X and are defined in the <tt class="ttfamily">Token</tt> class. </p></dd>
</dl> </p></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="module-plasTeX-Context.html" title="plasTeX.Context — The TeX Context"><img alt="Previous: plasTeX.Context — The TeX Context" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Context.html" title="plasTeX.Context — The TeX Context"><img alt="Up: plasTeX.Context — The TeX Context" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasTeX Rendering Framework"><img alt="Next: plasTeX.Renderers — The plasTeX Rendering Framework" 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>
|