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,25 @@
|
|
|
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 GEOMETRY
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = ["Geometry", "Newgeometry", "Restoregeometry"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@Registry.add
|
|
11
|
+
@with_package(GEOMETRY)
|
|
12
|
+
def Geometry(options: dict[str, str]) -> TeX:
|
|
13
|
+
return ControlSequence("geometry", (Parameter(options),))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@Registry.add
|
|
17
|
+
@with_package(GEOMETRY)
|
|
18
|
+
def Newgeometry(options: dict[str, str]) -> TeX:
|
|
19
|
+
return ControlSequence("newgeometry", (Parameter(options),))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@Registry.add
|
|
23
|
+
@with_package(GEOMETRY)
|
|
24
|
+
def Restoregeometry() -> TeX:
|
|
25
|
+
return ControlSequence("restoregeometry", ())
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
from ..helpers.with_package import with_package
|
|
2
|
+
from ..interface.tex import TeX
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..model.raw import Raw
|
|
5
|
+
from ..packages import GLOSSARIES
|
|
6
|
+
from ..registry import Registry
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"Acrfull",
|
|
10
|
+
"Acrlong",
|
|
11
|
+
"Acrshort",
|
|
12
|
+
"Gls",
|
|
13
|
+
"Glsenablehyper",
|
|
14
|
+
"Glspl",
|
|
15
|
+
"Glsplupper",
|
|
16
|
+
"Glsupper",
|
|
17
|
+
"Makeglossaries",
|
|
18
|
+
"Newacronym",
|
|
19
|
+
"Newglossaryentry",
|
|
20
|
+
"Printacronyms",
|
|
21
|
+
"Printglossary",
|
|
22
|
+
"Setglossarystyle",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@Registry.add
|
|
27
|
+
@with_package(GLOSSARIES)
|
|
28
|
+
def Makeglossaries() -> TeX:
|
|
29
|
+
return ControlSequence("makeglossaries", ())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@Registry.add
|
|
33
|
+
@with_package(GLOSSARIES)
|
|
34
|
+
def Newglossaryentry(label: str, fields: dict[str, str]) -> TeX:
|
|
35
|
+
# Brace each value so commas inside it (common in descriptions) are not
|
|
36
|
+
# parsed as key=value separators by the glossaries key-val list.
|
|
37
|
+
opts = ",".join(f"{key}={{{value}}}" for key, value in fields.items())
|
|
38
|
+
return ControlSequence(
|
|
39
|
+
"newglossaryentry",
|
|
40
|
+
(Parameter(label), Parameter(Raw(opts))),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@Registry.add
|
|
45
|
+
@with_package(GLOSSARIES)
|
|
46
|
+
def Newacronym(label: str, short: str, long: str) -> TeX:
|
|
47
|
+
return ControlSequence(
|
|
48
|
+
"newacronym",
|
|
49
|
+
(Parameter(label), Parameter(short), Parameter(long)),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@Registry.add
|
|
54
|
+
@with_package(GLOSSARIES)
|
|
55
|
+
def Printglossary(options: dict[str, str] | None = None) -> TeX:
|
|
56
|
+
if options is None:
|
|
57
|
+
return ControlSequence("printglossary", ())
|
|
58
|
+
return ControlSequence(
|
|
59
|
+
"printglossary",
|
|
60
|
+
(Parameter(options, optional=True),),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@Registry.add
|
|
65
|
+
@with_package(GLOSSARIES)
|
|
66
|
+
def Printacronyms(options: dict[str, str] | None = None) -> TeX:
|
|
67
|
+
if options is None:
|
|
68
|
+
return ControlSequence("printacronyms", ())
|
|
69
|
+
return ControlSequence(
|
|
70
|
+
"printacronyms",
|
|
71
|
+
(Parameter(options, optional=True),),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@Registry.add
|
|
76
|
+
@with_package(GLOSSARIES)
|
|
77
|
+
def Gls(label: str) -> TeX:
|
|
78
|
+
return ControlSequence("gls", (Parameter(label),))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@Registry.add
|
|
82
|
+
@with_package(GLOSSARIES)
|
|
83
|
+
def Glsupper(label: str) -> TeX:
|
|
84
|
+
return ControlSequence("Gls", (Parameter(label),))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@Registry.add
|
|
88
|
+
@with_package(GLOSSARIES)
|
|
89
|
+
def Glspl(label: str) -> TeX:
|
|
90
|
+
return ControlSequence("glspl", (Parameter(label),))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@Registry.add
|
|
94
|
+
@with_package(GLOSSARIES)
|
|
95
|
+
def Glsplupper(label: str) -> TeX:
|
|
96
|
+
return ControlSequence("Glspl", (Parameter(label),))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@Registry.add
|
|
100
|
+
@with_package(GLOSSARIES)
|
|
101
|
+
def Acrshort(label: str) -> TeX:
|
|
102
|
+
return ControlSequence("acrshort", (Parameter(label),))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@Registry.add
|
|
106
|
+
@with_package(GLOSSARIES)
|
|
107
|
+
def Acrlong(label: str) -> TeX:
|
|
108
|
+
return ControlSequence("acrlong", (Parameter(label),))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@Registry.add
|
|
112
|
+
@with_package(GLOSSARIES)
|
|
113
|
+
def Acrfull(label: str) -> TeX:
|
|
114
|
+
return ControlSequence("acrfull", (Parameter(label),))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@Registry.add
|
|
118
|
+
@with_package(GLOSSARIES)
|
|
119
|
+
def Setglossarystyle(name: str) -> TeX:
|
|
120
|
+
return ControlSequence("setglossarystyle", (Parameter(name),))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@Registry.add
|
|
124
|
+
@with_package(GLOSSARIES)
|
|
125
|
+
def Glsenablehyper() -> TeX:
|
|
126
|
+
return ControlSequence("glsenablehyper", ())
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from ..helpers.with_package import with_package
|
|
2
|
+
from ..interface.tex import TeX
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..model.raw import Raw
|
|
5
|
+
from ..packages import GRAPHICX
|
|
6
|
+
from ..registry import Registry
|
|
7
|
+
|
|
8
|
+
__all__ = ["Graphicspath", "Includegraphics", "Resizebox", "Rotatebox", "Scalebox"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@Registry.add
|
|
12
|
+
@with_package(GRAPHICX)
|
|
13
|
+
def Includegraphics(
|
|
14
|
+
path: str,
|
|
15
|
+
width: str | None = None,
|
|
16
|
+
height: str | None = None,
|
|
17
|
+
scale: str | None = None,
|
|
18
|
+
angle: str | None = None,
|
|
19
|
+
keepaspectratio: bool = False,
|
|
20
|
+
extra_options: dict[str, str] | None = None,
|
|
21
|
+
) -> TeX:
|
|
22
|
+
sized = (
|
|
23
|
+
f"{key}={value}"
|
|
24
|
+
for key, value in (
|
|
25
|
+
("width", width),
|
|
26
|
+
("height", height),
|
|
27
|
+
("scale", scale),
|
|
28
|
+
("angle", angle),
|
|
29
|
+
)
|
|
30
|
+
if value is not None
|
|
31
|
+
)
|
|
32
|
+
flags = ("keepaspectratio",) if keepaspectratio else ()
|
|
33
|
+
extra = (f"{k}={v}" for k, v in (extra_options or {}).items())
|
|
34
|
+
opts = [*sized, *flags, *extra]
|
|
35
|
+
params = (
|
|
36
|
+
(Parameter(Raw(",".join(opts)), optional=True), Parameter(path))
|
|
37
|
+
if opts
|
|
38
|
+
else (Parameter(path),)
|
|
39
|
+
)
|
|
40
|
+
return ControlSequence("includegraphics", params)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@Registry.add
|
|
44
|
+
@with_package(GRAPHICX)
|
|
45
|
+
def Graphicspath(*paths: str) -> TeX:
|
|
46
|
+
inner = "".join(f"{{{p}}}" for p in paths)
|
|
47
|
+
return ControlSequence("graphicspath", (Parameter(Raw(inner)),))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@Registry.add
|
|
51
|
+
@with_package(GRAPHICX)
|
|
52
|
+
def Resizebox(width: str, height: str, body: TeX | str) -> TeX:
|
|
53
|
+
return ControlSequence(
|
|
54
|
+
"resizebox",
|
|
55
|
+
(Parameter(width), Parameter(height), Parameter(body)),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@Registry.add
|
|
60
|
+
@with_package(GRAPHICX)
|
|
61
|
+
def Scalebox(scale: str, body: TeX | str) -> TeX:
|
|
62
|
+
return ControlSequence("scalebox", (Parameter(scale), Parameter(body)))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@Registry.add
|
|
66
|
+
@with_package(GRAPHICX)
|
|
67
|
+
def Rotatebox(angle: str, body: TeX | str) -> TeX:
|
|
68
|
+
return ControlSequence("rotatebox", (Parameter(angle), Parameter(body)))
|
pytex/commands/hooks.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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 ETOOLBOX
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"AtBeginDocument",
|
|
9
|
+
"AtBeginEnvironment",
|
|
10
|
+
"AtBeginPage",
|
|
11
|
+
"AtEndDocument",
|
|
12
|
+
"AtEndEnvironment",
|
|
13
|
+
"AtEndOfClass",
|
|
14
|
+
"AtEndOfPackage",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@Registry.add
|
|
19
|
+
def AtBeginDocument(body: TeX | str) -> TeX:
|
|
20
|
+
return ControlSequence("AtBeginDocument", (Parameter(body),))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@Registry.add
|
|
24
|
+
def AtEndDocument(body: TeX | str) -> TeX:
|
|
25
|
+
return ControlSequence("AtEndDocument", (Parameter(body),))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@Registry.add
|
|
29
|
+
@with_package(ETOOLBOX)
|
|
30
|
+
def AtBeginEnvironment(env: str, body: TeX | str) -> TeX:
|
|
31
|
+
return ControlSequence(
|
|
32
|
+
"AtBeginEnvironment",
|
|
33
|
+
(Parameter(env), Parameter(body)),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@Registry.add
|
|
38
|
+
@with_package(ETOOLBOX)
|
|
39
|
+
def AtEndEnvironment(env: str, body: TeX | str) -> TeX:
|
|
40
|
+
return ControlSequence(
|
|
41
|
+
"AtEndEnvironment",
|
|
42
|
+
(Parameter(env), Parameter(body)),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@Registry.add
|
|
47
|
+
def AtBeginPage(body: TeX | str) -> TeX:
|
|
48
|
+
return ControlSequence("AtBeginPage", (Parameter(body),))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@Registry.add
|
|
52
|
+
def AtEndOfPackage(body: TeX | str) -> TeX:
|
|
53
|
+
return ControlSequence("AtEndOfPackage", (Parameter(body),))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@Registry.add
|
|
57
|
+
def AtEndOfClass(body: TeX | str) -> TeX:
|
|
58
|
+
return ControlSequence("AtEndOfClass", (Parameter(body),))
|
|
@@ -0,0 +1,57 @@
|
|
|
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 HYPERREF
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Autoref",
|
|
9
|
+
"Href",
|
|
10
|
+
"Hyperlink",
|
|
11
|
+
"Hypersetup",
|
|
12
|
+
"Hypertarget",
|
|
13
|
+
"Nolinkurl",
|
|
14
|
+
"Url",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@Registry.add
|
|
19
|
+
@with_package(HYPERREF)
|
|
20
|
+
def Hypersetup(options: dict[str, str]) -> TeX:
|
|
21
|
+
return ControlSequence("hypersetup", (Parameter(options),))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@Registry.add
|
|
25
|
+
@with_package(HYPERREF)
|
|
26
|
+
def Href(url: str, text: TeX | str) -> TeX:
|
|
27
|
+
return ControlSequence("href", (Parameter(url), Parameter(text)))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@Registry.add
|
|
31
|
+
@with_package(HYPERREF)
|
|
32
|
+
def Url(url: str) -> TeX:
|
|
33
|
+
return ControlSequence("url", (Parameter(url),))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@Registry.add
|
|
37
|
+
@with_package(HYPERREF)
|
|
38
|
+
def Nolinkurl(url: str) -> TeX:
|
|
39
|
+
return ControlSequence("nolinkurl", (Parameter(url),))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@Registry.add
|
|
43
|
+
@with_package(HYPERREF)
|
|
44
|
+
def Hyperlink(name: str, text: TeX | str) -> TeX:
|
|
45
|
+
return ControlSequence("hyperlink", (Parameter(name), Parameter(text)))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@Registry.add
|
|
49
|
+
@with_package(HYPERREF)
|
|
50
|
+
def Hypertarget(name: str, text: TeX | str) -> TeX:
|
|
51
|
+
return ControlSequence("hypertarget", (Parameter(name), Parameter(text)))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@Registry.add
|
|
55
|
+
@with_package(HYPERREF)
|
|
56
|
+
def Autoref(name: str) -> TeX:
|
|
57
|
+
return ControlSequence("autoref", (Parameter(name),))
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
from ..interface.tex import TeX
|
|
2
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
3
|
+
from ..model.length import Length
|
|
4
|
+
from ..model.raw import Raw
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Addtolength",
|
|
9
|
+
"Arraystretch_len",
|
|
10
|
+
"Baselineskip",
|
|
11
|
+
"Baselinestretch",
|
|
12
|
+
"Columnsep",
|
|
13
|
+
"Columnwidth",
|
|
14
|
+
"Fill",
|
|
15
|
+
"Footskip",
|
|
16
|
+
"Headheight",
|
|
17
|
+
"Headsep",
|
|
18
|
+
"Leftmargin",
|
|
19
|
+
"Linewidth",
|
|
20
|
+
"Marginparwidth",
|
|
21
|
+
"Newlength",
|
|
22
|
+
"Pageheight",
|
|
23
|
+
"Pagewidth",
|
|
24
|
+
"Paperheight",
|
|
25
|
+
"Paperwidth",
|
|
26
|
+
"Parindent",
|
|
27
|
+
"Parskip",
|
|
28
|
+
"Rightmargin",
|
|
29
|
+
"Setlength",
|
|
30
|
+
"Settodepth",
|
|
31
|
+
"Settoheight",
|
|
32
|
+
"Settowidth",
|
|
33
|
+
"Tabcolsep",
|
|
34
|
+
"Textheight",
|
|
35
|
+
"Textwidth",
|
|
36
|
+
"Topmargin",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@Registry.add
|
|
41
|
+
def Newlength(name: str) -> TeX:
|
|
42
|
+
return ControlSequence("newlength", (Parameter(Raw(name)),))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@Registry.add
|
|
46
|
+
def Setlength(name: str, value: Length | str) -> TeX:
|
|
47
|
+
expr = value.expr if isinstance(value, Length) else value
|
|
48
|
+
return ControlSequence("setlength", (Parameter(Raw(name)), Parameter(expr)))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@Registry.add
|
|
52
|
+
def Addtolength(name: str, value: Length | str) -> TeX:
|
|
53
|
+
expr = value.expr if isinstance(value, Length) else value
|
|
54
|
+
return ControlSequence(
|
|
55
|
+
"addtolength",
|
|
56
|
+
(Parameter(Raw(name)), Parameter(expr)),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@Registry.add
|
|
61
|
+
def Settowidth(name: str, body: TeX | str) -> TeX:
|
|
62
|
+
return ControlSequence(
|
|
63
|
+
"settowidth",
|
|
64
|
+
(Parameter(Raw(name)), Parameter(body)),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@Registry.add
|
|
69
|
+
def Settoheight(name: str, body: TeX | str) -> TeX:
|
|
70
|
+
return ControlSequence(
|
|
71
|
+
"settoheight",
|
|
72
|
+
(Parameter(Raw(name)), Parameter(body)),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@Registry.add
|
|
77
|
+
def Settodepth(name: str, body: TeX | str) -> TeX:
|
|
78
|
+
return ControlSequence(
|
|
79
|
+
"settodepth",
|
|
80
|
+
(Parameter(Raw(name)), Parameter(body)),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _const(name: str) -> Length:
|
|
85
|
+
return Length(f"\\{name}")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@Registry.add
|
|
89
|
+
def Textwidth() -> Length:
|
|
90
|
+
return _const("textwidth")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@Registry.add
|
|
94
|
+
def Textheight() -> Length:
|
|
95
|
+
return _const("textheight")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@Registry.add
|
|
99
|
+
def Linewidth() -> Length:
|
|
100
|
+
return _const("linewidth")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@Registry.add
|
|
104
|
+
def Columnwidth() -> Length:
|
|
105
|
+
return _const("columnwidth")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@Registry.add
|
|
109
|
+
def Columnsep() -> Length:
|
|
110
|
+
return _const("columnsep")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@Registry.add
|
|
114
|
+
def Paperwidth() -> Length:
|
|
115
|
+
return _const("paperwidth")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@Registry.add
|
|
119
|
+
def Paperheight() -> Length:
|
|
120
|
+
return _const("paperheight")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@Registry.add
|
|
124
|
+
def Pagewidth() -> Length:
|
|
125
|
+
return _const("pagewidth")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@Registry.add
|
|
129
|
+
def Pageheight() -> Length:
|
|
130
|
+
return _const("pageheight")
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@Registry.add
|
|
134
|
+
def Baselineskip() -> Length:
|
|
135
|
+
return _const("baselineskip")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@Registry.add
|
|
139
|
+
def Baselinestretch() -> Length:
|
|
140
|
+
return _const("baselinestretch")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@Registry.add
|
|
144
|
+
def Parindent() -> Length:
|
|
145
|
+
return _const("parindent")
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@Registry.add
|
|
149
|
+
def Parskip() -> Length:
|
|
150
|
+
return _const("parskip")
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@Registry.add
|
|
154
|
+
def Topmargin() -> Length:
|
|
155
|
+
return _const("topmargin")
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@Registry.add
|
|
159
|
+
def Leftmargin() -> Length:
|
|
160
|
+
return _const("leftmargin")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@Registry.add
|
|
164
|
+
def Rightmargin() -> Length:
|
|
165
|
+
return _const("rightmargin")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@Registry.add
|
|
169
|
+
def Footskip() -> Length:
|
|
170
|
+
return _const("footskip")
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@Registry.add
|
|
174
|
+
def Headheight() -> Length:
|
|
175
|
+
return _const("headheight")
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@Registry.add
|
|
179
|
+
def Headsep() -> Length:
|
|
180
|
+
return _const("headsep")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@Registry.add
|
|
184
|
+
def Marginparwidth() -> Length:
|
|
185
|
+
return _const("marginparwidth")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@Registry.add
|
|
189
|
+
def Tabcolsep() -> Length:
|
|
190
|
+
return _const("tabcolsep")
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@Registry.add
|
|
194
|
+
def Arraystretch_len() -> Length:
|
|
195
|
+
return _const("arraystretch")
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@Registry.add
|
|
199
|
+
def Fill() -> Length:
|
|
200
|
+
return _const("fill")
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from ..helpers.with_package import with_package
|
|
2
|
+
from ..interface.tex import TeX
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..model.environment import Environment
|
|
5
|
+
from ..model.raw import Raw
|
|
6
|
+
from ..packages import LISTINGS
|
|
7
|
+
from ..registry import Registry
|
|
8
|
+
|
|
9
|
+
__all__ = ["Lstdefinestyle", "Lstinline", "Lstinputlisting", "Lstlisting", "Lstset"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _render_value(value: object) -> str:
|
|
13
|
+
if isinstance(value, TeX):
|
|
14
|
+
return value.rendered
|
|
15
|
+
return str(value)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _opts_to_str(opts: dict[str, TeX | str]) -> str:
|
|
19
|
+
return ",".join(f"{k}={_render_value(v)}" for k, v in opts.items())
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@Registry.add
|
|
23
|
+
@with_package(LISTINGS)
|
|
24
|
+
def Lstset(options: dict[str, TeX | str]) -> TeX:
|
|
25
|
+
return ControlSequence("lstset", (Parameter(Raw(_opts_to_str(options))),))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@Registry.add
|
|
29
|
+
@with_package(LISTINGS)
|
|
30
|
+
def Lstdefinestyle(name: str, options: dict[str, TeX | str]) -> TeX:
|
|
31
|
+
return ControlSequence(
|
|
32
|
+
"lstdefinestyle",
|
|
33
|
+
(Parameter(name), Parameter(Raw(_opts_to_str(options)))),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@Registry.add
|
|
38
|
+
@with_package(LISTINGS)
|
|
39
|
+
def Lstinputlisting(path: str, options: dict[str, TeX | str] | None = None) -> TeX:
|
|
40
|
+
if options is None:
|
|
41
|
+
return ControlSequence("lstinputlisting", (Parameter(path),))
|
|
42
|
+
return ControlSequence(
|
|
43
|
+
"lstinputlisting",
|
|
44
|
+
(
|
|
45
|
+
Parameter(Raw(_opts_to_str(options)), optional=True),
|
|
46
|
+
Parameter(path),
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@Registry.add
|
|
52
|
+
@with_package(LISTINGS)
|
|
53
|
+
def Lstinline(body: str, delim: str = "|") -> TeX:
|
|
54
|
+
return Raw(f"\\lstinline{delim}{body}{delim}")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@Registry.add
|
|
58
|
+
@with_package(LISTINGS)
|
|
59
|
+
def Lstlisting(body: str, options: dict[str, TeX | str] | None = None) -> TeX:
|
|
60
|
+
params: tuple[Parameter, ...] = ()
|
|
61
|
+
if options:
|
|
62
|
+
params = (Parameter(Raw(_opts_to_str(options)), optional=True),)
|
|
63
|
+
return Environment("lstlisting", body, params)
|
|
@@ -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 ..model.environment import Environment
|
|
5
|
+
from ..model.raw import Raw
|
|
6
|
+
from ..packages import MDFRAMED
|
|
7
|
+
from ..registry import Registry
|
|
8
|
+
|
|
9
|
+
__all__ = ["Mdfdefinestyle", "Mdframed", "Newmdenv"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _opts_to_str(opts: dict[str, str]) -> str:
|
|
13
|
+
return ",".join(k if v == "" else f"{k}={v}" for k, v in opts.items())
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@Registry.add
|
|
17
|
+
@with_package(MDFRAMED)
|
|
18
|
+
def Mdframed(body: TeX | str, options: dict[str, str] | None = None) -> TeX:
|
|
19
|
+
params: tuple[Parameter, ...] = ()
|
|
20
|
+
if options:
|
|
21
|
+
params = (Parameter(Raw(_opts_to_str(options)), optional=True),)
|
|
22
|
+
return Environment("mdframed", body, params)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@Registry.add
|
|
26
|
+
@with_package(MDFRAMED)
|
|
27
|
+
def Mdfdefinestyle(name: str, options: dict[str, str]) -> TeX:
|
|
28
|
+
return ControlSequence(
|
|
29
|
+
"mdfdefinestyle",
|
|
30
|
+
(Parameter(name), Parameter(Raw(_opts_to_str(options)))),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@Registry.add
|
|
35
|
+
@with_package(MDFRAMED)
|
|
36
|
+
def Newmdenv(name: str, options: dict[str, str]) -> TeX:
|
|
37
|
+
return ControlSequence(
|
|
38
|
+
"newmdenv",
|
|
39
|
+
(
|
|
40
|
+
Parameter(Raw(_opts_to_str(options)), optional=True),
|
|
41
|
+
Parameter(name),
|
|
42
|
+
),
|
|
43
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from ..interface.tex import TeX
|
|
2
|
+
from ..model.concat import Concat
|
|
3
|
+
from ..model.raw import Raw
|
|
4
|
+
from ..registry import Registry
|
|
5
|
+
|
|
6
|
+
__all__ = ["Picture", "Put"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@Registry.add
|
|
10
|
+
def Picture(
|
|
11
|
+
width: str,
|
|
12
|
+
height: str,
|
|
13
|
+
body: TeX | str,
|
|
14
|
+
x_offset: str = "0",
|
|
15
|
+
y_offset: str = "0",
|
|
16
|
+
) -> TeX:
|
|
17
|
+
"""`\\begin{picture}(W,H)(x,y) ... \\end{picture}` — non-standard arg syntax."""
|
|
18
|
+
return Concat(
|
|
19
|
+
Raw(f"\\begin{{picture}}({width},{height})({x_offset},{y_offset})"),
|
|
20
|
+
body,
|
|
21
|
+
Raw("\\end{picture}"),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@Registry.add
|
|
26
|
+
def Put(x: str, y: str, body: TeX | str) -> TeX:
|
|
27
|
+
"""`\\put(x,y){body}` — picture-mode placement."""
|
|
28
|
+
return Concat(
|
|
29
|
+
Raw(f"\\put({x},{y}){{"),
|
|
30
|
+
body,
|
|
31
|
+
Raw("}"),
|
|
32
|
+
)
|