texmodel 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. texmodel/__init__.py +6 -0
  2. texmodel/_internal/__init__.py +1 -0
  3. texmodel/_internal/render.py +323 -0
  4. texmodel/_internal/scan.py +23 -0
  5. texmodel/body.py +364 -0
  6. texmodel/bundle.py +69 -0
  7. texmodel/cli.py +211 -0
  8. texmodel/components.py +757 -0
  9. texmodel/config.py +32 -0
  10. texmodel/drift.py +55 -0
  11. texmodel/errors.py +38 -0
  12. texmodel/package.py +482 -0
  13. texmodel/plan.py +92 -0
  14. texmodel/pointer.py +70 -0
  15. texmodel/preamble.py +110 -0
  16. texmodel/py.typed +0 -0
  17. texmodel/spec.py +235 -0
  18. texmodel/std/__init__.py +37 -0
  19. texmodel/std/adjustbox.py +19 -0
  20. texmodel/std/anyfontsize.py +7 -0
  21. texmodel/std/calc.py +7 -0
  22. texmodel/std/enumitem.py +18 -0
  23. texmodel/std/eso_pic.py +49 -0
  24. texmodel/std/etoolbox.py +127 -0
  25. texmodel/std/fontspec.py +36 -0
  26. texmodel/std/geometry.py +17 -0
  27. texmodel/std/graphicx.py +26 -0
  28. texmodel/std/hyphenat.py +7 -0
  29. texmodel/std/latex.py +516 -0
  30. texmodel/std/microtype.py +27 -0
  31. texmodel/std/pdfrender.py +17 -0
  32. texmodel/std/tcolorbox.py +43 -0
  33. texmodel/std/tikz.py +36 -0
  34. texmodel/std/xcolor.py +47 -0
  35. texmodel/testing.py +297 -0
  36. texmodel/types.py +264 -0
  37. texmodel-0.2.0.dist-info/METADATA +525 -0
  38. texmodel-0.2.0.dist-info/RECORD +61 -0
  39. texmodel-0.2.0.dist-info/WHEEL +4 -0
  40. texmodel-0.2.0.dist-info/entry_points.txt +9 -0
  41. texmodel-0.2.0.dist-info/licenses/LICENSE +21 -0
  42. texmodel_build/__init__.py +10 -0
  43. texmodel_build/_internal/__init__.py +1 -0
  44. texmodel_build/_internal/converge.py +19 -0
  45. texmodel_build/_internal/env.py +42 -0
  46. texmodel_build/_internal/logparse.py +170 -0
  47. texmodel_build/_internal/proofpdf.py +52 -0
  48. texmodel_build/_internal/spawn.py +36 -0
  49. texmodel_build/_internal/styscan.py +37 -0
  50. texmodel_build/cli.py +349 -0
  51. texmodel_build/compiler.py +341 -0
  52. texmodel_build/config.py +58 -0
  53. texmodel_build/diagnostics.py +225 -0
  54. texmodel_build/engines.py +35 -0
  55. texmodel_build/errors.py +17 -0
  56. texmodel_build/py.typed +0 -0
  57. texmodel_build/result.py +65 -0
  58. texmodel_build/roots.py +41 -0
  59. texmodel_build/targets.py +43 -0
  60. texmodel_build/testkit.py +59 -0
  61. texmodel_build/verify.py +158 -0
