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.
Files changed (119) hide show
  1. pytex/__init__.py +87 -0
  2. pytex/commands/__init__.py +51 -0
  3. pytex/commands/biblatex.py +98 -0
  4. pytex/commands/builtin.py +598 -0
  5. pytex/commands/captions.py +56 -0
  6. pytex/commands/cleveref.py +43 -0
  7. pytex/commands/colors.py +60 -0
  8. pytex/commands/conditionals.py +62 -0
  9. pytex/commands/counters.py +85 -0
  10. pytex/commands/definitions.py +109 -0
  11. pytex/commands/floats.py +93 -0
  12. pytex/commands/font.py +138 -0
  13. pytex/commands/fontawesome.py +88 -0
  14. pytex/commands/fontspec.py +75 -0
  15. pytex/commands/geometry.py +25 -0
  16. pytex/commands/glossaries.py +126 -0
  17. pytex/commands/graphics.py +68 -0
  18. pytex/commands/hooks.py +58 -0
  19. pytex/commands/hyperref.py +57 -0
  20. pytex/commands/lengths.py +200 -0
  21. pytex/commands/listings.py +63 -0
  22. pytex/commands/mdframed.py +43 -0
  23. pytex/commands/picture.py +32 -0
  24. pytex/commands/setspace.py +38 -0
  25. pytex/commands/tables.py +123 -0
  26. pytex/helpers/__init__.py +3 -0
  27. pytex/helpers/coerce.py +13 -0
  28. pytex/helpers/parenting.py +13 -0
  29. pytex/helpers/sanitize.py +54 -0
  30. pytex/helpers/with_package.py +61 -0
  31. pytex/interface/__init__.py +3 -0
  32. pytex/interface/control_sequence.py +29 -0
  33. pytex/interface/package.py +52 -0
  34. pytex/interface/tex.py +41 -0
  35. pytex/model/__init__.py +25 -0
  36. pytex/model/color.py +203 -0
  37. pytex/model/concat.py +31 -0
  38. pytex/model/control_sequence.py +72 -0
  39. pytex/model/document.py +120 -0
  40. pytex/model/document_class.py +29 -0
  41. pytex/model/empty.py +19 -0
  42. pytex/model/environment.py +30 -0
  43. pytex/model/image.py +137 -0
  44. pytex/model/include.py +21 -0
  45. pytex/model/length.py +54 -0
  46. pytex/model/math.py +401 -0
  47. pytex/model/package.py +132 -0
  48. pytex/model/raw.py +61 -0
  49. pytex/packages.py +221 -0
  50. pytex/registry.py +49 -0
  51. pytex_builder/__init__.py +8 -0
  52. pytex_builder/build.py +175 -0
  53. pytex_builder/console.py +77 -0
  54. pytex_builder/render.py +90 -0
  55. pytex_builder/tectonic.py +370 -0
  56. pytex_hsrtreport/__init__.py +116 -0
  57. pytex_hsrtreport/assets/fonts/Blender/Blender-Bold.ttf +0 -0
  58. pytex_hsrtreport/assets/fonts/Blender/Blender-BoldItalic.ttf +0 -0
  59. pytex_hsrtreport/assets/fonts/Blender/Blender-Book.ttf +0 -0
  60. pytex_hsrtreport/assets/fonts/Blender/Blender-BookItalic.ttf +0 -0
  61. pytex_hsrtreport/assets/fonts/Blender/Blender-Medium.ttf +0 -0
  62. pytex_hsrtreport/assets/fonts/Blender/Blender-MediumItalic.ttf +0 -0
  63. pytex_hsrtreport/assets/fonts/Blender/Blender-Strong.ttf +0 -0
  64. pytex_hsrtreport/assets/fonts/Blender/Blender-Thin.ttf +0 -0
  65. pytex_hsrtreport/assets/fonts/Blender/Blender-ThinItalic.ttf +0 -0
  66. pytex_hsrtreport/assets/fonts/DIN/DIN-Black.ttf +0 -0
  67. pytex_hsrtreport/assets/fonts/DIN/DIN-Bold.ttf +0 -0
  68. pytex_hsrtreport/assets/fonts/DIN/DIN-BoldItalic.ttf +0 -0
  69. pytex_hsrtreport/assets/fonts/DIN/DIN-Italic.ttf +0 -0
  70. pytex_hsrtreport/assets/fonts/DIN/DIN-Medium.ttf +0 -0
  71. pytex_hsrtreport/assets/fonts/DIN/DIN-Regular.ttf +0 -0
  72. pytex_hsrtreport/assets/fonts/Times New Roman.ttf +0 -0
  73. pytex_hsrtreport/assets/logos/ASTA.svg +79 -0
  74. pytex_hsrtreport/assets/logos/DUMMY.png +0 -0
  75. pytex_hsrtreport/assets/logos/DUMMY_FOOT.png +0 -0
  76. pytex_hsrtreport/assets/logos/ECHO.svg +226 -0
  77. pytex_hsrtreport/assets/logos/HSRT.pdf +0 -0
  78. pytex_hsrtreport/assets/logos/INF.pdf +0 -0
  79. pytex_hsrtreport/assets/logos/STUPA.pdf +0 -0
  80. pytex_hsrtreport/assets/logos/Skyline.pdf +0 -0
  81. pytex_hsrtreport/boxes.py +215 -0
  82. pytex_hsrtreport/citations.py +21 -0
  83. pytex_hsrtreport/cleveref_names.py +47 -0
  84. pytex_hsrtreport/colors.py +30 -0
  85. pytex_hsrtreport/document.py +307 -0
  86. pytex_hsrtreport/fonts.py +66 -0
  87. pytex_hsrtreport/glossary.py +61 -0
  88. pytex_hsrtreport/hyperref_config.py +49 -0
  89. pytex_hsrtreport/listings.py +90 -0
  90. pytex_hsrtreport/logos.py +234 -0
  91. pytex_hsrtreport/pagebreak.py +67 -0
  92. pytex_hsrtreport/pagesetup.py +33 -0
  93. pytex_hsrtreport/tex/pagesetup.tex +76 -0
  94. pytex_hsrtreport/titlepage.py +136 -0
  95. pytex_hsrtreport/variants.py +24 -0
  96. pytex_hsrtreport/voting.py +96 -0
  97. pytex_hsrtreport/watermark.py +63 -0
  98. pytex_hsrtreport/wordcount.py +33 -0
  99. pytex_koma/__init__.py +90 -0
  100. pytex_koma/commands.py +296 -0
  101. pytex_koma/document.py +138 -0
  102. pytex_markdown/__init__.py +62 -0
  103. pytex_markdown/convert.py +271 -0
  104. pytex_markdown/escape.py +11 -0
  105. pytex_preprocessor-0.1.0.dist-info/METADATA +82 -0
  106. pytex_preprocessor-0.1.0.dist-info/RECORD +119 -0
  107. pytex_preprocessor-0.1.0.dist-info/WHEEL +5 -0
  108. pytex_preprocessor-0.1.0.dist-info/entry_points.txt +2 -0
  109. pytex_preprocessor-0.1.0.dist-info/top_level.txt +7 -0
  110. pytex_protocol/__init__.py +37 -0
  111. pytex_protocol/convert.py +202 -0
  112. pytex_protocol/document.py +91 -0
  113. pytex_protocol/entries.py +96 -0
  114. pytex_protocol/frontmatter.py +80 -0
  115. pytex_protocol/header.py +139 -0
  116. pytex_protocol/shortcodes.py +130 -0
  117. pytex_protocol/signatures.py +84 -0
  118. pytex_tikz/__init__.py +25 -0
  119. pytex_tikz/tikz.py +272 -0
