/usr/share/doc/python-plastex-doc/html/sect0039.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 | <!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: TeX Objects</title>
<link href="module-plasTeX-Context.html" title="plasTeX.Context — The Context" rel="next" />
<link href="module-plasTeX-TeX.html" title="plasTeX.TeX — The Stream" rel="prev" />
<link href="module-plasTeX-TeX.html" title="plasTeX.TeX — The Stream" 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-TeX.html" title="plasTeX.TeX — The TeX Stream"><img alt="Previous: plasTeX.TeX — The TeX Stream" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-TeX.html" title="plasTeX.TeX — The TeX Stream"><img alt="Up: plasTeX.TeX — The TeX Stream" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Context.html" title="plasTeX.Context — The TeX Context"><img alt="Next: plasTeX.Context — The TeX Context" 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-TeX.html"><tt class="ttfamily">plasTeX.TeX</tt> — The T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X Stream</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">TeX Objects</b>
</span>
</span>
<hr />
</div>
<div><h2 id="a0000000040">6.4.1 TeX 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">TeX</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>ownerDocument, file<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000260" id="a0000000260"></a> The <tt class="ttfamily">TeX</tt> class is the central T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X engine that does all of the parsing, invoking of macros, and other document building tasks. You can pass in an owner document if you have a customized document node, or if it contains a customized configuration; otherwise, the default <tt class="ttfamily">TeXDocument</tt> class is instantiated. The <span class="rmfamily"><i class="itshape">file</i></span> argument is the name of 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 file. This file will be searched for using the standard 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 technique and will be read using the default input encoding in the document’s configuration. </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">disableLogging</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="a0000000261" id="a0000000261"></a> disables logging. This is useful if you are using the <tt class="ttfamily">TeX</tt> object within another library and do not want all of the status information to be printed to the screen. </p><p><b class="bf">Note:</b> This is a class method. </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">filename</b></tt></span></dt>
<dd><p><a name="a0000000262" id="a0000000262"></a> the current filename being processed </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">jobname</b></tt></span></dt>
<dd><p><a name="a0000000263" id="a0000000263"></a> the name of the basename at the top of the input stack </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">lineNumber</b></tt></span></dt>
<dd><p><a name="a0000000264" id="a0000000264"></a> the line number of the current file 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">expandTokens</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, normalize=False</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000265" id="a0000000265"></a> expand a list of unexpanded tokens. This method can be used to expand tokens without having them sent to the output stream. The returned value is a <tt class="ttfamily">TeXFragment</tt> populated with the expanded tokens. </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">input</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">source</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000266" id="a0000000266"></a> add a new input source to the input stack. <span class="rmfamily"><i class="itshape">source</i></span> should be a Python file object. This can be used to add additional input sources to the stream after the <tt class="ttfamily">TeX</tt> object has been instantiated. </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">__iter__</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="a0000000267" id="a0000000267"></a> return a generator that iterates through the tokens in the source. This method allows you to treat the <tt class="ttfamily">TeX</tt> stream as an iterable and use it in looping constructs. While the looping is generally handled in the <tt class="ttfamily">parse()</tt> method, you can manually expand the tokens in the source by looping over the <tt class="ttfamily">TeX</tt> object as well. </p><pre>
for tok in TeX(open('myfile.tex')):
print tok
</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">itertokens</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="a0000000268" id="a0000000268"></a> return an iterator that iterates over the unexpanded tokens in the input document. </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">kpsewhich</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</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000269" id="a0000000269"></a> locate the given file in a kpsewhich-like manner. The full path to the file is returned if it is found; otherwise, <span class="rmfamily"><i class="itshape">None</i></span> is returned. <b class="bf">Note:</b> Currently, only the directories listed in the environment variable TEXINPUTS<a name="a0000000270" id="a0000000270"></a><a name="a0000000271" id="a0000000271"></a> are searched. </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">normalize</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="a0000000272" id="a0000000272"></a> joins consecutive text tokens into a string. If the list of tokens contain tokens that are not text tokens, the original list of tokens is returned. </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">output=None</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000273" id="a0000000273"></a> parse the sources currently in the input stack until they are empty. The <span class="rmfamily"><i class="itshape">output</i></span> argument is an optional <tt class="ttfamily">Document</tt> node to put the resulting nodes into. If none is supplied, a <tt class="ttfamily">TeXDocument</tt> instance will be created. The return value is the document from the <span class="rmfamily"><i class="itshape">output</i></span> argument or the instantiated <tt class="ttfamily">TeXDocument</tt> 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">pushToken</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">token</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000274" id="a0000000274"></a> pushes a token back into the input stream to be re-read. </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">pushTokens</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="a0000000275" id="a0000000275"></a> pushes a list of tokens back into the input stream to be re-read. </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">readArgument</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">*args, **kwargs</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000276" id="a0000000276"></a> parse a macro argument without 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 created it. This method is just a thin wrapper around <tt class="ttfamily">readArgumentAndSource</tt>. See that method 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">readArgumentAndSource</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">spec=None, subtype=None, delim=’,’, expanded=False, default=None, parentNode=None, name=None</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000277" id="a0000000277"></a> parse a macro argument. Return the argument and 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 created it. The arguments are described below. </p><p><center><table cellspacing="0" class="tabular">
<tr>
<td style="text-align:left; border-right:1px solid black"><p><b class="bf">Option</b>&<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> <span class="rmfamily"><i class="itshape">spec</i></span>&string containing information about the type of argument to get. If it is ’None’, the next token is returned. If it is a two-character string, a grouping delimited by those two characters is returned (i.e. ’[]’). If it is a single-character string, the stream is checked to see if the next character is the one specified. In all cases, if the specified argument is not found, ’None’ is returned.</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">type</i></span>&data type to cast the argument to. New types can be added to the self.argtypes dictionary. The key should match this ’type’ argument and the value should be a callable object that takes a list of tokens as the first argument and a list of unspecified keyword arguments (i.e. **kwargs) for type specific information such as list delimiters.</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">subtype</i></span>&data type to use for elements of a list or dictionary</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">delim</i></span>&item delimiter for list and dictionary types</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">expanded</i></span>&boolean indicating whether the argument content should be expanded or just returned as an unexpanded text string</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">default</i></span>&value to return if the argument doesn’t exist</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">parentNode</i></span>&the node that the argument belongs to</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p><span class="rmfamily"><i class="itshape">name</i></span>&the name of the argument being parsed</p></td>
</tr>
</table></center> </p><p>The return value is always a two-element tuple. The second value is always a string. However, the first value can take the following values. </p><p><center><table cellspacing="0" class="tabular">
<tr>
<td style="text-align:left; border-right:1px solid black"><p><b class="bf">Value</b>&<b class="bf">Condition</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> None&the requested argument wasn’t found</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p>object of requested type&if <span class="rmfamily"><i class="itshape">type</i></span> was specified</p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black"><p>list of tokens&all other arguments</p></td>
</tr>
</table></center> </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">source</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="a0000000278" id="a0000000278"></a> return 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 representation of the tokens in <span class="rmfamily"><i class="itshape">tokens</i></span> </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">textTokens</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">text</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000279" id="a0000000279"></a> convert a string of text into a series of tokens </p></dd>
</dl> </p></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="module-plasTeX-TeX.html" title="plasTeX.TeX — The TeX Stream"><img alt="Previous: plasTeX.TeX — The TeX Stream" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-TeX.html" title="plasTeX.TeX — The TeX Stream"><img alt="Up: plasTeX.TeX — The TeX Stream" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Context.html" title="plasTeX.Context — The TeX Context"><img alt="Next: plasTeX.Context — The TeX Context" 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>
|