texmodel/std/latex.py ADDED
@@ -0,0 +1,516 @@
1
+ r"""latex: The LaTeX kernel: commands every document has without loading a package.
2
+
3
+ A header (the package is adopted): it declares the interface, `texmodel` writes calls and never the package."""
4
+
5
+ from texmodel.components import Anywhere, Command, Environment, Passthrough
6
+ from texmodel.package import Package
7
+ from texmodel.types import Raw, Text
8
+
9
+ package = Package("latex", prefix="", adopted=True, builtin=True)
10
+
11
+
12
+ @package.command
13
+ class SetLength(Command):
14
+ r"""Set a length: `\setlength{\parindent}{0pt}`."""
15
+
16
+ cs = "setlength"
17
+ length: Raw
18
+ value: Raw
19
+
20
+
21
+ @package.command
22
+ class AddToLength(Command):
23
+ r"""Add to a length."""
24
+
25
+ cs = "addtolength"
26
+ length: Raw
27
+ value: Raw
28
+
29
+
30
+ @package.command
31
+ class NewLength(Command):
32
+ r"""Declare a length."""
33
+
34
+ cs = "newlength"
35
+ length: Raw
36
+
37
+
38
+ @package.command
39
+ class SetToWidth(Command):
40
+ r"""Set a length to the width of some text."""
41
+
42
+ cs = "settowidth"
43
+ length: Raw
44
+ text: Raw
45
+
46
+
47
+ @package.command
48
+ class SetToHeight(Command):
49
+ r"""Set a length to the height of some text."""
50
+
51
+ cs = "settoheight"
52
+ length: Raw
53
+ text: Raw
54
+
55
+
56
+ @package.command
57
+ class SetToDepth(Command):
58
+ r"""Set a length to the depth of some text."""
59
+
60
+ cs = "settodepth"
61
+ length: Raw
62
+ text: Raw
63
+
64
+
65
+ @package.command
66
+ class NewCounter(Command):
67
+ r"""Declare a counter."""
68
+
69
+ cs = "newcounter"
70
+ name: Raw
71
+
72
+
73
+ @package.command
74
+ class SetCounter(Command):
75
+ r"""Set a counter."""
76
+
77
+ cs = "setcounter"
78
+ name: Raw
79
+ value: Raw
80
+
81
+
82
+ @package.command
83
+ class StepCounter(Command):
84
+ r"""Add one to a counter."""
85
+
86
+ cs = "stepcounter"
87
+ name: Raw
88
+
89
+
90
+ @package.command
91
+ class Arabic(Command):
92
+ r"""Write a counter in arabic numerals."""
93
+
94
+ cs = "arabic"
95
+ name: Raw
96
+
97
+
98
+ @package.command
99
+ class CounterValue(Command):
100
+ r"""The value of a counter, for arithmetic."""
101
+
102
+ cs = "value"
103
+ name: Raw
104
+
105
+
106
+ @package.command
107
+ class VSpace(Command):
108
+ r"""Vertical space."""
109
+
110
+ cs = "vspace"
111
+ length: Raw
112
+
113
+
114
+ @package.command
115
+ class HSpace(Command):
116
+ r"""Horizontal space."""
117
+
118
+ cs = "hspace"
119
+ length: Raw
120
+
121
+
122
+ @package.command
123
+ class NoIndent(Command):
124
+ r"""Start a paragraph without indentation."""
125
+
126
+ cs = "noindent"
127
+
128
+
129
+ @package.command
130
+ class Par(Command):
131
+ r"""End the paragraph."""
132
+
133
+ cs = "par"
134
+
135
+
136
+ @package.command
137
+ class ClearPage(Command):
138
+ r"""End the page and flush floats."""
139
+
140
+ cs = "clearpage"
141
+
142
+
143
+ @package.command
144
+ class NewPage(Command):
145
+ r"""End the page."""
146
+
147
+ cs = "newpage"
148
+
149
+
150
+ @package.command
151
+ class ThisPageStyle(Command):
152
+ r"""Page style of the current page."""
153
+
154
+ cs = "thispagestyle"
155
+ style: Raw
156
+
157
+
158
+ @package.command
159
+ class PageStyle(Command):
160
+ r"""Page style from here on."""
161
+
162
+ cs = "pagestyle"
163
+ style: Raw
164
+
165
+
166
+ @package.command
167
+ class Null(Command):
168
+ r"""An empty box, so a page has content."""
169
+
170
+ cs = "null"
171
+
172
+
173
+ @package.command
174
+ class IgnoreSpaces(Command):
175
+ r"""Skip the spaces that follow."""
176
+
177
+ cs = "ignorespaces"
178
+
179
+
180
+ @package.command
181
+ class FrenchSpacing(Command):
182
+ r"""Equal space after every sentence."""
183
+
184
+ cs = "frenchspacing"
185
+
186
+
187
+ @package.command
188
+ class FontSize(Command):
189
+ r"""Font size and line skip, in effect after `\selectfont`."""
190
+
191
+ cs = "fontsize"
192
+ size: Raw
193
+ skip: Raw
194
+
195
+
196
+ @package.command
197
+ class SelectFont(Command):
198
+ r"""Apply the font settings made so far."""
199
+
200
+ cs = "selectfont"
201
+
202
+
203
+ @package.command
204
+ class Bfseries(Command):
205
+ r"""Bold, from here to the end of the group."""
206
+
207
+ cs = "bfseries"
208
+
209
+
210
+ @package.command
211
+ class Centering(Command):
212
+ r"""Centre the paragraphs of the group."""
213
+
214
+ cs = "centering"
215
+
216
+
217
+ @package.command
218
+ class Tiny(Command):
219
+ r"""Size `\tiny`."""
220
+
221
+ cs = "tiny"
222
+
223
+
224
+ @package.command
225
+ class ScriptSize(Command):
226
+ r"""Size `\scriptsize`."""
227
+
228
+ cs = "scriptsize"
229
+
230
+
231
+ @package.command
232
+ class FootnoteSize(Command):
233
+ r"""Size `\footnotesize`."""
234
+
235
+ cs = "footnotesize"
236
+
237
+
238
+ @package.command
239
+ class Small(Command):
240
+ r"""Size `\small`."""
241
+
242
+ cs = "small"
243
+
244
+
245
+ @package.command
246
+ class NormalSize(Command):
247
+ r"""Size `\normalsize`."""
248
+
249
+ cs = "normalsize"
250
+
251
+
252
+ @package.command
253
+ class Large(Command):
254
+ r"""Size `\large` (lowercase)."""
255
+
256
+ cs = "large"
257
+
258
+
259
+ @package.command
260
+ class LargeCap(Command):
261
+ r"""Size `\Large`."""
262
+
263
+ cs = "Large"
264
+
265
+
266
+ @package.command
267
+ class LargeAllCaps(Command):
268
+ r"""Size `\LARGE`."""
269
+
270
+ cs = "LARGE"
271
+
272
+
273
+ @package.command
274
+ class Huge(Command):
275
+ r"""Size `\huge` (lowercase)."""
276
+
277
+ cs = "huge"
278
+
279
+
280
+ @package.command
281
+ class HugeCap(Command):
282
+ r"""Size `\Huge`."""
283
+
284
+ cs = "Huge"
285
+
286
+
287
+ @package.command
288
+ class TextBold(Command):
289
+ r"""Bold text."""
290
+
291
+ cs = "textbf"
292
+ text: Text
293
+
294
+
295
+ @package.command
296
+ class TextItalic(Command):
297
+ r"""Italic text."""
298
+
299
+ cs = "textit"
300
+ text: Text
301
+
302
+
303
+ @package.command
304
+ class Emph(Command):
305
+ r"""Emphasised text."""
306
+
307
+ cs = "emph"
308
+ text: Text
309
+
310
+
311
+ @package.command
312
+ class MakeUppercase(Command):
313
+ r"""Upper-case text."""
314
+
315
+ cs = "MakeUppercase"
316
+ text: Text
317
+
318
+
319
+ @package.command
320
+ class FpEval(Command):
321
+ r"""A floating-point expression, evaluated where it expands: `\fpeval{round(3*2.5, 1)}`."""
322
+
323
+ cs = "fpeval"
324
+ expr: Raw
325
+
326
+
327
+ @package.command
328
+ class Phantom(Command):
329
+ r"""Space the size of the text, with nothing in it."""
330
+
331
+ cs = "phantom"
332
+ text: Raw
333
+
334
+
335
+ @package.command
336
+ class VPhantom(Command):
337
+ r"""Vertical space the size of the text."""
338
+
339
+ cs = "vphantom"
340
+ text: Raw
341
+
342
+
343
+ @package.command
344
+ class TextBullet(Command):
345
+ r"""A bullet."""
346
+
347
+ cs = "textbullet"
348
+
349
+
350
+ @package.command
351
+ class TextQuoteLeft(Command):
352
+ r"""A left single quote."""
353
+
354
+ cs = "textquoteleft"
355
+
356
+
357
+ @package.command
358
+ class TextQuoteRight(Command):
359
+ r"""A right single quote."""
360
+
361
+ cs = "textquoteright"
362
+
363
+
364
+ @package.command
365
+ class TextQuoteDblLeft(Command):
366
+ r"""A left double quote."""
367
+
368
+ cs = "textquotedblleft"
369
+
370
+
371
+ @package.command
372
+ class TextQuoteDblRight(Command):
373
+ r"""A right double quote."""
374
+
375
+ cs = "textquotedblright"
376
+
377
+
378
+ @package.command
379
+ class NewSaveBox(Command):
380
+ r"""Declare a box register."""
381
+
382
+ cs = "newsavebox"
383
+ box: Raw
384
+
385
+
386
+ @package.command
387
+ class UseBox(Command):
388
+ r"""Typeset a saved box."""
389
+
390
+ cs = "usebox"
391
+ box: Raw
392
+
393
+
394
+ @package.command
395
+ class AtBeginDocument(Command):
396
+ r"""Run code at `\begin{document}`."""
397
+
398
+ cs = "AtBeginDocument"
399
+ code: Raw
400
+
401
+
402
+ @package.command
403
+ class AtEndDocument(Command):
404
+ r"""Run code at `\end{document}`."""
405
+
406
+ cs = "AtEndDocument"
407
+ code: Raw
408
+
409
+
410
+ @package.command
411
+ class PackageError(Command):
412
+ r"""Stop with a package's error."""
413
+
414
+ cs = "PackageError"
415
+ package: Raw
416
+ message: Raw
417
+ help: Raw
418
+
419
+
420
+ @package.command
421
+ class PackageWarning(Command):
422
+ r"""A package's warning, with the input line."""
423
+
424
+ cs = "PackageWarning"
425
+ package: Raw
426
+ message: Raw
427
+
428
+
429
+ @package.command
430
+ class PackageWarningNoLine(Command):
431
+ r"""A package's warning, without the input line."""
432
+
433
+ cs = "PackageWarningNoLine"
434
+ package: Raw
435
+ message: Raw
436
+
437
+
438
+ @package.command
439
+ class PackageInfo(Command):
440
+ r"""A package's note in the log."""
441
+
442
+ cs = "PackageInfo"
443
+ package: Raw
444
+ message: Raw
445
+
446
+
447
+ @package.command
448
+ class PassOptionsToPackage(Command):
449
+ r"""Options for a package loaded later."""
450
+
451
+ cs = "PassOptionsToPackage"
452
+ options: Raw
453
+ package: Raw
454
+
455
+
456
+ @package.command
457
+ class DeclareOption(Command):
458
+ r"""Declare a package option and what it does."""
459
+
460
+ cs = "DeclareOption"
461
+ option: Raw
462
+ code: Raw
463
+
464
+
465
+ @package.command
466
+ class IfFileExists(Command):
467
+ r"""Choose by whether a file can be found."""
468
+
469
+ cs = "IfFileExists"
470
+ file: Raw
471
+ yes: Raw
472
+ no: Raw
473
+
474
+
475
+ @package.command
476
+ class InputIfFileExists(Command):
477
+ r"""Read a file if it can be found."""
478
+
479
+ cs = "InputIfFileExists"
480
+ file: Raw
481
+ yes: Raw
482
+ no: Raw
483
+
484
+
485
+ @package.environment
486
+ class Center(Environment):
487
+ r"""Centred paragraphs."""
488
+
489
+ cs = "center"
490
+ children = [Anywhere(Passthrough)]
491
+
492
+
493
+ @package.environment
494
+ class FlushLeft(Environment):
495
+ r"""Left-aligned paragraphs."""
496
+
497
+ cs = "flushleft"
498
+ children = [Anywhere(Passthrough)]
499
+
500
+
501
+ @package.environment
502
+ class FlushRight(Environment):
503
+ r"""Right-aligned paragraphs."""
504
+
505
+ cs = "flushright"
506
+ children = [Anywhere(Passthrough)]
507
+
508
+
509
+ @package.environment
510
+ class Minipage(Environment):
511
+ r"""A box of a given width: `\begin{minipage}[t]{5cm}`."""
512
+
513
+ cs = "minipage"
514
+ children = [Anywhere(Passthrough)]
515
+ width: Raw
516
+ position: Raw | None = None
@@ -0,0 +1,27 @@
1
+ r"""microtype: Micro-typography.
2
+
3
+ A header (the package is adopted): it declares the interface, `texmodel` writes calls and never the package."""
4
+
5
+ from texmodel.components import Command
6
+ from texmodel.package import Package
7
+ from texmodel.types import Raw
8
+
9
+ package = Package("microtype", prefix="", adopted=True)
10
+
11
+
12
+ @package.command
13
+ class MicrotypeSetup(Command):
14
+ r"""Change microtype's options after loading."""
15
+
16
+ cs = "microtypesetup"
17
+ options: Raw
18
+
19
+
20
+ @package.command
21
+ class SetProtrusion(Command):
22
+ r"""Protrusion of characters: `\SetProtrusion[name=x]{encoding=*}{A={50,50}}`."""
23
+
24
+ cs = "SetProtrusion"
25
+ set: Raw
26
+ list: Raw
27
+ options: Raw | None = None
@@ -0,0 +1,17 @@
1
+ r"""pdfrender: PDF text rendering modes.
2
+
3
+ A header (the package is adopted): it declares the interface, `texmodel` writes calls and never the package."""
4
+
5
+ from texmodel.components import Command
6
+ from texmodel.package import Package
7
+ from texmodel.types import Raw
8
+
9
+ package = Package("pdfrender", prefix="", adopted=True)
10
+
11
+
12
+ @package.command
13
+ class PdfRender(Command):
14
+ r"""Set text rendering for the group: `\pdfrender{TextRenderingMode=2,LineWidth=0.4pt}`."""
15
+
16
+ cs = "pdfrender"
17
+ options: Raw
@@ -0,0 +1,43 @@
1
+ r"""tcolorbox: Coloured boxes.
2
+
3
+ A header (the package is adopted): it declares the interface, `texmodel` writes calls and never the package."""
4
+
5
+ from texmodel.components import Anywhere, Command, Environment, Passthrough
6
+ from texmodel.package import Package
7
+ from texmodel.types import Raw
8
+
9
+ package = Package("tcolorbox", prefix="", adopted=True)
10
+
11
+
12
+ @package.environment
13
+ class Tcolorbox(Environment):
14
+ r"""A coloured box: `\begin{tcolorbox}[colback=white]`."""
15
+
16
+ cs = "tcolorbox"
17
+ children = [Anywhere(Passthrough)]
18
+ options: Raw | None = None
19
+
20
+
21
+ @package.command
22
+ class TcbUseLibrary(Command):
23
+ r"""Load tcolorbox libraries: `\tcbuselibrary{skins}`."""
24
+
25
+ cs = "tcbuselibrary"
26
+ libraries: Raw
27
+
28
+
29
+ @package.command
30
+ class TcbSet(Command):
31
+ r"""Set tcolorbox keys."""
32
+
33
+ cs = "tcbset"
34
+ options: Raw
35
+
36
+
37
+ @package.command
38
+ class Tcbox(Command):
39
+ r"""A coloured box around some text, sized to it."""
40
+
41
+ cs = "tcbox"
42
+ text: Raw
43
+ options: Raw | None = None
texmodel/std/tikz.py ADDED
@@ -0,0 +1,36 @@
1
+ r"""tikz: TikZ. Only what fits the model:
2
+ its path commands (`\draw`, `\node`, `\fill`, `\clip`) have their own syntax
3
+ and are written as `Passthrough` or `Raw`.
4
+
5
+ A header (the package is adopted): it declares the interface, `texmodel` writes calls and never the package."""
6
+
7
+ from texmodel.components import Anywhere, Command, Environment, Passthrough
8
+ from texmodel.package import Package
9
+ from texmodel.types import Raw
10
+
11
+ package = Package("tikz", prefix="", adopted=True)
12
+
13
+
14
+ @package.environment
15
+ class Tikzpicture(Environment):
16
+ r"""A TikZ picture; its content is TikZ source."""
17
+
18
+ cs = "tikzpicture"
19
+ children = [Anywhere(Passthrough)]
20
+ options: Raw | None = None
21
+
22
+
23
+ @package.command
24
+ class UseTikzLibrary(Command):
25
+ r"""Load TikZ libraries: `\usetikzlibrary{calc,positioning}`."""
26
+
27
+ cs = "usetikzlibrary"
28
+ libraries: Raw
29
+
30
+
31
+ @package.command
32
+ class TikzSet(Command):
33
+ r"""Set TikZ keys or styles."""
34
+
35
+ cs = "tikzset"
36
+ options: Raw
texmodel/std/xcolor.py ADDED
@@ -0,0 +1,47 @@
1
+ r"""xcolor: Colours.
2
+
3
+ A header (the package is adopted): it declares the interface, `texmodel` writes calls and never the package."""
4
+
5
+ from texmodel.components import Command
6
+ from texmodel.package import Package
7
+ from texmodel.types import Raw, Text
8
+
9
+ package = Package("xcolor", prefix="", adopted=True)
10
+
11
+
12
+ @package.command
13
+ class DefineColor(Command):
14
+ r"""Name a colour: `\definecolor{ink}{HTML}{223344}`."""
15
+
16
+ cs = "definecolor"
17
+ name: Raw
18
+ model: Raw
19
+ spec: Raw
20
+
21
+
22
+ @package.command
23
+ class ColorLet(Command):
24
+ r"""Name a colour by mixing others."""
25
+
26
+ cs = "colorlet"
27
+ name: Raw
28
+ spec: Raw
29
+
30
+
31
+ @package.command
32
+ class Color(Command):
33
+ r"""Switch the text colour: `\color{ink}` or `\color[rgb]{1,0,0}`."""
34
+
35
+ cs = "color"
36
+ name: Raw
37
+ model: Raw | None = None
38
+
39
+
40
+ @package.command
41
+ class TextColor(Command):
42
+ r"""Coloured text: `\textcolor{ink}{words}`."""
43
+
44
+ cs = "textcolor"
45
+ name: Raw
46
+ text: Text
47
+ model: Raw | None = None