@@ -0,0 +1,60 @@
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 XCOLOR
5
+ from ..registry import Registry
6
+
7
+ __all__ = [
8
+ "Colorbox",
9
+ "Definecolor",
10
+ "Fcolorbox",
11
+ "Pagecolor",
12
+ "SelectColor",
13
+ "Textcolor",
14
+ ]
15
+
16
+
17
+ @Registry.add
18
+ @with_package(XCOLOR)
19
+ def Definecolor(name: str, model: str, spec: str) -> TeX:
20
+ return ControlSequence(
21
+ "definecolor",
22
+ (Parameter(name), Parameter(model), Parameter(spec)),
23
+ )
24
+
25
+
26
+ @Registry.add
27
+ @with_package(XCOLOR)
28
+ def Textcolor(color: str, body: TeX | str) -> TeX:
29
+ return ControlSequence("textcolor", (Parameter(color), Parameter(body)))
30
+
31
+
32
+ @Registry.add
33
+ @with_package(XCOLOR)
34
+ def SelectColor(color: str) -> TeX:
35
+ """`\\color{name}` — switch current colour.
36
+
37
+ Use `Color` (model) for typed colour identity.
38
+ """
39
+ return ControlSequence("color", (Parameter(color),))
40
+
41
+
42
+ @Registry.add
43
+ @with_package(XCOLOR)
44
+ def Colorbox(color: str, body: TeX | str) -> TeX:
45
+ return ControlSequence("colorbox", (Parameter(color), Parameter(body)))
46
+
47
+
48
+ @Registry.add
49
+ @with_package(XCOLOR)
50
+ def Fcolorbox(border: str, fill: str, body: TeX | str) -> TeX:
51
+ return ControlSequence(
52
+ "fcolorbox",
53
+ (Parameter(border), Parameter(fill), Parameter(body)),
54
+ )
55
+
56
+
57
+ @Registry.add
58
+ @with_package(XCOLOR)
59
+ def Pagecolor(color: str) -> TeX:
60
+ return ControlSequence("pagecolor", (Parameter(color),))
@@ -0,0 +1,62 @@
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, IFTHEN
5
+ from ..registry import Registry
6
+
7
+ __all__ = ["Apptocmd", "Equal", "Ifdefstring", "Ifstrequal", "Ifthenelse", "Pretocmd"]
8
+
9
+
10
+ @Registry.add
11
+ @with_package(IFTHEN)
12
+ def Ifthenelse(condition: TeX | str, then: TeX | str, otherwise: TeX | str) -> TeX:
13
+ return ControlSequence(
14
+ "ifthenelse",
15
+ (Parameter(condition), Parameter(then), Parameter(otherwise)),
16
+ )
17
+
18
+
19
+ @Registry.add
20
+ @with_package(IFTHEN)
21
+ def Equal(a: TeX | str, b: TeX | str) -> TeX:
22
+ return ControlSequence("equal", (Parameter(a), Parameter(b)))
23
+
24
+
25
+ @Registry.add
26
+ @with_package(ETOOLBOX)
27
+ def Ifstrequal(
28
+ a: TeX | str, b: TeX | str, then: TeX | str, otherwise: TeX | str
29
+ ) -> TeX:
30
+ return ControlSequence(
31
+ "ifstrequal",
32
+ (Parameter(a), Parameter(b), Parameter(then), Parameter(otherwise)),
33
+ )
34
+
35
+
36
+ @Registry.add
37
+ @with_package(ETOOLBOX)
38
+ def Ifdefstring(
39
+ cmd: str, target: TeX | str, then: TeX | str, otherwise: TeX | str
40
+ ) -> TeX:
41
+ return ControlSequence(
42
+ "ifdefstring",
43
+ (Parameter(cmd), Parameter(target), Parameter(then), Parameter(otherwise)),
44
+ )
45
+
46
+
47
+ @Registry.add
48
+ @with_package(ETOOLBOX)
49
+ def Pretocmd(cmd: str, prepend: TeX | str) -> TeX:
50
+ return ControlSequence(
51
+ "pretocmd",
52
+ (Parameter(cmd), Parameter(prepend), Parameter(""), Parameter("")),
53
+ )
54
+
55
+
56
+ @Registry.add
57
+ @with_package(ETOOLBOX)
58
+ def Apptocmd(cmd: str, append: TeX | str) -> TeX:
59
+ return ControlSequence(
60
+ "apptocmd",
61
+ (Parameter(cmd), Parameter(append), Parameter(""), Parameter("")),
62
+ )
@@ -0,0 +1,85 @@
1
+ from ..interface.tex import TeX
2
+ from ..model.control_sequence import ControlSequence, Parameter
3
+ from ..model.raw import Raw
4
+ from ..registry import Registry
5
+
6
+ __all__ = [
7
+ "Addtocounter",
8
+ "Alph",
9
+ "AlphUpper",
10
+ "Arabic",
11
+ "Newcounter",
12
+ "Refstepcounter",
13
+ "RomanCounter",
14
+ "RomanCounterUpper",
15
+ "Setcounter",
16
+ "Stepcounter",
17
+ "UseCounter",
18
+ "Value",
19
+ ]
20
+
21
+
22
+ @Registry.add
23
+ def Newcounter(name: str, within: str | None = None) -> TeX:
24
+ if within is None:
25
+ return ControlSequence("newcounter", (Parameter(name),))
26
+ return ControlSequence(
27
+ "newcounter",
28
+ (Parameter(name), Parameter(within, optional=True)),
29
+ )
30
+
31
+
32
+ @Registry.add
33
+ def Setcounter(name: str, value: int | str) -> TeX:
34
+ return ControlSequence("setcounter", (Parameter(name), Parameter(str(value))))
35
+
36
+
37
+ @Registry.add
38
+ def Addtocounter(name: str, value: int | str) -> TeX:
39
+ return ControlSequence("addtocounter", (Parameter(name), Parameter(str(value))))
40
+
41
+
42
+ @Registry.add
43
+ def Stepcounter(name: str) -> TeX:
44
+ return ControlSequence("stepcounter", (Parameter(name),))
45
+
46
+
47
+ @Registry.add
48
+ def Refstepcounter(name: str) -> TeX:
49
+ return ControlSequence("refstepcounter", (Parameter(name),))
50
+
51
+
52
+ @Registry.add
53
+ def Value(name: str) -> TeX:
54
+ return ControlSequence("value", (Parameter(name),))
55
+
56
+
57
+ @Registry.add
58
+ def Arabic(name: str) -> TeX:
59
+ return ControlSequence("arabic", (Parameter(name),))
60
+
61
+
62
+ @Registry.add
63
+ def RomanCounter(name: str) -> TeX:
64
+ return ControlSequence("roman", (Parameter(name),))
65
+
66
+
67
+ @Registry.add
68
+ def RomanCounterUpper(name: str) -> TeX:
69
+ return ControlSequence("Roman", (Parameter(name),))
70
+
71
+
72
+ @Registry.add
73
+ def Alph(name: str) -> TeX:
74
+ return ControlSequence("alph", (Parameter(name),))
75
+
76
+
77
+ @Registry.add
78
+ def AlphUpper(name: str) -> TeX:
79
+ return ControlSequence("Alph", (Parameter(name),))
80
+
81
+
82
+ @Registry.add
83
+ def UseCounter(name: str) -> TeX:
84
+ """Render `\\thecounter` for given counter name."""
85
+ return Raw(f"\\the{name}")
@@ -0,0 +1,109 @@
1
+ from ..interface.tex import TeX
2
+ from ..model.control_sequence import ControlSequence, Parameter
3
+ from ..model.raw import Raw
4
+ from ..registry import Registry
5
+
6
+ __all__ = [
7
+ "DeclareRobustCommand",
8
+ "Def",
9
+ "Newcommand",
10
+ "Newenvironment",
11
+ "Providecommand",
12
+ "Renewcommand",
13
+ "Renewenvironment",
14
+ ]
15
+
16
+
17
+ def _cmd(
18
+ name: str,
19
+ cs: str,
20
+ nargs: int | None,
21
+ default: str | None,
22
+ body: TeX | str,
23
+ star: bool,
24
+ ) -> TeX:
25
+ full = name + ("*" if star else "")
26
+ params: list[Parameter] = [Parameter(Raw(cs))]
27
+ if nargs is not None:
28
+ params.append(Parameter(str(nargs), optional=True))
29
+ if default is not None:
30
+ params.append(Parameter(default, optional=True))
31
+ params.append(Parameter(body))
32
+ return ControlSequence(full, tuple(params))
33
+
34
+
35
+ @Registry.add
36
+ def Newcommand(
37
+ cs: str,
38
+ body: TeX | str,
39
+ nargs: int | None = None,
40
+ default: str | None = None,
41
+ star: bool = False,
42
+ ) -> TeX:
43
+ return _cmd("newcommand", cs, nargs, default, body, star)
44
+
45
+
46
+ @Registry.add
47
+ def Renewcommand(
48
+ cs: str,
49
+ body: TeX | str,
50
+ nargs: int | None = None,
51
+ default: str | None = None,
52
+ star: bool = False,
53
+ ) -> TeX:
54
+ return _cmd("renewcommand", cs, nargs, default, body, star)
55
+
56
+
57
+ @Registry.add
58
+ def Providecommand(
59
+ cs: str,
60
+ body: TeX | str,
61
+ nargs: int | None = None,
62
+ default: str | None = None,
63
+ star: bool = False,
64
+ ) -> TeX:
65
+ return _cmd("providecommand", cs, nargs, default, body, star)
66
+
67
+
68
+ @Registry.add
69
+ def DeclareRobustCommand(
70
+ cs: str,
71
+ body: TeX | str,
72
+ nargs: int | None = None,
73
+ star: bool = False,
74
+ ) -> TeX:
75
+ return _cmd("DeclareRobustCommand", cs, nargs, None, body, star)
76
+
77
+
78
+ @Registry.add
79
+ def Newenvironment(
80
+ name: str,
81
+ begin: TeX | str,
82
+ end: TeX | str,
83
+ nargs: int | None = None,
84
+ ) -> TeX:
85
+ params: list[Parameter] = [Parameter(name)]
86
+ if nargs is not None:
87
+ params.append(Parameter(str(nargs), optional=True))
88
+ params.extend([Parameter(begin), Parameter(end)])
89
+ return ControlSequence("newenvironment", tuple(params))
90
+
91
+
92
+ @Registry.add
93
+ def Renewenvironment(
94
+ name: str,
95
+ begin: TeX | str,
96
+ end: TeX | str,
97
+ nargs: int | None = None,
98
+ ) -> TeX:
99
+ params: list[Parameter] = [Parameter(name)]
100
+ if nargs is not None:
101
+ params.append(Parameter(str(nargs), optional=True))
102
+ params.extend([Parameter(begin), Parameter(end)])
103
+ return ControlSequence("renewenvironment", tuple(params))
104
+
105
+
106
+ @Registry.add
107
+ def Def(cs: str, body: TeX | str) -> TeX:
108
+ """Low-level TeX \\def — use sparingly."""
109
+ return Raw(f"\\def\\{cs}{{{body}}}")
@@ -0,0 +1,93 @@
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 ..packages import FLOAT, FLOATROW
6
+ from ..registry import Registry
7
+
8
+ __all__ = [
9
+ "Columnbreak",
10
+ "Figure",
11
+ "FigureStar",
12
+ "Floatsetup",
13
+ "Minipage",
14
+ "Multicols",
15
+ "Newfloat",
16
+ "Restylefloat",
17
+ "Table",
18
+ "TableStar",
19
+ "Titlepage",
20
+ ]
21
+
22
+
23
+ def _placed(name: str, body: TeX | str, placement: str | None) -> TeX:
24
+ if placement is None:
25
+ return Environment(name, body)
26
+ return Environment(name, body, (Parameter(placement, optional=True),))
27
+
28
+
29
+ @Registry.add
30
+ def Figure(body: TeX | str, placement: str | None = None) -> TeX:
31
+ return _placed("figure", body, placement)
32
+
33
+
34
+ @Registry.add
35
+ def Table(body: TeX | str, placement: str | None = None) -> TeX:
36
+ return _placed("table", body, placement)
37
+
38
+
39
+ @Registry.add
40
+ def FigureStar(body: TeX | str, placement: str | None = None) -> TeX:
41
+ return _placed("figure*", body, placement)
42
+
43
+
44
+ @Registry.add
45
+ def TableStar(body: TeX | str, placement: str | None = None) -> TeX:
46
+ return _placed("table*", body, placement)
47
+
48
+
49
+ @Registry.add
50
+ def Minipage(width: str, body: TeX | str, align: str | None = None) -> TeX:
51
+ if align is None:
52
+ return Environment("minipage", body, (Parameter(width),))
53
+ return Environment(
54
+ "minipage",
55
+ body,
56
+ (Parameter(align, optional=True), Parameter(width)),
57
+ )
58
+
59
+
60
+ @Registry.add
61
+ @with_package(FLOAT)
62
+ def Restylefloat(typ: str) -> TeX:
63
+ return ControlSequence("restylefloat", (Parameter(typ),))
64
+
65
+
66
+ @Registry.add
67
+ @with_package(FLOAT)
68
+ def Newfloat(typ: str, placement: str, ext: str) -> TeX:
69
+ return ControlSequence(
70
+ "newfloat",
71
+ (Parameter(typ), Parameter(placement), Parameter(ext)),
72
+ )
73
+
74
+
75
+ @Registry.add
76
+ @with_package(FLOATROW)
77
+ def Floatsetup(options: dict[str, str]) -> TeX:
78
+ return ControlSequence("floatsetup", (Parameter(options),))
79
+
80
+
81
+ @Registry.add
82
+ def Multicols(n: int, body: TeX | str) -> TeX:
83
+ return Environment("multicols", body, (Parameter(str(n)),))
84
+
85
+
86
+ @Registry.add
87
+ def Columnbreak() -> TeX:
88
+ return ControlSequence("columnbreak", ())
89
+
90
+
91
+ @Registry.add
92
+ def Titlepage(body: TeX | str) -> TeX:
93
+ return Environment("titlepage", body)
pytex/commands/font.py ADDED
@@ -0,0 +1,138 @@
1
+ from ..interface.tex import TeX
2
+ from ..model.control_sequence import ControlSequence, Parameter
3
+ from ..registry import Registry
4
+
5
+ __all__ = [
6
+ "Bfseries",
7
+ "Fontsize",
8
+ "Footnotesize",
9
+ "Huge",
10
+ "HugeBig",
11
+ "Itshape",
12
+ "Large",
13
+ "LargeBig",
14
+ "LargeMid",
15
+ "Mdseries",
16
+ "Normalfont",
17
+ "Normalsize",
18
+ "Rmfamily",
19
+ "Scriptsize",
20
+ "Scshape",
21
+ "Selectfont",
22
+ "Sffamily",
23
+ "Slshape",
24
+ "Small",
25
+ "Tiny",
26
+ "Ttfamily",
27
+ "Upshape",
28
+ ]
29
+
30
+
31
+ @Registry.add
32
+ def Fontsize(size: str, baseline: str) -> TeX:
33
+ return ControlSequence("fontsize", (Parameter(size), Parameter(baseline)))
34
+
35
+
36
+ @Registry.add
37
+ def Selectfont() -> TeX:
38
+ return ControlSequence("selectfont", ())
39
+
40
+
41
+ @Registry.add
42
+ def Rmfamily() -> TeX:
43
+ return ControlSequence("rmfamily", ())
44
+
45
+
46
+ @Registry.add
47
+ def Sffamily() -> TeX:
48
+ return ControlSequence("sffamily", ())
49
+
50
+
51
+ @Registry.add
52
+ def Ttfamily() -> TeX:
53
+ return ControlSequence("ttfamily", ())
54
+
55
+
56
+ @Registry.add
57
+ def Bfseries() -> TeX:
58
+ return ControlSequence("bfseries", ())
59
+
60
+
61
+ @Registry.add
62
+ def Mdseries() -> TeX:
63
+ return ControlSequence("mdseries", ())
64
+
65
+
66
+ @Registry.add
67
+ def Itshape() -> TeX:
68
+ return ControlSequence("itshape", ())
69
+
70
+
71
+ @Registry.add
72
+ def Slshape() -> TeX:
73
+ return ControlSequence("slshape", ())
74
+
75
+
76
+ @Registry.add
77
+ def Scshape() -> TeX:
78
+ return ControlSequence("scshape", ())
79
+
80
+
81
+ @Registry.add
82
+ def Upshape() -> TeX:
83
+ return ControlSequence("upshape", ())
84
+
85
+
86
+ @Registry.add
87
+ def Normalfont() -> TeX:
88
+ return ControlSequence("normalfont", ())
89
+
90
+
91
+ @Registry.add
92
+ def Tiny() -> TeX:
93
+ return ControlSequence("tiny", ())
94
+
95
+
96
+ @Registry.add
97
+ def Scriptsize() -> TeX:
98
+ return ControlSequence("scriptsize", ())
99
+
100
+
101
+ @Registry.add
102
+ def Footnotesize() -> TeX:
103
+ return ControlSequence("footnotesize", ())
104
+
105
+
106
+ @Registry.add
107
+ def Small() -> TeX:
108
+ return ControlSequence("small", ())
109
+
110
+
111
+ @Registry.add
112
+ def Normalsize() -> TeX:
113
+ return ControlSequence("normalsize", ())
114
+
115
+
116
+ @Registry.add
117
+ def Large() -> TeX:
118
+ return ControlSequence("large", ())
119
+
120
+
121
+ @Registry.add
122
+ def LargeMid() -> TeX:
123
+ return ControlSequence("Large", ())
124
+
125
+
126
+ @Registry.add
127
+ def LargeBig() -> TeX:
128
+ return ControlSequence("LARGE", ())
129
+
130
+
131
+ @Registry.add
132
+ def Huge() -> TeX:
133
+ return ControlSequence("huge", ())
134
+
135
+
136
+ @Registry.add
137
+ def HugeBig() -> TeX:
138
+ return ControlSequence("Huge", ())
@@ -0,0 +1,88 @@
1
+ from pytex.model.empty import Empty
2
+
3
+ from ..helpers.with_package import with_package
4
+ from ..interface.tex import TeX
5
+ from ..model.control_sequence import ControlSequence, Parameter
6
+ from ..packages import FONTAWESOME
7
+ from ..registry import Registry
8
+
9
+ __all__ = [
10
+ "FaBookmark",
11
+ "FaCheckCircle",
12
+ "FaCog",
13
+ "FaExclamationCircle",
14
+ "FaExclamationTriangle",
15
+ "FaGithub",
16
+ "FaIcon",
17
+ "FaInfoCircle",
18
+ "FaQuestionCircle",
19
+ "FaVoteYea",
20
+ ]
21
+
22
+
23
+ @Registry.add
24
+ @with_package(FONTAWESOME)
25
+ def FaIcon(name: str | None) -> TeX:
26
+ # fontawesome (v4) spells the generic helper lowercase; v5's \faIcon does
27
+ # not exist here. The v4 package loads via Type1 fonts, so it survives
28
+ # tectonic's XeTeX engine (fontawesome5's OTF load crashes it).
29
+ return ControlSequence("faicon", (Parameter(name),)) if name is not None else Empty
30
+
31
+
32
+ def _icon(name: str) -> TeX:
33
+ return ControlSequence(name, ())
34
+
35
+
36
+ @Registry.add
37
+ @with_package(FONTAWESOME)
38
+ def FaInfoCircle() -> TeX:
39
+ return _icon("faInfoCircle")
40
+
41
+
42
+ @Registry.add
43
+ @with_package(FONTAWESOME)
44
+ def FaExclamationTriangle() -> TeX:
45
+ return _icon("faExclamationTriangle")
46
+
47
+
48
+ @Registry.add
49
+ @with_package(FONTAWESOME)
50
+ def FaExclamationCircle() -> TeX:
51
+ return _icon("faExclamationCircle")
52
+
53
+
54
+ @Registry.add
55
+ @with_package(FONTAWESOME)
56
+ def FaCheckCircle() -> TeX:
57
+ return _icon("faCheckCircle")
58
+
59
+
60
+ @Registry.add
61
+ @with_package(FONTAWESOME)
62
+ def FaVoteYea() -> TeX:
63
+ # No \faVoteYea macro in fontawesome v4; use the generic name lookup.
64
+ return ControlSequence("faicon", (Parameter("vote-yea"),))
65
+
66
+
67
+ @Registry.add
68
+ @with_package(FONTAWESOME)
69
+ def FaQuestionCircle() -> TeX:
70
+ return _icon("faQuestionCircle")
71
+
72
+
73
+ @Registry.add
74
+ @with_package(FONTAWESOME)
75
+ def FaBookmark() -> TeX:
76
+ return _icon("faBookmark")
77
+
78
+
79
+ @Registry.add
80
+ @with_package(FONTAWESOME)
81
+ def FaCog() -> TeX:
82
+ return _icon("faCog")
83
+
84
+
85
+ @Registry.add
86
+ @with_package(FONTAWESOME)
87
+ def FaGithub() -> TeX:
88
+ return _icon("faGithub")
@@ -0,0 +1,75 @@
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 FONTSPEC
6
+ from ..registry import Registry
7
+
8
+ __all__ = [
9
+ "Newfontfamily",
10
+ "Setfontfamilies",
11
+ "Setmainfont",
12
+ "Setmonofont",
13
+ "Setsansfont",
14
+ ]
15
+
16
+
17
+ def _opts_to_str(opts: dict[str, str]) -> str:
18
+ return ",".join(k if v == "" else f"{k}={v}" for k, v in opts.items())
19
+
20
+
21
+ @Registry.add
22
+ @with_package(FONTSPEC)
23
+ def Setmainfont(font: str, options: dict[str, str] | None = None) -> TeX:
24
+ if options is None:
25
+ return ControlSequence("setmainfont", (Parameter(font),))
26
+ return ControlSequence(
27
+ "setmainfont",
28
+ (Parameter(font), Parameter(Raw(_opts_to_str(options)), optional=True)),
29
+ )
30
+
31
+
32
+ @Registry.add
33
+ @with_package(FONTSPEC)
34
+ def Setsansfont(font: str, options: dict[str, str] | None = None) -> TeX:
35
+ if options is None:
36
+ return ControlSequence("setsansfont", (Parameter(font),))
37
+ return ControlSequence(
38
+ "setsansfont",
39
+ (Parameter(font), Parameter(Raw(_opts_to_str(options)), optional=True)),
40
+ )
41
+
42
+
43
+ @Registry.add
44
+ @with_package(FONTSPEC)
45
+ def Setmonofont(font: str, options: dict[str, str] | None = None) -> TeX:
46
+ if options is None:
47
+ return ControlSequence("setmonofont", (Parameter(font),))
48
+ return ControlSequence(
49
+ "setmonofont",
50
+ (Parameter(font), Parameter(Raw(_opts_to_str(options)), optional=True)),
51
+ )
52
+
53
+
54
+ @Registry.add
55
+ @with_package(FONTSPEC)
56
+ def Newfontfamily(cmd: str, font: str, options: dict[str, str] | None = None) -> TeX:
57
+ if options is None:
58
+ return ControlSequence(
59
+ "newfontfamily",
60
+ (Parameter(Raw(cmd)), Parameter(font)),
61
+ )
62
+ return ControlSequence(
63
+ "newfontfamily",
64
+ (
65
+ Parameter(Raw(cmd)),
66
+ Parameter(font),
67
+ Parameter(Raw(_opts_to_str(options)), optional=True),
68
+ ),
69
+ )
70
+
71
+
72
+ @Registry.add
73
+ @with_package(FONTSPEC)
74
+ def Setfontfamilies(font: str) -> TeX:
75
+ return ControlSequence("setfontfamilies", (Parameter(font),))