pytex-preprocessor 0.1.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.
- pytex/__init__.py +87 -0
- pytex/commands/__init__.py +51 -0
- pytex/commands/biblatex.py +98 -0
- pytex/commands/builtin.py +598 -0
- pytex/commands/captions.py +56 -0
- pytex/commands/cleveref.py +43 -0
- pytex/commands/colors.py +60 -0
- pytex/commands/conditionals.py +62 -0
- pytex/commands/counters.py +85 -0
- pytex/commands/definitions.py +109 -0
- pytex/commands/floats.py +93 -0
- pytex/commands/font.py +138 -0
- pytex/commands/fontawesome.py +88 -0
- pytex/commands/fontspec.py +75 -0
- pytex/commands/geometry.py +25 -0
- pytex/commands/glossaries.py +126 -0
- pytex/commands/graphics.py +68 -0
- pytex/commands/hooks.py +58 -0
- pytex/commands/hyperref.py +57 -0
- pytex/commands/lengths.py +200 -0
- pytex/commands/listings.py +63 -0
- pytex/commands/mdframed.py +43 -0
- pytex/commands/picture.py +32 -0
- pytex/commands/setspace.py +38 -0
- pytex/commands/tables.py +123 -0
- pytex/helpers/__init__.py +3 -0
- pytex/helpers/coerce.py +13 -0
- pytex/helpers/parenting.py +13 -0
- pytex/helpers/sanitize.py +54 -0
- pytex/helpers/with_package.py +61 -0
- pytex/interface/__init__.py +3 -0
- pytex/interface/control_sequence.py +29 -0
- pytex/interface/package.py +52 -0
- pytex/interface/tex.py +41 -0
- pytex/model/__init__.py +25 -0
- pytex/model/color.py +203 -0
- pytex/model/concat.py +31 -0
- pytex/model/control_sequence.py +72 -0
- pytex/model/document.py +120 -0
- pytex/model/document_class.py +29 -0
- pytex/model/empty.py +19 -0
- pytex/model/environment.py +30 -0
- pytex/model/image.py +137 -0
- pytex/model/include.py +21 -0
- pytex/model/length.py +54 -0
- pytex/model/math.py +401 -0
- pytex/model/package.py +132 -0
- pytex/model/raw.py +61 -0
- pytex/packages.py +221 -0
- pytex/registry.py +49 -0
- pytex_builder/__init__.py +8 -0
- pytex_builder/build.py +175 -0
- pytex_builder/console.py +77 -0
- pytex_builder/render.py +90 -0
- pytex_builder/tectonic.py +370 -0
- pytex_hsrtreport/__init__.py +116 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-Bold.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-BoldItalic.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-Book.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-BookItalic.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-Medium.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-MediumItalic.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-Strong.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-Thin.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Blender/Blender-ThinItalic.ttf +0 -0
- pytex_hsrtreport/assets/fonts/DIN/DIN-Black.ttf +0 -0
- pytex_hsrtreport/assets/fonts/DIN/DIN-Bold.ttf +0 -0
- pytex_hsrtreport/assets/fonts/DIN/DIN-BoldItalic.ttf +0 -0
- pytex_hsrtreport/assets/fonts/DIN/DIN-Italic.ttf +0 -0
- pytex_hsrtreport/assets/fonts/DIN/DIN-Medium.ttf +0 -0
- pytex_hsrtreport/assets/fonts/DIN/DIN-Regular.ttf +0 -0
- pytex_hsrtreport/assets/fonts/Times New Roman.ttf +0 -0
- pytex_hsrtreport/assets/logos/ASTA.svg +79 -0
- pytex_hsrtreport/assets/logos/DUMMY.png +0 -0
- pytex_hsrtreport/assets/logos/DUMMY_FOOT.png +0 -0
- pytex_hsrtreport/assets/logos/ECHO.svg +226 -0
- pytex_hsrtreport/assets/logos/HSRT.pdf +0 -0
- pytex_hsrtreport/assets/logos/INF.pdf +0 -0
- pytex_hsrtreport/assets/logos/STUPA.pdf +0 -0
- pytex_hsrtreport/assets/logos/Skyline.pdf +0 -0
- pytex_hsrtreport/boxes.py +215 -0
- pytex_hsrtreport/citations.py +21 -0
- pytex_hsrtreport/cleveref_names.py +47 -0
- pytex_hsrtreport/colors.py +30 -0
- pytex_hsrtreport/document.py +307 -0
- pytex_hsrtreport/fonts.py +66 -0
- pytex_hsrtreport/glossary.py +61 -0
- pytex_hsrtreport/hyperref_config.py +49 -0
- pytex_hsrtreport/listings.py +90 -0
- pytex_hsrtreport/logos.py +234 -0
- pytex_hsrtreport/pagebreak.py +67 -0
- pytex_hsrtreport/pagesetup.py +33 -0
- pytex_hsrtreport/tex/pagesetup.tex +76 -0
- pytex_hsrtreport/titlepage.py +136 -0
- pytex_hsrtreport/variants.py +24 -0
- pytex_hsrtreport/voting.py +96 -0
- pytex_hsrtreport/watermark.py +63 -0
- pytex_hsrtreport/wordcount.py +33 -0
- pytex_koma/__init__.py +90 -0
- pytex_koma/commands.py +296 -0
- pytex_koma/document.py +138 -0
- pytex_markdown/__init__.py +62 -0
- pytex_markdown/convert.py +271 -0
- pytex_markdown/escape.py +11 -0
- pytex_preprocessor-0.1.0.dist-info/METADATA +82 -0
- pytex_preprocessor-0.1.0.dist-info/RECORD +119 -0
- pytex_preprocessor-0.1.0.dist-info/WHEEL +5 -0
- pytex_preprocessor-0.1.0.dist-info/entry_points.txt +2 -0
- pytex_preprocessor-0.1.0.dist-info/top_level.txt +7 -0
- pytex_protocol/__init__.py +37 -0
- pytex_protocol/convert.py +202 -0
- pytex_protocol/document.py +91 -0
- pytex_protocol/entries.py +96 -0
- pytex_protocol/frontmatter.py +80 -0
- pytex_protocol/header.py +139 -0
- pytex_protocol/shortcodes.py +130 -0
- pytex_protocol/signatures.py +84 -0
- pytex_tikz/__init__.py +25 -0
- pytex_tikz/tikz.py +272 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
from ..interface.tex import TeX
|
|
2
|
+
from ..model.concat import Concat
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..model.environment import Environment
|
|
5
|
+
from ..model.raw import Raw
|
|
6
|
+
from ..registry import Registry
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"Author",
|
|
10
|
+
"BeginAccSupp",
|
|
11
|
+
"Bigskip",
|
|
12
|
+
"Blenderfont",
|
|
13
|
+
"Bold",
|
|
14
|
+
"Center",
|
|
15
|
+
"Centering",
|
|
16
|
+
"Chapter",
|
|
17
|
+
"ChapterStar",
|
|
18
|
+
"Cite",
|
|
19
|
+
"Cleardoublepage",
|
|
20
|
+
"Clearpage",
|
|
21
|
+
"Date",
|
|
22
|
+
"Description",
|
|
23
|
+
"Dinfont",
|
|
24
|
+
"Emph",
|
|
25
|
+
"EndAccSupp",
|
|
26
|
+
"Enumerate",
|
|
27
|
+
"FlushLeft",
|
|
28
|
+
"FlushRight",
|
|
29
|
+
"Footnote",
|
|
30
|
+
"Footnotemark",
|
|
31
|
+
"Footnotetext",
|
|
32
|
+
"Foreach",
|
|
33
|
+
"Group",
|
|
34
|
+
"Hfill",
|
|
35
|
+
"Hspace",
|
|
36
|
+
"Immediate",
|
|
37
|
+
"Include",
|
|
38
|
+
"IncludeOnly",
|
|
39
|
+
"Indent",
|
|
40
|
+
"Input",
|
|
41
|
+
"Inputfile",
|
|
42
|
+
"Italic",
|
|
43
|
+
"Item",
|
|
44
|
+
"Itemize",
|
|
45
|
+
"Label",
|
|
46
|
+
"Linebreak",
|
|
47
|
+
"ListOfFigures",
|
|
48
|
+
"ListOfTables",
|
|
49
|
+
"MakeTitle",
|
|
50
|
+
"Medskip",
|
|
51
|
+
"Nameref",
|
|
52
|
+
"Newglossarystyle",
|
|
53
|
+
"Newline",
|
|
54
|
+
"Newpage",
|
|
55
|
+
"Noindent",
|
|
56
|
+
"Pagebreak",
|
|
57
|
+
"Pagenumbering",
|
|
58
|
+
"Pageref",
|
|
59
|
+
"Paragraph",
|
|
60
|
+
"Part",
|
|
61
|
+
"PartStar",
|
|
62
|
+
"Quotation",
|
|
63
|
+
"Quote",
|
|
64
|
+
"Raggedleft",
|
|
65
|
+
"Raggedright",
|
|
66
|
+
"Ref",
|
|
67
|
+
"Rule",
|
|
68
|
+
"Section",
|
|
69
|
+
"SectionStar",
|
|
70
|
+
"Smallskip",
|
|
71
|
+
"Subparagraph",
|
|
72
|
+
"Subsection",
|
|
73
|
+
"SubsectionStar",
|
|
74
|
+
"Subsubsection",
|
|
75
|
+
"SubsubsectionStar",
|
|
76
|
+
"TableOfContents",
|
|
77
|
+
"Textbf",
|
|
78
|
+
"Textit",
|
|
79
|
+
"Textmd",
|
|
80
|
+
"Textrm",
|
|
81
|
+
"Textsc",
|
|
82
|
+
"Textsf",
|
|
83
|
+
"Textsl",
|
|
84
|
+
"Texttt",
|
|
85
|
+
"Textup",
|
|
86
|
+
"Thanks",
|
|
87
|
+
"Title",
|
|
88
|
+
"Today",
|
|
89
|
+
"Underline",
|
|
90
|
+
"Verb",
|
|
91
|
+
"Verbatim",
|
|
92
|
+
"Verbatiminput",
|
|
93
|
+
"Verse",
|
|
94
|
+
"Vfill",
|
|
95
|
+
"Vspace",
|
|
96
|
+
"Whiledo",
|
|
97
|
+
"Write18",
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _section_like(name: str, title: TeX | str, short: TeX | str | None) -> TeX:
|
|
102
|
+
if short is None:
|
|
103
|
+
return ControlSequence(name, (Parameter(title),))
|
|
104
|
+
return ControlSequence(name, (Parameter(short, optional=True), Parameter(title)))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@Registry.add
|
|
108
|
+
def Part(title: TeX | str, short: TeX | str | None = None) -> TeX:
|
|
109
|
+
return _section_like("part", title, short)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@Registry.add
|
|
113
|
+
def Chapter(title: TeX | str, short: TeX | str | None = None) -> TeX:
|
|
114
|
+
return _section_like("chapter", title, short)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@Registry.add
|
|
118
|
+
def Section(title: TeX | str, short: TeX | str | None = None) -> TeX:
|
|
119
|
+
return _section_like("section", title, short)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@Registry.add
|
|
123
|
+
def Subsection(title: TeX | str, short: TeX | str | None = None) -> TeX:
|
|
124
|
+
return _section_like("subsection", title, short)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@Registry.add
|
|
128
|
+
def Subsubsection(title: TeX | str, short: TeX | str | None = None) -> TeX:
|
|
129
|
+
return _section_like("subsubsection", title, short)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@Registry.add
|
|
133
|
+
def Paragraph(title: TeX | str) -> TeX:
|
|
134
|
+
return ControlSequence("paragraph", (Parameter(title),))
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@Registry.add
|
|
138
|
+
def Subparagraph(title: TeX | str) -> TeX:
|
|
139
|
+
return ControlSequence("subparagraph", (Parameter(title),))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@Registry.add
|
|
143
|
+
def PartStar(title: TeX | str) -> TeX:
|
|
144
|
+
return ControlSequence("part*", (Parameter(title),))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@Registry.add
|
|
148
|
+
def ChapterStar(title: TeX | str) -> TeX:
|
|
149
|
+
return ControlSequence("chapter*", (Parameter(title),))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@Registry.add
|
|
153
|
+
def SectionStar(title: TeX | str) -> TeX:
|
|
154
|
+
return ControlSequence("section*", (Parameter(title),))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@Registry.add
|
|
158
|
+
def SubsectionStar(title: TeX | str) -> TeX:
|
|
159
|
+
return ControlSequence("subsection*", (Parameter(title),))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@Registry.add
|
|
163
|
+
def SubsubsectionStar(title: TeX | str) -> TeX:
|
|
164
|
+
return ControlSequence("subsubsection*", (Parameter(title),))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@Registry.add
|
|
168
|
+
def Textbf(body: TeX | str) -> TeX:
|
|
169
|
+
return ControlSequence("textbf", (Parameter(body),))
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@Registry.add
|
|
173
|
+
def Textit(body: TeX | str) -> TeX:
|
|
174
|
+
return ControlSequence("textit", (Parameter(body),))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@Registry.add
|
|
178
|
+
def Textsl(body: TeX | str) -> TeX:
|
|
179
|
+
return ControlSequence("textsl", (Parameter(body),))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@Registry.add
|
|
183
|
+
def Textsc(body: TeX | str) -> TeX:
|
|
184
|
+
return ControlSequence("textsc", (Parameter(body),))
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@Registry.add
|
|
188
|
+
def Texttt(body: TeX | str) -> TeX:
|
|
189
|
+
return ControlSequence("texttt", (Parameter(body),))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
@Registry.add
|
|
193
|
+
def Textsf(body: TeX | str) -> TeX:
|
|
194
|
+
return ControlSequence("textsf", (Parameter(body),))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@Registry.add
|
|
198
|
+
def Textrm(body: TeX | str) -> TeX:
|
|
199
|
+
return ControlSequence("textrm", (Parameter(body),))
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@Registry.add
|
|
203
|
+
def Textmd(body: TeX | str) -> TeX:
|
|
204
|
+
return ControlSequence("textmd", (Parameter(body),))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
@Registry.add
|
|
208
|
+
def Textup(body: TeX | str) -> TeX:
|
|
209
|
+
return ControlSequence("textup", (Parameter(body),))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@Registry.add
|
|
213
|
+
def Emph(body: TeX | str) -> TeX:
|
|
214
|
+
return ControlSequence("emph", (Parameter(body),))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
@Registry.add
|
|
218
|
+
def Underline(body: TeX | str) -> TeX:
|
|
219
|
+
return ControlSequence("underline", (Parameter(body),))
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@Registry.add
|
|
223
|
+
def Bold(body: TeX | str) -> TeX:
|
|
224
|
+
return Textbf(body)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
@Registry.add
|
|
228
|
+
def Italic(body: TeX | str) -> TeX:
|
|
229
|
+
return Textit(body)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@Registry.add
|
|
233
|
+
def Newline() -> TeX:
|
|
234
|
+
return Raw("\\\\")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@Registry.add
|
|
238
|
+
def Linebreak(n: int | None = None) -> TeX:
|
|
239
|
+
if n is None:
|
|
240
|
+
return ControlSequence("linebreak", ())
|
|
241
|
+
return ControlSequence("linebreak", (Parameter(str(n), optional=True),))
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
@Registry.add
|
|
245
|
+
def Newpage() -> TeX:
|
|
246
|
+
return ControlSequence("newpage", ())
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
@Registry.add
|
|
250
|
+
def Clearpage() -> TeX:
|
|
251
|
+
return ControlSequence("clearpage", ())
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
@Registry.add
|
|
255
|
+
def Cleardoublepage() -> TeX:
|
|
256
|
+
return ControlSequence("cleardoublepage", ())
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
@Registry.add
|
|
260
|
+
def Pagebreak(n: int | None = None) -> TeX:
|
|
261
|
+
if n is None:
|
|
262
|
+
return ControlSequence("pagebreak", ())
|
|
263
|
+
return ControlSequence("pagebreak", (Parameter(str(n), optional=True),))
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@Registry.add
|
|
267
|
+
def Hspace(amount: str, star: bool = False) -> TeX:
|
|
268
|
+
name = "hspace*" if star else "hspace"
|
|
269
|
+
return ControlSequence(name, (Parameter(amount),))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
@Registry.add
|
|
273
|
+
def Vspace(amount: str, star: bool = False) -> TeX:
|
|
274
|
+
name = "vspace*" if star else "vspace"
|
|
275
|
+
return ControlSequence(name, (Parameter(amount),))
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
@Registry.add
|
|
279
|
+
def Hfill() -> TeX:
|
|
280
|
+
return ControlSequence("hfill", ())
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
@Registry.add
|
|
284
|
+
def Vfill() -> TeX:
|
|
285
|
+
return ControlSequence("vfill", ())
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
@Registry.add
|
|
289
|
+
def Smallskip() -> TeX:
|
|
290
|
+
return ControlSequence("smallskip", ())
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
@Registry.add
|
|
294
|
+
def Medskip() -> TeX:
|
|
295
|
+
return ControlSequence("medskip", ())
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
@Registry.add
|
|
299
|
+
def Bigskip() -> TeX:
|
|
300
|
+
return ControlSequence("bigskip", ())
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
@Registry.add
|
|
304
|
+
def Noindent() -> TeX:
|
|
305
|
+
return ControlSequence("noindent", ())
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
@Registry.add
|
|
309
|
+
def Indent() -> TeX:
|
|
310
|
+
return ControlSequence("indent", ())
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
@Registry.add
|
|
314
|
+
def Item(body: TeX | str | None = None, label: TeX | str | None = None) -> TeX:
|
|
315
|
+
head: TeX = (
|
|
316
|
+
ControlSequence("item", (Parameter(label, optional=True),))
|
|
317
|
+
if label is not None
|
|
318
|
+
else ControlSequence("item", ())
|
|
319
|
+
)
|
|
320
|
+
if body is None:
|
|
321
|
+
return head
|
|
322
|
+
return Concat(head, Raw(" "), body)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
@Registry.add
|
|
326
|
+
def Itemize(*items: TeX | str) -> TeX:
|
|
327
|
+
return Environment(
|
|
328
|
+
"itemize",
|
|
329
|
+
Concat(*(it if _is_item(it) else Item(it) for it in items)),
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
@Registry.add
|
|
334
|
+
def Enumerate(*items: TeX | str) -> TeX:
|
|
335
|
+
return Environment(
|
|
336
|
+
"enumerate",
|
|
337
|
+
Concat(*(it if _is_item(it) else Item(it) for it in items)),
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def _describe_item(item: tuple[TeX | str, TeX | str] | TeX) -> TeX | str:
|
|
342
|
+
"""A `(term, description)` pair becomes a labelled `\\item`; nodes pass through."""
|
|
343
|
+
if isinstance(item, tuple):
|
|
344
|
+
term, desc = item
|
|
345
|
+
return Item(desc, label=term)
|
|
346
|
+
return item
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
@Registry.add
|
|
350
|
+
def Description(*items: tuple[TeX | str, TeX | str] | TeX) -> TeX:
|
|
351
|
+
return Environment(
|
|
352
|
+
"description",
|
|
353
|
+
Concat(*(_describe_item(it) for it in items)),
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def _is_item(node: TeX | str) -> bool:
|
|
358
|
+
return isinstance(node, ControlSequence) and node.name == "item"
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
@Registry.add
|
|
362
|
+
def Label(name: str) -> TeX:
|
|
363
|
+
return ControlSequence("label", (Parameter(name),))
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
@Registry.add
|
|
367
|
+
def Ref(name: str) -> TeX:
|
|
368
|
+
return ControlSequence("ref", (Parameter(name),))
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
@Registry.add
|
|
372
|
+
def Pageref(name: str) -> TeX:
|
|
373
|
+
return ControlSequence("pageref", (Parameter(name),))
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
@Registry.add
|
|
377
|
+
def Nameref(name: str) -> TeX:
|
|
378
|
+
return ControlSequence("nameref", (Parameter(name),))
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
@Registry.add
|
|
382
|
+
def Cite(*keys: str, prenote: str | None = None) -> TeX:
|
|
383
|
+
key_param = Parameter(",".join(keys))
|
|
384
|
+
if prenote is None:
|
|
385
|
+
return ControlSequence("cite", (key_param,))
|
|
386
|
+
return ControlSequence("cite", (Parameter(prenote, optional=True), key_param))
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
@Registry.add
|
|
390
|
+
def Title(title: TeX | str) -> TeX:
|
|
391
|
+
return ControlSequence("title", (Parameter(title),))
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
@Registry.add
|
|
395
|
+
def Author(author: TeX | str) -> TeX:
|
|
396
|
+
return ControlSequence("author", (Parameter(author),))
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
@Registry.add
|
|
400
|
+
def Date(date: TeX | str) -> TeX:
|
|
401
|
+
return ControlSequence("date", (Parameter(date),))
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
@Registry.add
|
|
405
|
+
def Today() -> TeX:
|
|
406
|
+
return ControlSequence("today", ())
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
@Registry.add
|
|
410
|
+
def MakeTitle() -> TeX:
|
|
411
|
+
return ControlSequence("maketitle", ())
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
@Registry.add
|
|
415
|
+
def Thanks(body: TeX | str) -> TeX:
|
|
416
|
+
return ControlSequence("thanks", (Parameter(body),))
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
@Registry.add
|
|
420
|
+
def TableOfContents() -> TeX:
|
|
421
|
+
return ControlSequence("tableofcontents", ())
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
@Registry.add
|
|
425
|
+
def ListOfFigures() -> TeX:
|
|
426
|
+
return ControlSequence("listoffigures", ())
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
@Registry.add
|
|
430
|
+
def ListOfTables() -> TeX:
|
|
431
|
+
return ControlSequence("listoftables", ())
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
@Registry.add
|
|
435
|
+
def Footnote(body: TeX | str) -> TeX:
|
|
436
|
+
return ControlSequence("footnote", (Parameter(body),))
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
@Registry.add
|
|
440
|
+
def Footnotemark(n: int | None = None) -> TeX:
|
|
441
|
+
if n is None:
|
|
442
|
+
return ControlSequence("footnotemark", ())
|
|
443
|
+
return ControlSequence("footnotemark", (Parameter(str(n), optional=True),))
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
@Registry.add
|
|
447
|
+
def Footnotetext(body: TeX | str) -> TeX:
|
|
448
|
+
return ControlSequence("footnotetext", (Parameter(body),))
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
@Registry.add
|
|
452
|
+
def Input(path: str) -> TeX:
|
|
453
|
+
return ControlSequence("input", (Parameter(path),))
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
@Registry.add
|
|
457
|
+
def Include(path: str) -> TeX:
|
|
458
|
+
return ControlSequence("include", (Parameter(path),))
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
@Registry.add
|
|
462
|
+
def IncludeOnly(*paths: str) -> TeX:
|
|
463
|
+
return ControlSequence("includeonly", (Parameter(",".join(paths)),))
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
@Registry.add
|
|
467
|
+
def Center(body: TeX | str) -> TeX:
|
|
468
|
+
return Environment("center", body)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
@Registry.add
|
|
472
|
+
def FlushLeft(body: TeX | str) -> TeX:
|
|
473
|
+
return Environment("flushleft", body)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
@Registry.add
|
|
477
|
+
def FlushRight(body: TeX | str) -> TeX:
|
|
478
|
+
return Environment("flushright", body)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
@Registry.add
|
|
482
|
+
def Centering() -> TeX:
|
|
483
|
+
return ControlSequence("centering", ())
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
@Registry.add
|
|
487
|
+
def Raggedright() -> TeX:
|
|
488
|
+
return ControlSequence("raggedright", ())
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
@Registry.add
|
|
492
|
+
def Raggedleft() -> TeX:
|
|
493
|
+
return ControlSequence("raggedleft", ())
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
@Registry.add
|
|
497
|
+
def Quote(body: TeX | str) -> TeX:
|
|
498
|
+
return Environment("quote", body)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
@Registry.add
|
|
502
|
+
def Quotation(body: TeX | str) -> TeX:
|
|
503
|
+
return Environment("quotation", body)
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
@Registry.add
|
|
507
|
+
def Verse(body: TeX | str) -> TeX:
|
|
508
|
+
return Environment("verse", body)
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
@Registry.add
|
|
512
|
+
def Verbatim(body: TeX | str) -> TeX:
|
|
513
|
+
return Environment("verbatim", body)
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
@Registry.add
|
|
517
|
+
def Verb(body: str, delim: str = "|") -> TeX:
|
|
518
|
+
return Raw(f"\\verb{delim}{body}{delim}")
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
# Size switches moved to pytex/commands/font.py (zero-arg ControlSequence wrappers).
|
|
522
|
+
# Compose with `Concat(Large(), " body")` for inline use.
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
@Registry.add
|
|
526
|
+
def Group(body: TeX | str) -> TeX:
|
|
527
|
+
return Concat(Raw("{"), body, Raw("}"))
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
@Registry.add
|
|
531
|
+
def Rule(width: str, thickness: str) -> TeX:
|
|
532
|
+
return ControlSequence("rule", (Parameter(width), Parameter(thickness)))
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
@Registry.add
|
|
536
|
+
def Pagenumbering(scheme: str) -> TeX:
|
|
537
|
+
return ControlSequence("pagenumbering", (Parameter(scheme),))
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
@Registry.add
|
|
541
|
+
def Immediate(body: TeX | str) -> TeX:
|
|
542
|
+
return Concat(ControlSequence("immediate", ()), Raw(" "), body)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
@Registry.add
|
|
546
|
+
def Write18(text: str) -> TeX:
|
|
547
|
+
return Raw("\\write18{" + text + "}")
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
@Registry.add
|
|
551
|
+
def Verbatiminput(path: str) -> TeX:
|
|
552
|
+
return ControlSequence("verbatiminput", (Parameter(path),))
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
@Registry.add
|
|
556
|
+
def Inputfile(path: str) -> TeX:
|
|
557
|
+
"""Alias for `\\input{path}` — `Input` already defined above as Input(path)."""
|
|
558
|
+
return ControlSequence("input", (Parameter(path),))
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@Registry.add
|
|
562
|
+
def Whiledo(condition: TeX | str, body: TeX | str) -> TeX:
|
|
563
|
+
return ControlSequence("whiledo", (Parameter(condition), Parameter(body)))
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
@Registry.add
|
|
567
|
+
def Foreach(var: str, values: str, body: TeX | str) -> TeX:
|
|
568
|
+
return Concat(
|
|
569
|
+
Raw(f"\\foreach {var} in {{{values}}}"),
|
|
570
|
+
Raw("{"),
|
|
571
|
+
body,
|
|
572
|
+
Raw("}"),
|
|
573
|
+
)
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
@Registry.add
|
|
577
|
+
def BeginAccSupp(options: dict[str, str]) -> TeX:
|
|
578
|
+
return ControlSequence("BeginAccSupp", (Parameter(options),))
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
@Registry.add
|
|
582
|
+
def EndAccSupp() -> TeX:
|
|
583
|
+
return ControlSequence("EndAccSupp", ())
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
@Registry.add
|
|
587
|
+
def Newglossarystyle(name: str, body: TeX | str) -> TeX:
|
|
588
|
+
return ControlSequence("newglossarystyle", (Parameter(name), Parameter(body)))
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
@Registry.add
|
|
592
|
+
def Blenderfont() -> TeX:
|
|
593
|
+
return ControlSequence("blenderfont", ())
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
@Registry.add
|
|
597
|
+
def Dinfont() -> TeX:
|
|
598
|
+
return ControlSequence("dinfont", ())
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from ..helpers.with_package import with_package
|
|
2
|
+
from ..interface.tex import TeX
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..packages import CAPTION, SUBCAPTION
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Caption",
|
|
9
|
+
"Captionof",
|
|
10
|
+
"Captionsetup",
|
|
11
|
+
"Subcaption",
|
|
12
|
+
"Subcaptionbox",
|
|
13
|
+
"Subref",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@Registry.add
|
|
18
|
+
def Caption(text: TeX | str, short: TeX | str | None = None) -> TeX:
|
|
19
|
+
if short is None:
|
|
20
|
+
return ControlSequence("caption", (Parameter(text),))
|
|
21
|
+
return ControlSequence(
|
|
22
|
+
"caption",
|
|
23
|
+
(Parameter(short, optional=True), Parameter(text)),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@Registry.add
|
|
28
|
+
def Captionof(typ: str, text: TeX | str) -> TeX:
|
|
29
|
+
return ControlSequence("captionof", (Parameter(typ), Parameter(text)))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@Registry.add
|
|
33
|
+
@with_package(CAPTION)
|
|
34
|
+
def Captionsetup(options: dict[str, str]) -> TeX:
|
|
35
|
+
return ControlSequence("captionsetup", (Parameter(options),))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@Registry.add
|
|
39
|
+
@with_package(SUBCAPTION)
|
|
40
|
+
def Subcaption(text: TeX | str) -> TeX:
|
|
41
|
+
return ControlSequence("subcaption", (Parameter(text),))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@Registry.add
|
|
45
|
+
@with_package(SUBCAPTION)
|
|
46
|
+
def Subcaptionbox(caption: TeX | str, body: TeX | str) -> TeX:
|
|
47
|
+
return ControlSequence(
|
|
48
|
+
"subcaptionbox",
|
|
49
|
+
(Parameter(caption), Parameter(body)),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@Registry.add
|
|
54
|
+
@with_package(SUBCAPTION)
|
|
55
|
+
def Subref(label: str) -> TeX:
|
|
56
|
+
return ControlSequence("subref", (Parameter(label),))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from ..helpers.with_package import with_package
|
|
2
|
+
from ..interface.tex import TeX
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..packages import CLEVEREF
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = ["Cref", "CrefUpper", "Crefformat", "Crefname", "CrefnameUpper"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@Registry.add
|
|
11
|
+
@with_package(CLEVEREF)
|
|
12
|
+
def Cref(*labels: str) -> TeX:
|
|
13
|
+
return ControlSequence("cref", (Parameter(",".join(labels)),))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@Registry.add
|
|
17
|
+
@with_package(CLEVEREF)
|
|
18
|
+
def CrefUpper(*labels: str) -> TeX:
|
|
19
|
+
return ControlSequence("Cref", (Parameter(",".join(labels)),))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@Registry.add
|
|
23
|
+
@with_package(CLEVEREF)
|
|
24
|
+
def Crefname(typ: str, singular: str, plural: str) -> TeX:
|
|
25
|
+
return ControlSequence(
|
|
26
|
+
"crefname",
|
|
27
|
+
(Parameter(typ), Parameter(singular), Parameter(plural)),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@Registry.add
|
|
32
|
+
@with_package(CLEVEREF)
|
|
33
|
+
def CrefnameUpper(typ: str, singular: str, plural: str) -> TeX:
|
|
34
|
+
return ControlSequence(
|
|
35
|
+
"Crefname",
|
|
36
|
+
(Parameter(typ), Parameter(singular), Parameter(plural)),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@Registry.add
|
|
41
|
+
@with_package(CLEVEREF)
|
|
42
|
+
def Crefformat(typ: str, fmt: str) -> TeX:
|
|
43
|
+
return ControlSequence("crefformat", (Parameter(typ), Parameter(fmt)))
|